Exemplo n.º 1
0
 /**
  * Method useSkill.
  *
  * @param activeChar Creature
  * @param targets List<Creature>
  */
 @Override
 public void useSkill(Creature activeChar, List<Creature> targets) {
   int sps =
       isSSPossible()
           ? (isMagic()
               ? activeChar.getChargedSpiritShot()
               : activeChar.getChargedSoulShot() ? 2 : 0)
           : 0;
   Creature realTarget;
   boolean reflected;
   for (Creature target : targets) {
     if (target != null) {
       if (target.isDead()) {
         continue;
       }
       reflected = target.checkReflectSkill(activeChar, this);
       realTarget = reflected ? activeChar : target;
       Formulas.AttackInfo info = Formulas.calcMagicDam(activeChar, realTarget, this, sps);
       if (info.damage >= 1) {
         realTarget.reduceCurrentHp(
             info.damage,
             info.reflectableDamage,
             activeChar,
             this,
             true,
             true,
             false,
             true,
             false,
             false,
             true);
       }
       getEffects(activeChar, target, getActivateRate() > 0, false, reflected);
     }
   }
   if (isSuicideAttack()) {
     activeChar.doDie(null);
   } else if (isSSPossible()) {
     activeChar.unChargeShots(isMagic());
   }
 }
Exemplo n.º 2
0
  /**
   * Method useSkill.
   *
   * @param activeChar Creature
   * @param targets List<Creature>
   */
  @Override
  public void useSkill(Creature activeChar, List<Creature> targets) {
    int effect = _effectPoint;

    if (isSSPossible()
        && (activeChar.getChargedSoulShot() || (activeChar.getChargedSpiritShot() > 0))) {
      effect *= 2;
    }

    for (Creature target : targets) {
      if (target != null) {
        if (!target.isAutoAttackable(activeChar)) {
          continue;
        }

        if (target.isNpc()) {
          if (_unaggring) {
            if (target.isNpc() && activeChar.isPlayable()) {
              ((NpcInstance) target).getAggroList().addDamageHate(activeChar, 0, -effect);
            }
          } else {
            target.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, activeChar, effect);

            if (!_silent) {
              target.getAI().notifyEvent(CtrlEvent.EVT_ATTACKED, activeChar, 0);
            }
          }
        } else if (target.isPlayable() && !target.isDebuffImmune()) {
          target.setTarget(activeChar);
        }

        getEffects(activeChar, target, getActivateRate() > 0, false);
      }
    }

    if (isSSPossible()) {
      activeChar.unChargeShots(isMagic());
    }
  }
Exemplo n.º 3
0
 /**
  * Method useSkill.
  *
  * @param activeChar Creature
  * @param targets List<Creature>
  */
 @Override
 public void useSkill(Creature activeChar, List<Creature> targets) {
   if (isSSPossible()) {
     activeChar.unChargeShots(isMagic());
   }
   if (!activeChar.isPlayer()) {
     return;
   }
   Player player = activeChar.getPlayer();
   if (player.getTrainedBeasts() == null) {
     return;
   }
   if (_type == 0) {
     for (Creature target : targets) {
       if ((target != null) && (target instanceof TamedBeastInstance)) {
         if (player.getTrainedBeasts().get(target.getObjectId()) != null) {
           ((TamedBeastInstance) target).despawnWithDelay(1000);
         }
       }
     }
   } else if (_type > 0) {
     if (_type == 1) {
       for (TamedBeastInstance tamedBeast : player.getTrainedBeasts().values()) {
         tamedBeast
             .getAI()
             .setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player, Config.FOLLOW_RANGE);
       }
     } else if (_type == 3) {
       for (TamedBeastInstance tamedBeast : player.getTrainedBeasts().values()) {
         tamedBeast.buffOwner();
       }
     } else if (_type == 4) {
       for (TamedBeastInstance tamedBeast : player.getTrainedBeasts().values()) {
         tamedBeast.doDespawn();
       }
     }
   }
 }
Exemplo n.º 4
0
  /**
   * Method useSkill.
   *
   * @param activeChar Creature
   * @param targets List<Creature>
   */
  @Override
  public void useSkill(Creature activeChar, List<Creature> targets) {
    if (!activeChar.isPlayer()) {
      return;
    }

    boolean ss = activeChar.getChargedSoulShot() && isSSPossible();

    if (ss && (getTargetType() != SkillTargetType.TARGET_SELF)) {
      activeChar.unChargeShots(false);
    }

    Creature realTarget;
    boolean reflected;

    for (Creature target : targets) {
      if (target != null) {
        if (target.isDead()) {
          continue;
        }

        reflected = (target != activeChar) && target.checkReflectSkill(activeChar, this);
        realTarget = reflected ? activeChar : target;

        if (getPower() > 0) {
          AttackInfo info =
              Formulas.calcPhysDam(activeChar, realTarget, this, false, false, ss, false);

          if (info.lethal_dmg > 0) {
            realTarget.reduceCurrentHp(
                info.lethal_dmg,
                info.reflectableDamage,
                activeChar,
                this,
                true,
                true,
                false,
                false,
                false,
                false,
                false);
          }

          realTarget.reduceCurrentHp(
              info.damage,
              info.reflectableDamage,
              activeChar,
              this,
              true,
              true,
              false,
              true,
              false,
              false,
              true);

          if (!reflected) {
            realTarget.doCounterAttack(this, activeChar, false);
          }
        }

        if (realTarget.isPlayable() || realTarget.isMonster()) {
          activeChar.setConsumedSouls(activeChar.getConsumedSouls() + _numSouls, null);
        }

        getEffects(activeChar, target, getActivateRate() > 0, false, reflected);
      }
    }

    if (isSSPossible()) {
      activeChar.unChargeShots(isMagic());
    }
  }