public bool BeHited(LiveMonster src) { int hitrate = SkillAssistant.GetHit(src, this); if (hitrate > MathTool.GetRandom(100)) { HitDamage damage = SkillAssistant.GetDamage(src, this); CheckDamageBuffEffect(src, damage); HpBar.OnDamage(damage); SkillAssistant.CheckHitEffectAfter(src, this, damage); if (src.WeaponId > 0) { src.Weapon.OnHit(); } if (WeaponId > 0) { Weapon.OnHited(); } if (damage.Value > 0) { BuffManager.CheckRecoverOnHit(); lastDamagerId = src.Id; peakDamagerLuk = Math.Max(peakDamagerLuk, src.RealLuk); } return(true); } return(false); }
public void OnMagicDamage(IMonster source, double damage, int element) { var damValue = damage * (1 - FormulaBook.GetMagDefRate(RealMag)); var dam = new HitDamage((int)damValue, (int)damValue, element, DamageTypes.Magic); lastDamagerId = source == null ? 0 : source.Id; CheckMagicDamage(dam); HpBar.OnDamage(dam); }