public override int OnDamage(int damage) { if (IsShieldBroken()) { _collectedDamage += damage; return(damage); } var absorptionDamage = (int)Math.Round(damage * _damageAbsorptionPercent / 100f); var newShieldRate = _shieldRate - absorptionDamage; if (newShieldRate > 0) { damage -= absorptionDamage; _shieldRate = newShieldRate; } else { damage -= _shieldRate; _shieldRate = 0; var nearestEnemy = Core.GetNearestEnemy(Unit); if (nearestEnemy != null && nearestEnemy.IsAlive()) { nearestEnemy.Damage(_shieldExplosionDamageRate); } Unit.Heal(_shieldExplosionHealRate); } _collectedDamage += damage; return(damage); }
public override void EndBuff() { var target = Core.GetNearestEnemy(Unit); target.Damage(_damage); Unit.Heal(100); }
public override int OnDamage(int damage) { if (damage > _healHpThreshold) { Unit.Heal(_healValue); } return(damage); }
public override int OnDamage(int damage) { _turnReceiveDamage += damage; _stunned = _turnReceiveDamage > _stunFreeDamage ? 0 : _stunned; if (damage >= _healHpThreshold) { Unit.Heal(_healValue); } return(damage); }
private void HealFromCollectedDamage() { var healValue = (int)Math.Round(_collectedDamage * _damageHealPercent / 100f); if (healValue == 0) { return; } Unit.Heal(healValue); _collectedDamage = 0; }
public override void PostLogicTick() { if (_lasthealthUnit > Unit.Health) { int healengValue = (int)System.Math.Round((double)((_lasthealthUnit - Unit.Health) * _healPrecent / 100)); if (Unit.LockAction) { Unit.LockAction = false; Unit.Heal(_healPrecent); Unit.LockAction = true; } else { Unit.Heal(_healPrecent); } } }
public override int OnDamage(int damage) { if (_abilityShieldValue > 0) { _abilityShieldValue -= (int)Math.Round(damage * _abilityShieldAbsorbingPercent / 100f); damage -= (int)Math.Round(damage * _abilityShieldAbsorbingPercent / 100f); damage += _abilityShieldValue > 0 ? 0 : -_abilityShieldValue; if (_abilityShieldValue < 0) { var target = Core.GetNearestEnemy(Unit); if (target != null && target.IsAlive()) { target.Damage(_abilityShieldExplosionDamage); } Unit.Heal(_abilityShieldExplosionHeal); } } _turnReceiveDamage += damage; _stunned = _turnReceiveDamage > _stunFreeDamage ? 0 : _stunned; return(damage); }
public override void OnTurn() { if (_stunned == 0) { var target = Core.GetNearestEnemy(Unit); if (target != null && target.IsAlive()) { if (Core.GetDistance(Unit, target) > _attackDistance) { Unit.MoveTo(target.X, target.Y); } else { target.Damage(_damage); } } Unit.AddMana(_manaRegen); } Unit.Heal((int)Math.Round(_turnReceiveDamage * _healDamagePercent / 100f)); _stunned = Math.Max(0, _stunned - 1); _turnReceiveDamage = 0; }