Beispiel #1
0
		/// <summary>
		/// Leeches the given amount of health from this Unit and adds it to the receiver (if receiver != null and is Unit).
		/// </summary>
		/// <param name="factor">The factor applied to the amount that was leeched before adding it to the receiver</param>
		public void LeechHealth(Unit receiver, int amount, float factor, SpellEffect effect)
		{
			var initialHealth = Health;

			DoSpellDamage(receiver != null ? receiver.Master : this, effect, amount);

			// only apply as much as was leeched
			amount = initialHealth - Health;

			if (factor > 0)
			{
				amount = (int)(amount * factor);
			}

			if (receiver != null)
			{
				receiver.Heal(this, amount, effect);
			}
		}