void HandleBeforeCast() { Unit* caster = GetCaster(); if(caster) { int32 Rage_val = 0; PlayerSpellMap const& sp_list = caster->ToPlayer()->GetSpellMap(); // Retrieves max rage to retain for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr) { if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->disabled) continue; SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellIconID == 139) { Rage_val += caster->CalculateSpellDamage(caster, spellInfo, EFFECT_0); } } // Check and update (do not forget the * 10 on each SetPower with POWER_RAGE) if (caster->GetPower(POWER_RAGE) > Rage_val * 10) { Rage_val *= sWorld->getRate(RATE_POWER_RAGE_INCOME); caster->SetPower(POWER_RAGE, Rage_val * 10); } } }
void HandleDummy(SpellEffIndex /* effIndex */) { Unit* caster = GetCaster(); if (Unit* target = GetHitUnit()) { uint32 count = target->GetDiseasesByCaster(caster->GetGUID()); int32 bp = int32(count * caster->CountPctFromMaxHealth(int32(GetSpellInfo()->Effects[EFFECT_0].DamageMultiplier))); // Improved Death Strike if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, ICON_ID_IMPROVED_DEATH_STRIKE, 0)) AddPctN(bp, caster->CalculateSpellDamage(caster, aurEff->GetSpellInfo(), 2)); caster->CastCustomSpell(caster, SPELL_DEATH_STRIKE_HEAL, &bp, NULL, NULL, false); } }