Merge branch 'master' into 320

This commit is contained in:
VladimirMangos 2009-09-10 05:46:08 +04:00
commit 7974e1ebcb
55 changed files with 2899 additions and 2780 deletions

View file

@ -519,6 +519,38 @@ void Spell::FillTargetMap()
switch(m_spellInfo->EffectImplicitTargetB[i])
{
case 0:
SetTargetMap(i, TARGET_EFFECT_SELECT, tmpUnitMap);
break;
default:
SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap);
break;
}
break;
case TARGET_EFFECT_SELECT:
switch(m_spellInfo->EffectImplicitTargetB[i])
{
case 0:
case TARGET_EFFECT_SELECT:
SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap);
break;
case TARGET_INNKEEPER_COORDINATES:
case TARGET_TABLE_X_Y_Z_COORDINATES:
case TARGET_CASTER_COORDINATES:
case TARGET_SCRIPT_COORDINATES:
case TARGET_CURRENT_ENEMY_COORDINATES:
case TARGET_DUELVSPLAYER_COORDINATES:
case TARGET_DYNAMIC_OBJECT_COORDINATES:
case TARGET_POINT_AT_NORTH:
case TARGET_POINT_AT_SOUTH:
case TARGET_POINT_AT_EAST:
case TARGET_POINT_AT_WEST:
case TARGET_POINT_AT_NE:
case TARGET_POINT_AT_NW:
case TARGET_POINT_AT_SE:
case TARGET_POINT_AT_SW:
// need some target for proccesing
SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap);
SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap);
break;
default:
SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap);
@ -529,6 +561,7 @@ void Spell::FillTargetMap()
switch(m_spellInfo->EffectImplicitTargetB[i])
{
case 0:
case TARGET_EFFECT_SELECT:
SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap);
break;
case TARGET_AREAEFFECT_INSTANT: // use B case that not dependent from from A in fact
@ -546,18 +579,29 @@ void Spell::FillTargetMap()
}
break;
case TARGET_CASTER_COORDINATES:
// Note: this hack with search required until GO casting not implemented
// environment damage spells already have around enemies targeting but this not help in case not existed GO casting support
// currently each enemy selected explicitly and self cast damage
if(m_spellInfo->EffectImplicitTargetB[i] == TARGET_ALL_ENEMY_IN_AREA && m_spellInfo->Effect[i] == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE)
switch(m_spellInfo->EffectImplicitTargetB[i])
{
if(m_targets.getUnitTarget())
tmpUnitMap.push_back(m_targets.getUnitTarget());
}
else
{
SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap);
SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap);
case TARGET_ALL_ENEMY_IN_AREA:
// Note: this hack with search required until GO casting not implemented
// environment damage spells already have around enemies targeting but this not help in case not existed GO casting support
// currently each enemy selected explicitly and self cast damage
if (m_spellInfo->Effect[i] == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE)
{
if(m_targets.getUnitTarget())
tmpUnitMap.push_back(m_targets.getUnitTarget());
}
else
{
SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap);
SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap);
}
break;
default:
{
SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap);
SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap);
}
break;
}
break;
case TARGET_TABLE_X_Y_Z_COORDINATES:
@ -567,10 +611,7 @@ void Spell::FillTargetMap()
SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap);
// need some target for proccesing
if(m_targets.getUnitTarget())
tmpUnitMap.push_back(m_targets.getUnitTarget());
else
tmpUnitMap.push_back(m_caster);
SetTargetMap(i, TARGET_EFFECT_SELECT, tmpUnitMap);
break;
case TARGET_AREAEFFECT_INSTANT: // All 17/7 pairs used for dest teleportation, A processed in effect code
SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap);
@ -585,6 +626,7 @@ void Spell::FillTargetMap()
switch(m_spellInfo->EffectImplicitTargetB[i])
{
case 0:
case TARGET_EFFECT_SELECT:
SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap);
break;
case TARGET_SCRIPT_COORDINATES: // B case filled in CheckCast but we need fill unit list base at A case
@ -598,165 +640,6 @@ void Spell::FillTargetMap()
break;
}
if( (m_spellInfo->EffectImplicitTargetA[i] == 0 || m_spellInfo->EffectImplicitTargetA[i] == TARGET_EFFECT_SELECT) &&
(m_spellInfo->EffectImplicitTargetB[i] == 0 || m_spellInfo->EffectImplicitTargetB[i] == TARGET_EFFECT_SELECT) )
{
// add here custom effects that need default target.
// FOR EVERY TARGET TYPE THERE IS A DIFFERENT FILL!!
switch(m_spellInfo->Effect[i])
{
case SPELL_EFFECT_DUMMY:
{
switch(m_spellInfo->Id)
{
case 20577: // Cannibalize
{
WorldObject* result = FindCorpseUsing<MaNGOS::CannibalizeObjectCheck> ();
if(result)
{
switch(result->GetTypeId())
{
case TYPEID_UNIT:
case TYPEID_PLAYER:
tmpUnitMap.push_back((Unit*)result);
break;
case TYPEID_CORPSE:
m_targets.setCorpseTarget((Corpse*)result);
if(Player* owner = ObjectAccessor::FindPlayer(((Corpse*)result)->GetOwnerGUID()))
tmpUnitMap.push_back(owner);
break;
}
}
else
{
// clear cooldown at fail
if(m_caster->GetTypeId() == TYPEID_PLAYER)
((Player*)m_caster)->RemoveSpellCooldown(m_spellInfo->Id, true);
SendCastResult(SPELL_FAILED_NO_EDIBLE_CORPSES);
finish(false);
}
break;
}
default:
if(m_targets.getUnitTarget())
tmpUnitMap.push_back(m_targets.getUnitTarget());
break;
}
break;
}
case SPELL_EFFECT_RESURRECT:
case SPELL_EFFECT_PARRY:
case SPELL_EFFECT_BLOCK:
case SPELL_EFFECT_CREATE_ITEM:
case SPELL_EFFECT_TRIGGER_SPELL:
case SPELL_EFFECT_TRIGGER_MISSILE:
case SPELL_EFFECT_LEARN_SPELL:
case SPELL_EFFECT_SKILL_STEP:
case SPELL_EFFECT_PROFICIENCY:
case SPELL_EFFECT_SUMMON_OBJECT_WILD:
case SPELL_EFFECT_SELF_RESURRECT:
case SPELL_EFFECT_REPUTATION:
case SPELL_EFFECT_SEND_TAXI:
if(m_targets.getUnitTarget())
tmpUnitMap.push_back(m_targets.getUnitTarget());
// Triggered spells have additional spell targets - cast them even if no explicit unit target is given (required for spell 50516 for example)
else if(m_spellInfo->Effect[i] == SPELL_EFFECT_TRIGGER_SPELL)
tmpUnitMap.push_back(m_caster);
break;
case SPELL_EFFECT_SUMMON_PLAYER:
if(m_caster->GetTypeId()==TYPEID_PLAYER && ((Player*)m_caster)->GetSelection())
{
Player* target = objmgr.GetPlayer(((Player*)m_caster)->GetSelection());
if(target)
tmpUnitMap.push_back(target);
}
break;
case SPELL_EFFECT_RESURRECT_NEW:
if(m_targets.getUnitTarget())
tmpUnitMap.push_back(m_targets.getUnitTarget());
if(m_targets.getCorpseTargetGUID())
{
Corpse *corpse = ObjectAccessor::GetCorpse(*m_caster, m_targets.getCorpseTargetGUID());
if(corpse)
{
Player* owner = ObjectAccessor::FindPlayer(corpse->GetOwnerGUID());
if(owner)
tmpUnitMap.push_back(owner);
}
}
break;
case SPELL_EFFECT_SUMMON:
if(m_spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED || m_spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED2)
{
if(m_targets.getUnitTarget())
tmpUnitMap.push_back(m_targets.getUnitTarget());
}
else
tmpUnitMap.push_back(m_caster);
break;
case SPELL_EFFECT_SUMMON_CHANGE_ITEM:
case SPELL_EFFECT_TRANS_DOOR:
case SPELL_EFFECT_ADD_FARSIGHT:
case SPELL_EFFECT_APPLY_GLYPH:
case SPELL_EFFECT_STUCK:
case SPELL_EFFECT_FEED_PET:
case SPELL_EFFECT_DESTROY_ALL_TOTEMS:
case SPELL_EFFECT_SKILL:
tmpUnitMap.push_back(m_caster);
break;
case SPELL_EFFECT_LEARN_PET_SPELL:
if(Pet* pet = m_caster->GetPet())
tmpUnitMap.push_back(pet);
break;
case SPELL_EFFECT_ENCHANT_ITEM:
case SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY:
case SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC:
case SPELL_EFFECT_DISENCHANT:
case SPELL_EFFECT_PROSPECTING:
case SPELL_EFFECT_MILLING:
if(m_targets.getItemTarget())
AddItemTarget(m_targets.getItemTarget(), i);
break;
case SPELL_EFFECT_APPLY_AURA:
switch(m_spellInfo->EffectApplyAuraName[i])
{
case SPELL_AURA_ADD_FLAT_MODIFIER: // some spell mods auras have 0 target modes instead expected TARGET_SELF(1) (and present for other ranks for same spell for example)
case SPELL_AURA_ADD_PCT_MODIFIER:
tmpUnitMap.push_back(m_caster);
break;
default: // apply to target in other case
if(m_targets.getUnitTarget())
tmpUnitMap.push_back(m_targets.getUnitTarget());
break;
}
break;
case SPELL_EFFECT_APPLY_AREA_AURA_PARTY:
// AreaAura
if(m_spellInfo->Attributes == 0x9050000 || m_spellInfo->Attributes == 0x10000)
SetTargetMap(i,TARGET_AREAEFFECT_PARTY, tmpUnitMap);
break;
case SPELL_EFFECT_SKIN_PLAYER_CORPSE:
if(m_targets.getUnitTarget())
{
tmpUnitMap.push_back(m_targets.getUnitTarget());
}
else if (m_targets.getCorpseTargetGUID())
{
Corpse *corpse = ObjectAccessor::GetCorpse(*m_caster,m_targets.getCorpseTargetGUID());
if(corpse)
{
Player* owner = ObjectAccessor::FindPlayer(corpse->GetOwnerGUID());
if(owner)
tmpUnitMap.push_back(owner);
}
}
break;
default:
break;
}
}
if(m_caster->GetTypeId() == TYPEID_PLAYER)
{
Player *me = (Player*)m_caster;
@ -1405,11 +1288,11 @@ struct TargetDistanceOrder : public std::binary_function<const Unit, const Unit,
}
};
void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
{
float radius;
if (m_spellInfo->EffectRadiusIndex[i])
radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i]));
if (m_spellInfo->EffectRadiusIndex[effIndex])
radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[effIndex]));
else
radius = GetSpellMaxRange(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex));
@ -1417,7 +1300,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
if(Player* modOwner = m_originalCaster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RADIUS, radius, this);
uint32 EffectChainTarget = m_spellInfo->EffectChainTarget[i];
uint32 EffectChainTarget = m_spellInfo->EffectChainTarget[effIndex];
if(m_originalCaster)
if(Player* modOwner = m_originalCaster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_JUMP_TARGETS, EffectChainTarget, this);
@ -1445,7 +1328,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
unMaxTargets+=(*m)->GetModifier()->m_amount;
}
switch(cur)
switch(targetMode)
{
case TARGET_TOTEM_EARTH:
case TARGET_TOTEM_WATER:
@ -1688,7 +1571,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
{
SpellTargets targetB = SPELL_TARGETS_AOE_DAMAGE;
// Select friendly targets for positive effect
if (IsPositiveEffect(m_spellInfo->Id, i))
if (IsPositiveEffect(m_spellInfo->Id, effIndex))
targetB = SPELL_TARGETS_FRIENDLY;
FillAreaTargets(TagUnitMap,m_caster->GetPositionX(), m_caster->GetPositionY(),radius, PUSH_DEST_CENTER, targetB);
@ -1700,7 +1583,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
case TARGET_ALL_ENEMY_IN_AREA_INSTANT:
{
// targets the ground, not the units in the area
switch(m_spellInfo->Effect[i])
switch(m_spellInfo->Effect[effIndex])
{
case SPELL_EFFECT_PERSISTENT_AREA_AURA:
break;
@ -1842,7 +1725,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
}
case TARGET_GAMEOBJECT:
if(m_targets.getGOTarget())
AddGOTarget(m_targets.getGOTarget(), i);
AddGOTarget(m_targets.getGOTarget(), effIndex);
break;
case TARGET_IN_FRONT_OF_CASTER:
{
@ -1875,9 +1758,9 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
}
case TARGET_GAMEOBJECT_ITEM:
if(m_targets.getGOTargetGUID())
AddGOTarget(m_targets.getGOTarget(), i);
AddGOTarget(m_targets.getGOTarget(), effIndex);
else if(m_targets.getItemTarget())
AddItemTarget(m_targets.getItemTarget(), i);
AddItemTarget(m_targets.getItemTarget(), effIndex);
break;
case TARGET_MASTER:
if(Unit* owner = m_caster->GetCharmerOrOwner())
@ -1885,11 +1768,11 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
break;
case TARGET_ALL_ENEMY_IN_AREA_CHANNELED:
// targets the ground, not the units in the area
if (m_spellInfo->Effect[i]!=SPELL_EFFECT_PERSISTENT_AREA_AURA)
if (m_spellInfo->Effect[effIndex]!=SPELL_EFFECT_PERSISTENT_AREA_AURA)
FillAreaTargets(TagUnitMap, m_targets.m_destX, m_targets.m_destY, radius, PUSH_DEST_CENTER, SPELL_TARGETS_AOE_DAMAGE);
break;
case TARGET_MINION:
if(m_spellInfo->Effect[i] != SPELL_EFFECT_DUEL)
if(m_spellInfo->Effect[effIndex] != SPELL_EFFECT_DUEL)
TagUnitMap.push_back(m_caster);
break;
case TARGET_SINGLE_ENEMY:
@ -1972,7 +1855,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
if(m_targets.getUnitTarget())
TagUnitMap.push_back(m_targets.getUnitTarget());
if(m_targets.getItemTarget())
AddItemTarget(m_targets.getItemTarget(), i);
AddItemTarget(m_targets.getItemTarget(), effIndex);
break;
}
case TARGET_SELF_FISHING:
@ -2046,7 +1929,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
{
TagUnitMap.push_back(currentTarget);
m_targets.setDestination(currentTarget->GetPositionX(), currentTarget->GetPositionY(), currentTarget->GetPositionZ());
if(m_spellInfo->EffectImplicitTargetB[i]==TARGET_ALL_ENEMY_IN_AREA_INSTANT)
if(m_spellInfo->EffectImplicitTargetB[effIndex]==TARGET_ALL_ENEMY_IN_AREA_INSTANT)
FillAreaTargets(TagUnitMap, currentTarget->GetPositionX(), currentTarget->GetPositionY(), radius, PUSH_TARGET_CENTER, SPELL_TARGETS_AOE_DAMAGE);
}
break;
@ -2135,7 +2018,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
Unit* currentTarget = m_targets.getUnitTarget() ? m_targets.getUnitTarget() : m_caster;
float angle = currentTarget != m_caster ? currentTarget->GetAngle(m_caster) : m_caster->GetOrientation();
switch(cur)
switch(targetMode)
{
case TARGET_POINT_AT_NORTH: break;
case TARGET_POINT_AT_SOUTH: angle += M_PI; break;
@ -2170,6 +2053,159 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
TagUnitMap.push_back(m_caster);
break;
}
case TARGET_EFFECT_SELECT:
{
// add here custom effects that need default target.
// FOR EVERY TARGET TYPE THERE IS A DIFFERENT FILL!!
switch(m_spellInfo->Effect[effIndex])
{
case SPELL_EFFECT_DUMMY:
{
switch(m_spellInfo->Id)
{
case 20577: // Cannibalize
{
WorldObject* result = FindCorpseUsing<MaNGOS::CannibalizeObjectCheck> ();
if(result)
{
switch(result->GetTypeId())
{
case TYPEID_UNIT:
case TYPEID_PLAYER:
TagUnitMap.push_back((Unit*)result);
break;
case TYPEID_CORPSE:
m_targets.setCorpseTarget((Corpse*)result);
if (Player* owner = ObjectAccessor::FindPlayer(((Corpse*)result)->GetOwnerGUID()))
TagUnitMap.push_back(owner);
break;
}
}
else
{
// clear cooldown at fail
if (m_caster->GetTypeId() == TYPEID_PLAYER)
((Player*)m_caster)->RemoveSpellCooldown(m_spellInfo->Id, true);
SendCastResult(SPELL_FAILED_NO_EDIBLE_CORPSES);
finish(false);
}
break;
}
default:
if (m_targets.getUnitTarget())
TagUnitMap.push_back(m_targets.getUnitTarget());
break;
}
break;
}
case SPELL_EFFECT_RESURRECT:
case SPELL_EFFECT_PARRY:
case SPELL_EFFECT_BLOCK:
case SPELL_EFFECT_CREATE_ITEM:
case SPELL_EFFECT_TRIGGER_SPELL:
case SPELL_EFFECT_TRIGGER_MISSILE:
case SPELL_EFFECT_LEARN_SPELL:
case SPELL_EFFECT_SKILL_STEP:
case SPELL_EFFECT_PROFICIENCY:
case SPELL_EFFECT_SUMMON_OBJECT_WILD:
case SPELL_EFFECT_SELF_RESURRECT:
case SPELL_EFFECT_REPUTATION:
case SPELL_EFFECT_SEND_TAXI:
if (m_targets.getUnitTarget())
TagUnitMap.push_back(m_targets.getUnitTarget());
// Triggered spells have additional spell targets - cast them even if no explicit unit target is given (required for spell 50516 for example)
else if (m_spellInfo->Effect[effIndex] == SPELL_EFFECT_TRIGGER_SPELL)
TagUnitMap.push_back(m_caster);
break;
case SPELL_EFFECT_SUMMON_PLAYER:
if (m_caster->GetTypeId()==TYPEID_PLAYER && ((Player*)m_caster)->GetSelection())
{
Player* target = objmgr.GetPlayer(((Player*)m_caster)->GetSelection());
if(target)
TagUnitMap.push_back(target);
}
break;
case SPELL_EFFECT_RESURRECT_NEW:
if (m_targets.getUnitTarget())
TagUnitMap.push_back(m_targets.getUnitTarget());
if (m_targets.getCorpseTargetGUID())
{
Corpse *corpse = ObjectAccessor::GetCorpse(*m_caster, m_targets.getCorpseTargetGUID());
if(corpse)
{
Player* owner = ObjectAccessor::FindPlayer(corpse->GetOwnerGUID());
if(owner)
TagUnitMap.push_back(owner);
}
}
break;
case SPELL_EFFECT_SUMMON:
if (m_spellInfo->EffectMiscValueB[effIndex] == SUMMON_TYPE_POSESSED ||
m_spellInfo->EffectMiscValueB[effIndex] == SUMMON_TYPE_POSESSED2)
{
if (m_targets.getUnitTarget())
TagUnitMap.push_back(m_targets.getUnitTarget());
}
else
TagUnitMap.push_back(m_caster);
break;
case SPELL_EFFECT_SUMMON_CHANGE_ITEM:
case SPELL_EFFECT_TRANS_DOOR:
case SPELL_EFFECT_ADD_FARSIGHT:
case SPELL_EFFECT_APPLY_GLYPH:
case SPELL_EFFECT_STUCK:
case SPELL_EFFECT_FEED_PET:
case SPELL_EFFECT_DESTROY_ALL_TOTEMS:
case SPELL_EFFECT_SKILL:
TagUnitMap.push_back(m_caster);
break;
case SPELL_EFFECT_LEARN_PET_SPELL:
if (Pet* pet = m_caster->GetPet())
TagUnitMap.push_back(pet);
break;
case SPELL_EFFECT_ENCHANT_ITEM:
case SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY:
case SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC:
case SPELL_EFFECT_DISENCHANT:
case SPELL_EFFECT_PROSPECTING:
case SPELL_EFFECT_MILLING:
if (m_targets.getItemTarget())
AddItemTarget(m_targets.getItemTarget(), effIndex);
break;
case SPELL_EFFECT_APPLY_AURA:
switch(m_spellInfo->EffectApplyAuraName[effIndex])
{
case SPELL_AURA_ADD_FLAT_MODIFIER: // some spell mods auras have 0 target modes instead expected TARGET_SELF(1) (and present for other ranks for same spell for example)
case SPELL_AURA_ADD_PCT_MODIFIER:
TagUnitMap.push_back(m_caster);
break;
default: // apply to target in other case
if (m_targets.getUnitTarget())
TagUnitMap.push_back(m_targets.getUnitTarget());
break;
}
break;
case SPELL_EFFECT_APPLY_AREA_AURA_PARTY:
// AreaAura
if(m_spellInfo->Attributes == 0x9050000 || m_spellInfo->Attributes == 0x10000)
SetTargetMap(effIndex,TARGET_AREAEFFECT_PARTY, TagUnitMap);
break;
case SPELL_EFFECT_SKIN_PLAYER_CORPSE:
if (m_targets.getUnitTarget())
TagUnitMap.push_back(m_targets.getUnitTarget());
else if (m_targets.getCorpseTargetGUID())
{
if (Corpse *corpse = ObjectAccessor::GetCorpse(*m_caster,m_targets.getCorpseTargetGUID()))
if (Player* owner = ObjectAccessor::FindPlayer(corpse->GetOwnerGUID()))
TagUnitMap.push_back(owner);
}
break;
default:
break;
}
break;
}
default:
break;
}
@ -3498,7 +3534,7 @@ void Spell::TakePower()
// Set the five second timer
if (powerType == POWER_MANA && m_powerCost > 0)
m_caster->SetLastManaUse(getMSTime());
m_caster->SetLastManaUse();
}
SpellCastResult Spell::CheckRuneCost(uint32 runeCostID)
@ -4846,6 +4882,7 @@ SpellCastResult Spell::CheckCasterAuras() const
else if ( m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE)
return SPELL_FAILED_SILENCED;
break;
default: break;
}
}
}
@ -5018,6 +5055,15 @@ SpellCastResult Spell::CheckPower()
if(m_CastItem)
return SPELL_CAST_OK;
// Do precise power regen on spell cast
if (m_powerCost > 0 && m_caster->GetTypeId() == TYPEID_PLAYER)
{
Player* playerCaster = (Player*)m_caster;
uint32 diff = REGEN_TIME_FULL - m_caster->GetRegenTimer();
if (diff >= REGEN_TIME_PRECISE)
playerCaster->RegenerateAll(diff);
}
// health as power used - need check health amount
if(m_spellInfo->powerType == POWER_HEALTH)
{
@ -5967,4 +6013,4 @@ void Spell::FillRaidOrPartyHealthPriorityTargets( UnitList &TagUnitMap, Unit* me
TagUnitMap.push_back(healthQueue.top().getUnit());
healthQueue.pop();
}
}
}