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) {
    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());
    }
  }