Core/Unit: Big cleanup in Unit::CalcAbsorbResist

Core/AuraScript:
	Fix compile time check for AuraScript functions
	Remove AuraApplication from hook functions parameter list, use GetTarget() and GetTargetApplication() instead
	Add OnEffectAbsorb hook
Scripts: move handlers of Spell Deflection, Savage Defense, Primal Tenacity, Nerves of Steel, Astral shift from core to scripts.

--HG--
branch : trunk
This commit is contained in:
QAston committed 2010-12-27 20:14:54 +01:00
1 parent da8d794f4b
commit ef968f4b15
30 files changed
+791 -438

No files matched your search

@@ -302,11 +302,11 @@ class spell_bronjahm_soulstorm_channel : public SpellScriptLoader
{
PrepareAuraScript(spell_bronjahm_soulstorm_channel_AuraScript);
void HandlePeriodicTick(AuraEffect const* /*aurEff*/, AuraApplication const* aurApp)
void HandlePeriodicTick(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
for (uint32 i = 68904; i <= 68907; ++i)
aurApp->GetTarget()->CastSpell(aurApp->GetTarget(), i, true);
GetTarget()->CastSpell(GetTarget(), i, true);
}
void Register()
@@ -330,14 +330,14 @@ class spell_bronjahm_soulstorm_visual : public SpellScriptLoader
{
PrepareAuraScript(spell_bronjahm_soulstorm_visual_AuraScript);
void HandlePeriodicTick(AuraEffect const* aurEff, AuraApplication const* aurApp)
void HandlePeriodicTick(AuraEffect const* aurEff)
{
PreventDefaultAction();
if (aurEff->GetTickNumber()%5)
return;
aurApp->GetTarget()->CastSpell(aurApp->GetTarget(), 68886, true);
GetTarget()->CastSpell(GetTarget(), 68886, true);
for (uint32 i = 68896; i <= 68898; ++i)
aurApp->GetTarget()->CastSpell(aurApp->GetTarget(), i, true);
GetTarget()->CastSpell(GetTarget(), i, true);
}
void Register()
@@ -314,26 +314,26 @@ class spell_tyrannus_overlord_brand : public SpellScriptLoader
{
PrepareAuraScript(spell_tyrannus_overlord_brand_AuraScript);
void OnApply(AuraEffect const* /*aurEff*/, AuraApplication const* aurApp, AuraEffectHandleModes /*mode*/)
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (aurApp->GetTarget()->GetTypeId() != TYPEID_PLAYER)
if (GetTarget()->GetTypeId() != TYPEID_PLAYER)
return;
oldAI = aurApp->GetTarget()->GetAI();
aurApp->GetTarget()->SetAI(new player_overlord_brandAI(aurApp->GetTarget()->ToPlayer()));
aurApp->GetTarget()->GetAI()->SetGUID(GetCasterGUID());
oldAIState = aurApp->GetTarget()->IsAIEnabled;
aurApp->GetTarget()->IsAIEnabled = true;
oldAI = GetTarget()->GetAI();
GetTarget()->SetAI(new player_overlord_brandAI(GetTarget()->ToPlayer()));
GetTarget()->GetAI()->SetGUID(GetCasterGUID());
oldAIState = GetTarget()->IsAIEnabled;
GetTarget()->IsAIEnabled = true;
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraApplication const* aurApp, AuraEffectHandleModes /*mode*/)
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (aurApp->GetTarget()->GetTypeId() != TYPEID_PLAYER)
if (GetTarget()->GetTypeId() != TYPEID_PLAYER)
return;
delete aurApp->GetTarget()->GetAI();
aurApp->GetTarget()->SetAI(oldAI);
aurApp->GetTarget()->IsAIEnabled = oldAIState;
delete GetTarget()->GetAI();
GetTarget()->SetAI(oldAI);
GetTarget()->IsAIEnabled = oldAIState;
}
void Register()
@@ -1353,9 +1353,9 @@ class spell_taldaram_flame_ball_visual : public SpellScriptLoader
return false;
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraApplication const* aurApp, AuraEffectHandleModes /*mode*/)
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Creature* target = aurApp->GetTarget()->ToCreature();
Creature* target = GetTarget()->ToCreature();
if (!target)
return;
@@ -1439,9 +1439,9 @@ class spell_valanar_kinetic_bomb : public SpellScriptLoader
{
PrepareAuraScript(spell_valanar_kinetic_bomb_AuraScript);
void HandleDummyTick(AuraEffect const* /*aurEff*/, AuraApplication const* aurApp)
void HandleDummyTick(AuraEffect const* /*aurEff*/)
{
Unit* target = aurApp->GetTarget();
Unit* target = GetTarget();
if (target->GetTypeId() != TYPEID_UNIT)
return;
@@ -1449,7 +1449,7 @@ class spell_valanar_kinetic_bomb : public SpellScriptLoader
{
bomb->CastSpell(bomb, SPELL_KINETIC_BOMB_EXPLOSION, true);
bomb->RemoveAurasDueToSpell(SPELL_KINETIC_BOMB_VISUAL);
target->RemoveAura(const_cast<AuraApplication*>(aurApp));
target->RemoveAura(GetAura());
bomb->AI()->DoAction(SPELL_KINETIC_BOMB_EXPLOSION);
}
}
@@ -1507,10 +1507,10 @@ class spell_blood_council_shadow_prison : public SpellScriptLoader
{
PrepareAuraScript(spell_blood_council_shadow_prison_AuraScript);
void HandleDummyTick(AuraEffect const* aurEff, AuraApplication const* aurApp)
void HandleDummyTick(AuraEffect const* aurEff)
{
if (aurApp->GetTarget()->isMoving())
aurApp->GetTarget()->CastSpell(aurApp->GetTarget(), SPELL_SHADOW_PRISON_DAMAGE, true, NULL, aurEff);
if (GetTarget()->isMoving())
GetTarget()->CastSpell(GetTarget(), SPELL_SHADOW_PRISON_DAMAGE, true, NULL, aurEff);
}
void Register()
@@ -479,17 +479,17 @@ class spell_blood_queen_frenzied_bloodthirst : public SpellScriptLoader
{
PrepareAuraScript(spell_blood_queen_frenzied_bloodthirst_AuraScript);
void OnApply(AuraEffect const* /*aurEff*/, AuraApplication const* aurApp, AuraEffectHandleModes /*mode*/)
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (InstanceScript* instance = aurApp->GetTarget()->GetInstanceScript())
if (Creature* bloodQueen = ObjectAccessor::GetCreature(*aurApp->GetTarget(), instance->GetData64(DATA_BLOOD_QUEEN_LANA_THEL)))
if (InstanceScript* instance = GetTarget()->GetInstanceScript())
if (Creature* bloodQueen = ObjectAccessor::GetCreature(*GetTarget(), instance->GetData64(DATA_BLOOD_QUEEN_LANA_THEL)))
bloodQueen->AI()->Talk(EMOTE_BLOODTHIRST);
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraApplication const* aurApp, AuraEffectHandleModes /*mode*/)
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = aurApp->GetTarget();
if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
Unit* target = GetTarget();
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
if (InstanceScript* instance = target->GetInstanceScript())
if (Creature* bloodQueen = ObjectAccessor::GetCreature(*target, instance->GetData64(DATA_BLOOD_QUEEN_LANA_THEL)))
{
@@ -969,7 +969,7 @@ class spell_deathbringer_blood_link_aura : public SpellScriptLoader
return true;
}
void HandlePeriodicTick(AuraEffect const* /*aurEff*/, AuraApplication const* /*aurApp*/)
void HandlePeriodicTick(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
if (GetUnitOwner()->getPowerType() == POWER_ENERGY && GetUnitOwner()->GetPower(POWER_ENERGY) == GetUnitOwner()->GetMaxPower(POWER_ENERGY))
@@ -1022,8 +1022,8 @@ class spell_deathbringer_blood_power : public SpellScriptLoader
void Register()
{
OnEffectCalcAmount += AuraEffectCalcAmountFn(spell_deathbringer_blood_power_AuraScript::RecalculateHook, EFFECT_0, SPELL_AURA_MOD_SCALE);
OnEffectCalcAmount += AuraEffectCalcAmountFn(spell_deathbringer_blood_power_AuraScript::RecalculateHook, EFFECT_1, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_deathbringer_blood_power_AuraScript::RecalculateHook, EFFECT_0, SPELL_AURA_MOD_SCALE);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_deathbringer_blood_power_AuraScript::RecalculateHook, EFFECT_1, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
}
bool Load()
@@ -430,17 +430,17 @@ class spell_festergut_blighted_spores : public SpellScriptLoader
{
PrepareAuraScript(spell_festergut_blighted_spores_AuraScript);
void ExtraEffect(AuraEffect const* /*aurEff*/, AuraApplication const* aurApp, AuraEffectHandleModes /*mode*/)
void ExtraEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (!GetCaster()->IsAIEnabled || GetCaster()->GetTypeId() != TYPEID_UNIT)
return;
uint32 inoculateId = CAST_AI(ScriptedAI, GetCaster()->ToCreature()->AI())->INOCULATED_HELPER;
uint32 currStack = 0;
if (Aura const* inoculate = aurApp->GetTarget()->GetAura(inoculateId))
if (Aura const* inoculate = GetTarget()->GetAura(inoculateId))
currStack = inoculate->GetStackAmount();
aurApp->GetTarget()->CastSpell(aurApp->GetTarget(), SPELL_INOCULATED, true);
GetTarget()->CastSpell(GetTarget(), SPELL_INOCULATED, true);
++currStack;
GetCaster()->ToCreature()->AI()->SetData(DATA_INOCULATED_STACK, currStack);
}
@@ -766,7 +766,7 @@ class spell_deathwhisper_mana_barrier : public SpellScriptLoader
{
PrepareAuraScript(spell_deathwhisper_mana_barrier_AuraScript);
void HandlePeriodicTick(AuraEffect const* /*aurEff*/, AuraApplication const* /*aurApp*/)
void HandlePeriodicTick(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
Unit* caster = GetCaster();
@@ -755,9 +755,9 @@ class spell_putricide_gaseous_bloat : public SpellScriptLoader
{
PrepareAuraScript(spell_putricide_gaseous_bloat_AuraScript);
void HandleExtraEffect(AuraEffect const* /*aurEff*/, AuraApplication const* aurApp)
void HandleExtraEffect(AuraEffect const* /*aurEff*/)
{
aurApp->GetTarget()->RemoveAuraFromStack(GetSpellProto()->Id, aurApp->GetBase()->GetCasterGUID());
GetTarget()->RemoveAuraFromStack(GetSpellProto()->Id, GetCasterGUID());
}
void Register()
@@ -837,10 +837,10 @@ class spell_putricide_slime_puddle : public SpellScriptLoader
{
PrepareAuraScript(spell_putricide_slime_puddle_AuraScript);
void HandleTriggerSpell(AuraEffect const* aurEff, AuraApplication const* aurApp)
void HandleTriggerSpell(AuraEffect const* aurEff)
{
PreventDefaultAction();
if (Unit* caster = aurApp->GetBase()->GetCaster())
if (Unit* caster = GetCaster())
{
int32 radiusMod = 4;
if (Aura* size = caster->GetAura(70347))
@@ -916,15 +916,15 @@ class spell_putricide_ooze_summon : public SpellScriptLoader
{
PrepareAuraScript(spell_putricide_ooze_summon_AuraScript);
void HandleTriggerSpell(AuraEffect const* aurEff, AuraApplication const* aurApp)
void HandleTriggerSpell(AuraEffect const* aurEff)
{
PreventDefaultAction();
if (Unit* caster = GetCaster())
{
uint32 triggerSpellId = GetSpellProto()->EffectTriggerSpell[aurEff->GetEffIndex()];
float x, y, z;
aurApp->GetTarget()->GetPosition(x, y, z);
z = aurApp->GetTarget()->GetMap()->GetHeight(x, y, z, true, 25.0f);
GetTarget()->GetPosition(x, y, z);
z = GetTarget()->GetMap()->GetHeight(x, y, z, true, 25.0f);
x += 10.0f * cosf(caster->GetOrientation());
y += 10.0f * sinf(caster->GetOrientation());
caster->CastSpell(x, y, z, triggerSpellId, true, NULL, NULL, GetCasterGUID(), caster);
@@ -1116,7 +1116,7 @@ class spell_putricide_mutated_plague : public SpellScriptLoader
{
PrepareAuraScript(spell_putricide_mutated_plague_AuraScript);
void HandleTriggerSpell(AuraEffect const* aurEff, AuraApplication const* aurApp)
void HandleTriggerSpell(AuraEffect const* aurEff)
{
PreventDefaultAction();
Unit* caster = GetCaster();
@@ -1129,21 +1129,21 @@ class spell_putricide_mutated_plague : public SpellScriptLoader
int32 damage = SpellMgr::CalculateSpellEffectAmount(spell, 0, caster);
float multiplier = 2.0f;
if (aurApp->GetTarget()->GetMap()->GetSpawnMode() & 1)
if (GetTarget()->GetMap()->GetSpawnMode() & 1)
multiplier = 3.0f;
damage *= int32(pow(multiplier, aurApp->GetBase()->GetStackAmount()));
damage *= int32(pow(multiplier, GetStackAmount()));
damage = int32(damage * 1.5f);
aurApp->GetTarget()->CastCustomSpell(triggerSpell, SPELLVALUE_BASE_POINT0, damage, aurApp->GetTarget(), true, NULL, aurEff, GetCasterGUID());
GetTarget()->CastCustomSpell(triggerSpell, SPELLVALUE_BASE_POINT0, damage, GetTarget(), true, NULL, aurEff, GetCasterGUID());
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraApplication const* aurApp, AuraEffectHandleModes /*mode*/)
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_STACK)
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_STACK)
return;
uint32 healSpell = uint32(SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), 0));
aurApp->GetTarget()->CastSpell(aurApp->GetTarget(), healSpell, true, NULL, NULL, GetCasterGUID());
GetTarget()->CastSpell(GetTarget(), healSpell, true, NULL, NULL, GetCasterGUID());
}
void Register()
@@ -1168,13 +1168,13 @@ class spell_putricide_mutation_init : public SpellScriptLoader
{
PrepareAuraScript(spell_putricide_mutation_init_AuraScript);
void OnRemove(AuraEffect const* /*aurEff*/, AuraApplication const* aurApp, AuraEffectHandleModes /*mode*/)
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
uint32 spellId = 70311;
if (aurApp->GetTarget()->GetMap()->GetSpawnMode() & 1)
if (GetTarget()->GetMap()->GetSpawnMode() & 1)
spellId = 71503;
aurApp->GetTarget()->CastSpell(aurApp->GetTarget(), spellId, true);
GetTarget()->CastSpell(GetTarget(), spellId, true);
}
void Register()
@@ -1198,9 +1198,9 @@ class spell_putricide_mutated_transformation_dismiss : public SpellScriptLoader
{
PrepareAuraScript(spell_putricide_mutated_transformation_dismiss_AuraScript);
void OnRemove(AuraEffect const* /*aurEff*/, AuraApplication const* aurApp, AuraEffectHandleModes /*mode*/)
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Vehicle* veh = aurApp->GetTarget()->GetVehicleKit())
if (Vehicle* veh = GetTarget()->GetVehicleKit())
veh->RemoveAllPassengers();
}
@@ -708,10 +708,10 @@ class spell_rotface_unstable_ooze_explosion_suicide : public SpellScriptLoader
{
PrepareAuraScript(spell_rotface_unstable_ooze_explosion_suicide_AuraScript);
void DespawnSelf(AuraEffect const* /*aurEff*/, AuraApplication const* aurApp)
void DespawnSelf(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
Unit* target = aurApp->GetTarget();
Unit* target = GetTarget();
if (target->GetTypeId() != TYPEID_UNIT)
return;
@@ -443,13 +443,13 @@ class spell_ignis_slag_pot : public SpellScriptLoader
return true;
}
void HandleEffectPeriodic(AuraEffect const * aurEff, AuraApplication const * aurApp)
void HandleEffectPeriodic(AuraEffect const * aurEff)
{
Unit* aurEffCaster = aurEff->GetCaster();
if (!aurEffCaster)
return;
Unit * target = aurApp->GetTarget();
Unit * target = GetTarget();
aurEffCaster->CastSpell(target, SPELL_SLAG_POT_DAMAGE, true);
if (target->isAlive() && !GetDuration())
target->CastSpell(target, SPELL_SLAG_IMBUED, true);