Core/SpellScripts: rename GetTarget*() functions to GetExplTarget*(), so the names reflect better what those functions do. Also update some comments.

This commit is contained in:
QAston
2012-04-28 14:55:14 +02:00
parent 4b5e763d21
commit b899f5fc94
22 changed files with 68 additions and 55 deletions
@@ -769,7 +769,7 @@ class spell_powering_up : public SpellScriptLoader
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetTargetUnit())
if (Unit* target = GetExplTargetUnit())
if (urand(0, 99) < 15)
target->CastSpell(target, spellId, true);
}
@@ -1497,10 +1497,10 @@ class spell_valanar_kinetic_bomb : public SpellScriptLoader
void ChangeSummonPos(SpellEffIndex /*effIndex*/)
{
WorldLocation summonPos = *GetTargetDest();
WorldLocation summonPos = *GetExplTargetDest();
Position offset = {0.0f, 0.0f, 20.0f, 0.0f};
summonPos.RelocateOffset(offset);
SetTargetDest(summonPos);
SetExplTargetDest(summonPos);
GetHitDest()->RelocateOffset(offset);
}
@@ -522,7 +522,7 @@ class spell_blood_queen_vampiric_bite : public SpellScriptLoader
SpellCastResult CheckTarget()
{
if (IsVampire(GetTargetUnit()))
if (IsVampire(GetExplTargetUnit()))
{
SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_CANT_TARGET_VAMPIRES);
return SPELL_FAILED_CUSTOM_ERROR;
@@ -1280,11 +1280,11 @@ class spell_putricide_mutation_init : public SpellScriptLoader
SpellCastResult CheckRequirementInternal(SpellCustomErrors& extendedError)
{
InstanceScript* instance = GetTargetUnit()->GetInstanceScript();
InstanceScript* instance = GetExplTargetUnit()->GetInstanceScript();
if (!instance)
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW;
Creature* professor = ObjectAccessor::GetCreature(*GetTargetUnit(), instance->GetData64(DATA_PROFESSOR_PUTRICIDE));
Creature* professor = ObjectAccessor::GetCreature(*GetExplTargetUnit(), instance->GetData64(DATA_PROFESSOR_PUTRICIDE));
if (!professor)
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW;
@@ -1305,17 +1305,17 @@ class spell_putricide_mutation_init : public SpellScriptLoader
SpellCastResult CheckRequirement()
{
if (!GetTargetUnit())
if (!GetExplTargetUnit())
return SPELL_FAILED_BAD_TARGETS;
if (GetTargetUnit()->GetTypeId() != TYPEID_PLAYER)
if (GetExplTargetUnit()->GetTypeId() != TYPEID_PLAYER)
return SPELL_FAILED_TARGET_NOT_PLAYER;
SpellCustomErrors extension = SPELL_CUSTOM_ERROR_NONE;
SpellCastResult result = CheckRequirementInternal(extension);
if (result != SPELL_CAST_OK)
{
Spell::SendCastResult(GetTargetUnit()->ToPlayer(), GetSpellInfo(), 0, result, extension);
Spell::SendCastResult(GetExplTargetUnit()->ToPlayer(), GetSpellInfo(), 0, result, extension);
return result;
}
@@ -716,13 +716,13 @@ class spell_rotface_unstable_ooze_explosion : public SpellScriptLoader
void CheckTarget(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(EFFECT_0);
if (!GetTargetDest())
if (!GetExplTargetDest())
return;
uint32 triggered_spell_id = GetSpellInfo()->Effects[effIndex].TriggerSpell;
float x, y, z;
GetTargetDest()->GetPosition(x, y, z);
GetExplTargetDest()->GetPosition(x, y, z);
// let Rotface handle the cast - caster dies before this executes
if (InstanceScript* script = GetCaster()->GetInstanceScript())
if (Creature* rotface = script->instance->GetCreature(script->GetData64(DATA_ROTFACE)))
@@ -1344,7 +1344,7 @@ class spell_rimefang_icy_blast : public SpellScriptLoader
void HandleTriggerMissile(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (Position const* pos = GetTargetDest())
if (Position const* pos = GetExplTargetDest())
if (TempSummon* summon = GetCaster()->SummonCreature(NPC_ICY_BLAST, *pos, TEMPSUMMON_TIMED_DESPAWN, 40000))
summon->CastSpell(summon, SPELL_ICY_BLAST_AREA, true);
}
@@ -2470,7 +2470,7 @@ class spell_the_lich_king_summon_into_air : public SpellScriptLoader
void ModDestHeight(SpellEffIndex effIndex)
{
static Position const offset = {0.0f, 0.0f, 15.0f, 0.0f};
WorldLocation* dest = const_cast<WorldLocation*>(GetTargetDest());
WorldLocation* dest = const_cast<WorldLocation*>(GetExplTargetDest());
dest->RelocateOffset(offset);
// spirit bombs get higher
if (GetSpellInfo()->Effects[effIndex].MiscValue == NPC_SPIRIT_BOMB)
@@ -2727,7 +2727,7 @@ class spell_the_lich_king_vile_spirits_visual : public SpellScriptLoader
void ModDestHeight(SpellEffIndex /*effIndex*/)
{
Position offset = {0.0f, 0.0f, 15.0f, 0.0f};
const_cast<WorldLocation*>(GetTargetDest())->RelocateOffset(offset);
const_cast<WorldLocation*>(GetExplTargetDest())->RelocateOffset(offset);
}
void Register()
@@ -1267,7 +1267,7 @@ class spell_algalon_cosmic_smash : public SpellScriptLoader
void ModDestHeight(SpellEffIndex /*effIndex*/)
{
Position offset = {0.0f, 0.0f, 65.0f, 0.0f};
const_cast<WorldLocation*>(GetTargetDest())->RelocateOffset(offset);
const_cast<WorldLocation*>(GetExplTargetDest())->RelocateOffset(offset);
GetHitDest()->RelocateOffset(offset);
}
@@ -1294,10 +1294,10 @@ class spell_algalon_cosmic_smash_damage : public SpellScriptLoader
void RecalculateDamage()
{
if (!GetTargetDest() || !GetHitUnit())
if (!GetExplTargetDest() || !GetHitUnit())
return;
float distance = GetHitUnit()->GetDistance2d(GetTargetDest()->GetPositionX(), GetTargetDest()->GetPositionY());
float distance = GetHitUnit()->GetDistance2d(GetExplTargetDest()->GetPositionX(), GetExplTargetDest()->GetPositionY());
if (distance > 6.0f)
SetHitDamage(int32(float(GetHitDamage()) / distance) * 2);
}
@@ -1743,7 +1743,7 @@ class spell_vehicle_throw_passenger : public SpellScriptLoader
{
// use 99 because it is 3d search
std::list<WorldObject*> targetList;
Trinity::WorldObjectSpellAreaTargetCheck check(99, GetTargetDest(), GetCaster(), GetCaster(), GetSpellInfo(), TARGET_CHECK_DEFAULT, NULL);
Trinity::WorldObjectSpellAreaTargetCheck check(99, GetExplTargetDest(), GetCaster(), GetCaster(), GetSpellInfo(), TARGET_CHECK_DEFAULT, NULL);
Trinity::WorldObjectListSearcher<Trinity::WorldObjectSpellAreaTargetCheck> searcher(GetCaster(), targetList, check);
GetCaster()->GetMap()->VisitAll(GetCaster()->m_positionX, GetCaster()->m_positionY, 99, searcher);
float minDist = 99 * 99;
@@ -1006,7 +1006,7 @@ class spell_razorscale_devouring_flame : public SpellScriptLoader
PreventHitDefaultEffect(effIndex);
Unit* caster = GetCaster();
uint32 entry = uint32(GetSpellInfo()->Effects[effIndex].MiscValue);
WorldLocation const* summonLocation = GetTargetDest();
WorldLocation const* summonLocation = GetExplTargetDest();
if (!caster || !summonLocation)
return;