[9079] Less strict check related to TARGET_SCRIPT_COORDINATES

Fixes and enables ~20 more summon related spells. Some minor cleanup in related code

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2009-12-29 00:41:32 +01:00
parent 15d4388696
commit 46b6723af1
2 changed files with 27 additions and 18 deletions

View file

@ -4169,7 +4169,7 @@ SpellCastResult Spell::CheckCast(bool strict)
return castResult; return castResult;
} }
//ImpliciteTargetA-B = 38, If fact there is 0 Spell with ImpliciteTargetB=38 // Database based targets from spell_target_script
if (m_UniqueTargetInfo.empty()) // skip second CheckCast apply (for delayed spells for example) if (m_UniqueTargetInfo.empty()) // skip second CheckCast apply (for delayed spells for example)
{ {
for(uint8 j = 0; j < 3; ++j) for(uint8 j = 0; j < 3; ++j)
@ -4182,6 +4182,7 @@ SpellCastResult Spell::CheckCast(bool strict)
{ {
SpellScriptTargetBounds bounds = sSpellMgr.GetSpellScriptTargetBounds(m_spellInfo->Id); SpellScriptTargetBounds bounds = sSpellMgr.GetSpellScriptTargetBounds(m_spellInfo->Id);
if (bounds.first==bounds.second) if (bounds.first==bounds.second)
sLog.outErrorDb("Spell (ID: %u) has effect EffectImplicitTargetA/EffectImplicitTargetB = TARGET_SCRIPT or TARGET_SCRIPT_COORDINATES, but does not have record in `spell_script_target`",m_spellInfo->Id); sLog.outErrorDb("Spell (ID: %u) has effect EffectImplicitTargetA/EffectImplicitTargetB = TARGET_SCRIPT or TARGET_SCRIPT_COORDINATES, but does not have record in `spell_script_target`",m_spellInfo->Id);
@ -4241,7 +4242,7 @@ SpellCastResult Spell::CheckCast(bool strict)
CellPair p(MaNGOS::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY())); CellPair p(MaNGOS::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY()));
Cell cell(p); Cell cell(p);
cell.data.Part.reserved = ALL_DISTRICT; cell.data.Part.reserved = ALL_DISTRICT;
cell.SetNoCreate(); // Really don't know what is that??? cell.SetNoCreate();
MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*m_caster,i_spellST->second.targetEntry,i_spellST->second.type!=SPELL_TARGET_TYPE_DEAD,range); MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*m_caster,i_spellST->second.targetEntry,i_spellST->second.type!=SPELL_TARGET_TYPE_DEAD,range);
MaNGOS::CreatureLastSearcher<MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(m_caster, p_Creature, u_check); MaNGOS::CreatureLastSearcher<MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(m_caster, p_Creature, u_check);
@ -4270,13 +4271,17 @@ SpellCastResult Spell::CheckCast(bool strict)
{ {
m_targets.setDestination(creatureScriptTarget->GetPositionX(),creatureScriptTarget->GetPositionY(),creatureScriptTarget->GetPositionZ()); m_targets.setDestination(creatureScriptTarget->GetPositionX(),creatureScriptTarget->GetPositionY(),creatureScriptTarget->GetPositionZ());
if(m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT_COORDINATES && m_spellInfo->EffectImplicitTargetB[j] == 0 && m_spellInfo->Effect[j]!=SPELL_EFFECT_PERSISTENT_AREA_AURA) if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT_COORDINATES && m_spellInfo->Effect[j] != SPELL_EFFECT_PERSISTENT_AREA_AURA)
AddUnitTarget(creatureScriptTarget, j); AddUnitTarget(creatureScriptTarget, j);
} }
// store explicit target for TARGET_SCRIPT // store explicit target for TARGET_SCRIPT
else else
{
if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT ||
m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT)
AddUnitTarget(creatureScriptTarget, j); AddUnitTarget(creatureScriptTarget, j);
} }
}
else if (goScriptTarget) else if (goScriptTarget)
{ {
// store coordinates for TARGET_SCRIPT_COORDINATES // store coordinates for TARGET_SCRIPT_COORDINATES
@ -4285,13 +4290,17 @@ SpellCastResult Spell::CheckCast(bool strict)
{ {
m_targets.setDestination(goScriptTarget->GetPositionX(),goScriptTarget->GetPositionY(),goScriptTarget->GetPositionZ()); m_targets.setDestination(goScriptTarget->GetPositionX(),goScriptTarget->GetPositionY(),goScriptTarget->GetPositionZ());
if(m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT_COORDINATES && m_spellInfo->EffectImplicitTargetB[j] == 0 && m_spellInfo->Effect[j]!=SPELL_EFFECT_PERSISTENT_AREA_AURA) if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT_COORDINATES && m_spellInfo->Effect[j] != SPELL_EFFECT_PERSISTENT_AREA_AURA)
AddGOTarget(goScriptTarget, j); AddGOTarget(goScriptTarget, j);
} }
// store explicit target for TARGET_SCRIPT // store explicit target for TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT
else else
{
if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT ||
m_spellInfo->EffectImplicitTargetB[j] == TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT)
AddGOTarget(goScriptTarget, j); AddGOTarget(goScriptTarget, j);
} }
}
//Missing DB Entry or targets for this spellEffect. //Missing DB Entry or targets for this spellEffect.
else else
{ {

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "9078" #define REVISION_NR "9079"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__