diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Player.cpp | 22 | ||||
-rw-r--r-- | src/game/Player.h | 2 | ||||
-rw-r--r-- | src/game/Spell.cpp | 10 | ||||
-rw-r--r-- | src/game/Unit.cpp | 32 |
4 files changed, 60 insertions, 6 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 3d86d52919f..d90183f2a0c 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -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)) diff --git a/src/game/Player.h b/src/game/Player.h index 6cf949453d3..99b2e61b58f 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -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 - diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index f0738d513d7..06a475d2df7 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -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()) { diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index cff6e0ac853..201be24a239 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -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 { |