@Override public boolean attack(Char enemy) { for (int pos : beam.subPath(1, beam.dist)) { Char ch = Actor.findChar(pos); if (ch == null) { continue; } if (hit(this, ch, true)) { ch.damage(Random.NormalIntRange(14, 20), this); if (Dungeon.visible[pos]) { ch.sprite.flash(); CellEmitter.center(pos).burst(PurpleParticle.BURST, Random.IntRange(1, 2)); } if (!ch.isAlive() && ch == Dungeon.hero) { Dungeon.fail(Utils.format(ResultDescriptions.MOB, Utils.indefinite(name))); GLog.n(TXT_DEATHGAZE_KILLED, name); } } else { ch.sprite.showStatus(CharSprite.NEUTRAL, ch.defenseVerb()); } } return true; }
@Override protected void onZap(Ballistica bolt) { Char ch = Actor.findChar(bolt.collisionPos); if (ch != null) { if (ch.buff(Corruption.class) != null) { GLog.w("that character is already corrupted"); return; } if (ch.properties().contains(Char.Property.BOSS) || ch.properties().contains(Char.Property.MINIBOSS)) { GLog.w("Bosses are immune to corruption"); return; } int basePower = 10 + 2 * level(); int mobPower = Random.IntRange(0, ch.HT) + ch.HP * 2; for (Buff buff : ch.buffs()) { if (buff.type == Buff.buffType.NEGATIVE) { mobPower *= 0.67; break; } } int extraCharges = 0; // try to use extra charges to overpower the mob while (basePower <= mobPower) { extraCharges++; basePower += 5 + level(); } // if we fail, lose all charges, remember we have 1 left to lose from using the wand. if (extraCharges >= curCharges) { curCharges = 1; GLog.w("The corrupting power was not strong enough, nothing happens."); return; } // otherwise corrupt the mob & spend charges Buff.append(ch, Corruption.class); ch.HP = ch.HT; curCharges -= extraCharges; usagesToKnow -= extraCharges; processSoulMark(ch, extraCharges + chargesPerCast()); } }