コード例 #1
0
  public float attackDelay() {
    KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon;
    if (wep != null) {

      return wep.speedFactor(this);

    } else {
      return 1f;
    }
  }
コード例 #2
0
 @Override
 public int damageRoll() {
   KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon;
   int dmg;
   if (wep != null) {
     dmg = wep.damageRoll(this);
   } else {
     dmg = STR() > 10 ? Random.IntRange(1, STR() - 9) : 1;
   }
   return buff(Fury.class) != null ? (int) (dmg * 1.5f) : dmg;
 }
コード例 #3
0
 @Override
 public void restoreFromBundle(Bundle bundle) {
   super.restoreFromBundle(bundle);
   maxCharges = bundle.getInt(MAX_CHARGES);
   curCharges = bundle.getInt(CUR_CHARGES);
   curChargeKnown = bundle.getBoolean(CUR_CHARGE_KNOWN);
 }
コード例 #4
0
 @Override
 public void storeInBundle(Bundle bundle) {
   super.storeInBundle(bundle);
   bundle.put(MAX_CHARGES, maxCharges);
   bundle.put(CUR_CHARGES, curCharges);
   bundle.put(CUR_CHARGE_KNOWN, curChargeKnown);
 }
コード例 #5
0
  @Override
  public Item degrade() {
    super.degrade();

    updateLevel();
    updateQuickslot();

    return this;
  }
コード例 #6
0
  @Override
  public int attackSkill(Char target) {

    int bonus = 0;
    for (Buff buff : buffs(RingOfAccuracy.Accuracy.class)) {
      bonus += ((RingOfAccuracy.Accuracy) buff).level;
    }
    float accuracy = (bonus == 0) ? 1 : (float) Math.pow(1.4, bonus);
    if (rangedWeapon != null && Level.distance(pos, target.pos) == 1) {
      accuracy *= 0.5f;
    }

    KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon;
    if (wep != null) {
      return (int) (attackSkill * accuracy * wep.acuracyFactor(this));
    } else {
      return (int) (attackSkill * accuracy);
    }
  }
コード例 #7
0
  @Override
  public Item upgrade() {

    super.upgrade();

    updateLevel();
    curCharges = Math.min(curCharges + 1, maxCharges);
    updateQuickslot();

    return this;
  }
コード例 #8
0
  @Override
  public Item identify() {

    setKnown();
    curChargeKnown = true;
    super.identify();

    updateQuickslot();

    return this;
  }
コード例 #9
0
  @Override
  public int attackProc(Char enemy, int damage) {
    KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon;
    if (wep != null) {

      wep.proc(this, enemy, damage);

      switch (subClass) {
        case GLADIATOR:
          if (wep instanceof MeleeWeapon) {
            damage += Buff.affect(this, Combo.class).hit(enemy, damage);
          }
          break;
        case BATTLEMAGE:
          if (wep instanceof Wand) {
            Wand wand = (Wand) wep;
            if (wand.curCharges < wand.maxCharges && damage > 0) {

              wand.curCharges++;
              if (Dungeon.quickslot == wand) {
                QuickSlot.refresh();
              }

              ScrollOfRecharging.charge(this);
            }
            damage += wand.curCharges;
          }
        case SNIPER:
          if (rangedWeapon != null) {
            Buff.prolong(enemy, SnipersMark.class, attackDelay() * 1.1f);
          }
          break;
        default:
      }
    }

    return damage;
  }
コード例 #10
0
  @Override
  public void execute(Hero hero, String action) {
    if (action.equals(AC_ZAP)) {

      setCurUser(hero);
      wandUser = hero;
      curItem = this;
      GameScene.selectCell(zapper);

    } else {

      super.execute(hero, action);
    }
  }
コード例 #11
0
ファイル: Weapon.java プロジェクト: Jebusito/pixel-dungeon
 @Override
 public void restoreFromBundle(Bundle bundle) {
   super.restoreFromBundle(bundle);
   enchantment = (Enchantment) bundle.get(ENCHANTMENT);
 }
コード例 #12
0
ファイル: Weapon.java プロジェクト: Jebusito/pixel-dungeon
 @Override
 public void storeInBundle(Bundle bundle) {
   super.storeInBundle(bundle);
   bundle.put(ENCHANTMENT, enchantment);
 }