void HandleHitTarget() { int damage = GetHitDamage(); AuraEffect aurEff = GetCaster().GetAuraEffect(SpellIds.FirstBlood, 0); if (aurEff != null) { spell_dh_first_blood script = aurEff.GetBase().GetScript <spell_dh_first_blood>(); if (script != null) { if (GetHitUnit().GetGUID() == script.GetFirstTarget()) { MathFunctions.AddPct(ref damage, aurEff.GetAmount()); } } } SetHitDamage(damage); }
void DecideFirstTarget(List <WorldObject> targetList) { if (targetList.Empty()) { return; } Aura aura = GetCaster().GetAura(SpellIds.FirstBlood); if (aura == null) { return; } ObjectGuid firstTargetGUID = ObjectGuid.Empty; ObjectGuid selectedTarget = GetCaster().GetTarget(); // Prefer the selected target if he is one of the enemies if (targetList.Count > 1 && !selectedTarget.IsEmpty()) { var foundObj = targetList.Find(obj => obj.GetGUID() == selectedTarget); if (foundObj != null) { firstTargetGUID = foundObj.GetGUID(); } } if (firstTargetGUID.IsEmpty()) { firstTargetGUID = targetList[0].GetGUID(); } spell_dh_first_blood script = aura.GetScript <spell_dh_first_blood>(); if (script != null) { script.SetFirstTarget(firstTargetGUID); } }