void FilterTargets(std::list<WorldObject*>& targets) { if (targets.empty()) return; targets.sort(Trinity::ObjectDistanceOrderPred(GetCaster(), false)); if (targets.size() > GetSpellValue()->MaxAffectedTargets) { std::list<WorldObject*>::iterator itr = targets.begin(); std::advance(itr, GetSpellValue()->MaxAffectedTargets); targets.erase(itr, targets.end()); } }
void HandleDummy(SpellEffIndex /*effect*/) { Unit* target = GetHitUnit(); Unit* caster = GetCaster(); int32 damage = 0; damage = GetSpellValue()->EffectBasePoints[0]; // apply percent damage mods switch (GetSpellInfo()->Id) { case 12162: ApplyPctN(damage, 16); break; // Rank 1 case 12850: ApplyPctN(damage, 32); break; // Rank 2 case 12868: ApplyPctN(damage, 48); break; // Rank 3 default: break; } SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(12721); uint32 ticks = spellInfo->GetDuration() / spellInfo->Effects[EFFECT_0].Amplitude; // Add remaining ticks to damage done if (AuraEffect const* aurEff = target->GetAuraEffect(12721, EFFECT_0, caster->GetGUID())) damage += aurEff->GetAmount() * (ticks - aurEff->GetTickNumber()); damage /= ticks; caster->CastCustomSpell(target, 12721, &damage, NULL, NULL, true); }
void Hit() { if (!GetHitUnit()) return; if (!GetCaster()) return; if (!GetOriginalCaster()) return; if (Aura* debuff = GetOriginalCaster()->AddAura(89421, GetHitUnit())) { if (!GetSpellValue()) return; int32 duration = GetSpellValue()->EffectBasePoints[1]; debuff->SetDuration(duration, false); } }
void HandleDummy(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); if (!GetCaster()) return; if (InstanceScript * pInstance = GetCaster()->GetInstanceScript()) { if (Creature* GunshipNpc = pInstance->instance->GetCreature(pInstance->GetData64(DATA_GUNSHIP_NPC_MAIN))) { GetCaster()->DealDamage(GunshipNpc, GetSpellValue()->EffectBasePoints[EFFECT_0]); } } }