@Override public boolean proc(Weapon weapon, Char attacker, Char defender, int damage) { int level = Math.max(0, weapon.level); int dmg = damage; for (int i = 1; i <= level + 1; i++) { dmg = Math.max(dmg, attacker.damageRoll() - i); } if (dmg > damage) { defender.damage(dmg - damage, this); return true; } else { return false; } }
@Override protected boolean doAttack(Char enemy) { if (Level.distance(pos, enemy.pos) <= 1) { return super.doAttack(enemy); } else { boolean visible = Level.fieldOfView[pos] || Level.fieldOfView[enemy.pos]; if (visible) { ((ShamanSprite) sprite).zap(enemy.pos); } spend(TIME_TO_ZAP); if (hit(this, enemy, true)) { int dmg = Random.Int(2, 12); if (Level.water[enemy.pos] && !enemy.flying) { dmg *= 1.5f; } enemy.damage(dmg, LightningTrap.LIGHTNING); enemy.sprite.centerEmitter().burst(SparkParticle.FACTORY, 3); enemy.sprite.flash(); if (enemy == Dungeon.hero) { Camera.main.shake(2, 0.3f); if (!enemy.isAlive()) { Dungeon.fail(Utils.format(ResultDescriptions.MOB, Utils.indefinite(name))); GLog.n(TXT_LIGHTNING_KILLED, name); } } } else { enemy.sprite.showStatus(CharSprite.NEUTRAL, enemy.defenseVerb()); } return !visible; } }