aboutsummaryrefslogtreecommitdiff
path: root/src/game/SpellEffects.cpp
diff options
context:
space:
mode:
authormaximius <none@none>2009-10-13 16:16:45 -0700
committermaximius <none@none>2009-10-13 16:16:45 -0700
commit8a5ac3834d120c4dc0efbb4369b859e318635fce (patch)
treed6a5314b565de2ab45bd64a35b71b05a3c3b1c42 /src/game/SpellEffects.cpp
parentf413a988621d36742cf5894460639f64edb4adf3 (diff)
*Wintersgrasp - prevents team from using vehicles to damage their own buildings, by Spp
*Wintersgrasp - restore proper faction of units in Unit::RestoreFaction(), don't just always use faction_A, by Spp --HG-- branch : trunk
Diffstat (limited to 'src/game/SpellEffects.cpp')
-rw-r--r--src/game/SpellEffects.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 56679b1abe4..465730eaab6 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -7038,7 +7038,22 @@ void Spell::EffectRedirectThreat(uint32 /*i*/)
void Spell::EffectWMODamage(uint32 /*i*/)
{
if(gameObjTarget && gameObjTarget->GetGoType() == GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING)
- gameObjTarget->TakenDamage((uint32)damage);
+ {
+ Unit *caster = m_originalCaster;
+ if(!caster)
+ return;
+
+ const GameObjectInfo *gInfo = objmgr.GetGameObjectInfo(gameObjTarget->GetEntry());
+ if (!gInfo)
+ return;
+
+ FactionTemplateEntry const *casterft, *goft;
+ casterft = caster->getFactionTemplateEntry();
+ goft = sFactionTemplateStore.LookupEntry(gInfo->faction);
+ // Do not allow to damage GO's of friendly factions (ie: Wintergrasp Walls)
+ if (casterft && goft && !casterft->IsFriendlyTo(*goft))
+ gameObjTarget->TakenDamage((uint32)damage);
+ }
}
void Spell::EffectWMORepair(uint32 /*i*/)