*Merge.
--HG-- branch : trunk
This commit is contained in:
@@ -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
@@ -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
@@ -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())
|
||||
{
|
||||
|
||||
+29
-3
@@ -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)
|
||||
((Player*)this)->UnsummonPetTemporaryIfAny();
|
||||
{
|
||||
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)
|
||||
((Player*)this)->ResummonPetTemporaryUnSummonedIfAny();
|
||||
{
|
||||
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,7 +13413,11 @@ void Unit::SetStunned(bool apply)
|
||||
{
|
||||
if(isAlive() && getVictim())
|
||||
SetUInt64Value(UNIT_FIELD_TARGET, getVictim()->GetGUID());
|
||||
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
|
||||
|
||||
// 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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user