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:53:40 +02:00
parent 4b5e763d21
commit b899f5fc94
22 changed files with 68 additions and 55 deletions

View File

@@ -102,7 +102,7 @@ class spell_ex_5581 : public SpellScriptLoader
{
// in this hook you can add additional requirements for spell caster (and throw a client error if reqs're not passed)
// in this case we're disallowing to select non-player as a target of the spell
//if (!GetTargetUnit() || GetTargetUnit()->ToPlayer())
//if (!GetExplTargetUnit() || GetExplTargetUnit()->ToPlayer())
//return SPELL_FAILED_BAD_TARGETS;
return SPELL_CAST_OK;
}

View File

@@ -713,7 +713,7 @@ class spell_ooze_zap : public SpellScriptLoader
if (!GetCaster()->HasAura(GetSpellInfo()->Effects[EFFECT_1].CalcValue()))
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; // This is actually correct
if (!GetTargetUnit())
if (!GetExplTargetUnit())
return SPELL_FAILED_BAD_TARGETS;
return SPELL_CAST_OK;

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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)))

View File

@@ -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);
}

View File

@@ -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()

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -775,7 +775,7 @@ class spell_dk_death_grip : public SpellScriptLoader
void HandleDummy(SpellEffIndex /*effIndex*/)
{
int32 damage = GetEffectValue();
Position const* pos = GetTargetDest();
Position const* pos = GetExplTargetDest();
if (Unit* target = GetHitUnit())
{
if (!target->HasAuraType(SPELL_AURA_DEFLECT_SPELLS)) // Deterrence

View File

@@ -237,7 +237,7 @@ class spell_dru_t10_restoration_4p_bonus : public SpellScriptLoader
}
else
{
unitList.remove(GetTargetUnit());
unitList.remove(GetExplTargetUnit());
std::list<Unit*> tempTargets;
for (std::list<Unit*>::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
if ((*itr)->GetTypeId() == TYPEID_PLAYER && GetCaster()->IsInRaidWith(*itr))
@@ -279,7 +279,7 @@ class spell_dru_starfall_aoe : public SpellScriptLoader
void FilterTargets(std::list<Unit*>& unitList)
{
unitList.remove(GetTargetUnit());
unitList.remove(GetExplTargetUnit());
}
void Register()

View File

@@ -1282,7 +1282,7 @@ class spell_gen_launch : public SpellScriptLoader
void Launch()
{
WorldLocation const* const position = GetTargetDest();
WorldLocation const* const position = GetExplTargetDest();
if (Player* player = GetHitPlayer())
{

View File

@@ -286,8 +286,8 @@ class spell_hun_masters_call : public SpellScriptLoader
target->CastSpell(target, HUNTER_SPELL_MASTERS_CALL_TRIGGERED, castMask);
// there is a possibility that this effect should access effect 0 (dummy) target, but i dubt that
// it's more likely that on on retail it's possible to call target selector based on dbc values
// anyways, we're using GetTargetUnit() here and it's ok
if (Unit* ally = GetTargetUnit())
// anyways, we're using GetExplTargetUnit() here and it's ok
if (Unit* ally = GetExplTargetUnit())
{
target->CastSpell(ally, GetEffectValue(), castMask);
target->CastSpell(ally, GetSpellInfo()->Effects[EFFECT_0].CalcValue(), castMask);

View File

@@ -288,10 +288,9 @@ class spell_pal_holy_shock : public SpellScriptLoader
SpellCastResult CheckCast()
{
Player* caster = GetCaster()->ToPlayer();
if (GetTargetUnit())
if (Unit* target = GetTargetUnit())
if (!caster->IsFriendlyTo(target) && !caster->IsValidAttackTarget(target))
return SPELL_FAILED_BAD_TARGETS;
if (Unit* target = GetExplTargetUnit())
if (!caster->IsFriendlyTo(target) && !caster->IsValidAttackTarget(target))
return SPELL_FAILED_BAD_TARGETS;
return SPELL_CAST_OK;
}

View File

@@ -227,10 +227,9 @@ class spell_pri_penance : public SpellScriptLoader
SpellCastResult CheckCast()
{
Player* caster = GetCaster()->ToPlayer();
if (GetTargetUnit())
if (Unit* target = GetTargetUnit())
if (!caster->IsFriendlyTo(target) && !caster->IsValidAttackTarget(target))
return SPELL_FAILED_BAD_TARGETS;
if (Unit* target = GetExplTargetUnit())
if (!caster->IsFriendlyTo(target) && !caster->IsValidAttackTarget(target))
return SPELL_FAILED_BAD_TARGETS;
return SPELL_CAST_OK;
}

View File

@@ -275,7 +275,7 @@ class spell_q11396_11399_scourging_crystal_controller : public SpellScriptLoader
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetTargetUnit())
if (Unit* target = GetExplTargetUnit())
if (target->GetTypeId() == TYPEID_UNIT && target->HasAura(SPELL_FORCE_SHIELD_ARCANE_PURPLE_X3))
// Make sure nobody else is channeling the same target
if (!target->HasAura(SPELL_SCOURGING_CRYSTAL_CONTROLLER))

View File

@@ -301,8 +301,8 @@ class spell_warl_seed_of_corruption : public SpellScriptLoader
void FilterTargets(std::list<Unit*>& unitList)
{
if (GetTargetUnit())
unitList.remove(GetTargetUnit());
if (GetExplTargetUnit())
unitList.remove(GetExplTargetUnit());
}
void Register()