From 1759a7cf5cc7ca5bdcd6c28041ab46a2b143e5d3 Mon Sep 17 00:00:00 2001 From: megamage Date: Sun, 21 Dec 2008 14:01:26 -0600 Subject: *Fix abolish poison. (Set caster be taget when range = 0 and target type = single target) --HG-- branch : trunk --- src/game/Unit.cpp | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'src/game/Unit.cpp') diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index a4a08bb40f1..48cda18893d 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -894,15 +894,28 @@ void Unit::CastSpell(Unit* Victim,SpellEntry const *spellInfo, bool triggered, I SpellCastTargets targets; uint32 targetMask = spellInfo->Targets; - targets.setUnitTarget(Victim); - /*if(targetMask & (TARGET_FLAG_UNIT|TARGET_FLAG_UNK2)) + //if(targetMask & (TARGET_FLAG_UNIT|TARGET_FLAG_UNK2)) + for(int i = 0; i < 3; ++i) { - if(!Victim) + if(spellmgr.SpellTargetType[spellInfo->EffectImplicitTargetA[i]] == TARGET_TYPE_UNIT_TARGET) { - sLog.outError("CastSpell: spell id %i by caster: %s %u) does not have unit target", spellInfo->Id,(GetTypeId()==TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"),(GetTypeId()==TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); - return; + SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex); + if(srange && GetSpellMaxRange(srange) == 0.0f) + { + Victim = this; + break; + } + else if(!Victim) + { + sLog.outError("CastSpell: spell id %i by caster: %s %u) does not have unit target", spellInfo->Id,(GetTypeId()==TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"),(GetTypeId()==TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); + return; + } + else + break; } - }*/ + } + targets.setUnitTarget(Victim); + if(targetMask & (TARGET_FLAG_SOURCE_LOCATION|TARGET_FLAG_DEST_LOCATION)) { if(!Victim) -- cgit v1.2.3