--HG--
branch : trunk
This commit is contained in:
megamage
2009-06-01 15:26:44 -05:00
4 changed files with 60 additions and 6 deletions
+22
View File
@@ -17040,6 +17040,28 @@ void Player::AddSpellMod(SpellModifier* mod, bool apply)
}
}
// Restore spellmods in case of failed cast
void Player::RestoreSpellMods(Spell const* spell)
{
if(!spell || (m_SpellModRemoveCount == 0))
return;
for(int i=0;i<MAX_SPELLMOD;++i)
{
for (SpellModList::iterator itr = m_spellMods[i].begin(); itr != m_spellMods[i].end();++itr)
{
SpellModifier *mod = *itr;
if (mod && mod->charges == -1 && mod->lastAffected == spell)
{
mod->lastAffected = NULL;
mod->charges = 1;
m_SpellModRemoveCount--;
}
}
}
}
void Player::RemoveSpellMods(Spell const* spell)
{
if(!spell || (m_SpellModRemoveCount == 0))
+1 -1
View File
@@ -1392,6 +1392,7 @@ class TRINITY_DLL_SPEC Player : public Unit
bool IsAffectedBySpellmod(SpellEntry const *spellInfo, SpellModifier *mod, Spell const* spell = NULL);
template <class T> T ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell const* spell = NULL);
void RemoveSpellMods(Spell const* spell);
void RestoreSpellMods(Spell const* spell);
bool HasSpellCooldown(uint32 spell_id) const
{
@@ -2373,4 +2374,3 @@ template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &bas
return T(diff);
}
#endif
+8 -2
View File
@@ -2271,7 +2271,9 @@ void Spell::SetTargetMap(uint32 i, uint32 cur)
}
else
{
if (m_spellInfo->Id==57699) //Replenishment (special target selection) 10 targets with lowest mana
if(m_spellInfo->Id == 27285) // Seed of Corruption proc spell
unitList.remove(m_targets.getUnitTarget());
else if (m_spellInfo->Id==57699) //Replenishment (special target selection) 10 targets with lowest mana
{
typedef std::priority_queue<PrioritizeManaWraper, std::vector<PrioritizeManaWraper>, PrioritizeMana> TopMana;
TopMana manaUsers;
@@ -2990,9 +2992,13 @@ void Spell::finish(bool ok)
((Puppet*)charm)->UnSummon();
}
// other code related only to successfully finished spells
if(!ok)
{
//restore spell mods
if (m_caster->GetTypeId() == TYPEID_PLAYER)
((Player*)m_caster)->RestoreSpellMods(this);
return;
}
if (m_caster->GetTypeId()==TYPEID_UNIT && ((Creature*)m_caster)->isSummon())
{
+26
View File
@@ -5434,6 +5434,8 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Seed of Corruption
if (dummySpell->SpellFamilyFlags[1] & 0x00000010)
{
if(procSpell && procSpell->Id == 27285)
return false;
// if damage is more than need or target die from damage deal finish spell
if( triggeredByAura->GetAmount() <= damage || GetHealth() <= damage )
{
@@ -10000,7 +10002,19 @@ void Unit::Mount(uint32 mount)
// unsummon pet
if(GetTypeId() == TYPEID_PLAYER)
{
Pet* pet = ((Player*)this)->GetPet();
if(pet)
{
BattleGround *bg = ((Player *)this)->GetBattleGround();
// don't unsummon pet in arena but SetFlag UNIT_FLAG_STUNNED to disable pet's interface
if(bg && bg->isArena())
pet->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
else
((Player*)this)->UnsummonPetTemporaryIfAny();
}
}
}
void Unit::Unmount()
@@ -10017,7 +10031,15 @@ void Unit::Unmount()
// this prevents adding a pet to a not created map which would otherwise cause a crash
// (it could probably happen when logging in after a previous crash)
if(GetTypeId() == TYPEID_PLAYER)
{
if(Pet *pPet = ((Player*)this)->GetPet())
{
if(pPet->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED) && !pPet->hasUnitState(UNIT_STAT_STUNNED))
pPet->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
}
else
((Player*)this)->ResummonPetTemporaryUnSummonedIfAny();
}
}
void Unit::SetInCombatWith(Unit* enemy)
@@ -13391,6 +13413,10 @@ void Unit::SetStunned(bool apply)
{
if(isAlive() && getVictim())
SetUInt64Value(UNIT_FIELD_TARGET, getVictim()->GetGUID());
// don't remove UNIT_FLAG_STUNNED for pet when owner is mounted (disabled pet's interface)
Unit *pOwner = GetOwner();
if(!pOwner || (pOwner->GetTypeId() == TYPEID_PLAYER && !((Player *)pOwner)->IsMounted()))
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
if(!hasUnitState(UNIT_STAT_ROOT)) // prevent allow move if have also root effect