/// <summary> /// Leeches the given amount of power from this Unit and adds it to the receiver (if receiver != null and is Unit). /// </summary> public void LeechPower(Unit receiver, int amount, float factor, SpellEffect effect) { var currentPower = Power; // Resilience reduces mana drain by 2.2%, amount is rounded. amount -= (amount * GetResiliencePct() * 2.2f).RoundInt(); if (amount > currentPower) { amount = currentPower; } Power = currentPower - amount; if (receiver != null) { receiver.Energize(this, amount, effect); } }