From 39dd09532bb990f40e22cbbfd002f9b0aa24ef6f Mon Sep 17 00:00:00 2001 From: lukaasm Date: Thu, 28 May 2009 22:10:20 +0200 Subject: [PATCH 1/5] Calculate armor reduction only for attacks with SPELL_SCHOOL_MASK_NORMAL --HG-- branch : trunk --- src/game/Unit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 37cc737f81..752248d7b2 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -1367,7 +1367,7 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da // Add melee damage bonus MeleeDamageBonus(damageInfo->target, &damage, damageInfo->attackType); // Calculate armor reduction - damageInfo->damage = CalcArmorReducedDamage(damageInfo->target, damage); + damageInfo->damage = (damageInfo->damageSchoolMask & SPELL_SCHOOL_MASK_NORMAL) ? CalcArmorReducedDamage(damageInfo->target, damage) : damage; damageInfo->cleanDamage += damage - damageInfo->damage; damageInfo->hitOutCome = RollMeleeOutcomeAgainst(damageInfo->target, damageInfo->attackType); From bc55209b3e2723ef39935d6c4ff3f8b442b98f1c Mon Sep 17 00:00:00 2001 From: thenecromancer Date: Thu, 28 May 2009 23:05:52 +0200 Subject: [PATCH 2/5] Restore used spell mods if spell cast fails. --HG-- branch : trunk --- src/game/Player.cpp | 22 ++++++++++++++++++++++ src/game/Player.h | 2 +- src/game/Spell.cpp | 9 +++++++-- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index e11b7e168e..b036fd1118 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -16706,6 +16706,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;icharges == -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 27e088f513..aff836b33c 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1447,6 +1447,7 @@ class TRINITY_DLL_SPEC Player : public Unit bool IsAffectedBySpellmod(SpellEntry const *spellInfo, SpellModifier *mod, Spell const* spell = NULL); template 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 { @@ -2396,4 +2397,3 @@ template 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 66a237d919..e9ab64f87d 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2720,9 +2720,14 @@ void Spell::finish(bool ok) if(!m_caster->IsNonMeleeSpellCasted(false, false, true)) m_caster->clearUnitState(UNIT_STAT_CASTING); + if(!ok) + { + //restore spell mods + if (m_caster->GetTypeId() == TYPEID_PLAYER) + ((Player*)m_caster)->RestoreSpellMods(this); + return; + } // other code related only to successfully finished spells - if(!ok) - return; //remove spell mods if (m_caster->GetTypeId() == TYPEID_PLAYER) From 2d69889a687b00cc231e19a7ec79b9d72f3b8b2f Mon Sep 17 00:00:00 2001 From: krz Date: Fri, 29 May 2009 00:07:38 +0200 Subject: [PATCH 3/5] Do not allow Seed of Corruption to damage affected target and trigger from other SoC proc. Original patch by freeganja --HG-- branch : trunk --- src/game/Spell.cpp | 3 ++- src/game/Unit.cpp | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index e9ab64f87d..001993201e 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2069,7 +2069,8 @@ void Spell::SetTargetMap(uint32 i, uint32 cur) unitList.remove(m_targets.getUnitTarget()); Trinity::RandomResizeList(unitList, m_spellValue->MaxAffectedTargets); - } + }else if(m_spellInfo->Id == 27285) // Seed of Corruption proc spell + unitList.remove(m_targets.getUnitTarget()); for(std::list::iterator itr = unitList.begin(); itr != unitList.end(); ++itr) AddUnitTarget(*itr, i); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 752248d7b2..86811c52a6 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -5467,6 +5467,8 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu // Seed of Corruption if (dummySpell->SpellFamilyFlags & 0x0000001000000000LL) { + if(procSpell && procSpell->Id == 27285) + return false; Modifier* mod = triggeredByAura->GetModifier(); // if damage is more than need or target die from damage deal finish spell if( mod->m_amount <= damage || GetHealth() <= damage ) From 861aad532b37a1c373fadb4c4fdb298e7b9a2a41 Mon Sep 17 00:00:00 2001 From: krz Date: Fri, 29 May 2009 04:52:03 +0200 Subject: [PATCH 4/5] Don't unsummon pet while mounting in arena. Disable pet's interface instead. --HG-- branch : trunk --- src/game/Unit.cpp | 44 ++++++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 86811c52a6..d2a10593a1 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -9466,16 +9466,22 @@ void Unit::Mount(uint32 mount) Pet* pet = GetPet(); if(pet) { - if(pet->isControlled()) + BattleGround *bg = ((Player *)this)->GetBattleGround(); + // don't unsummon pet in arena but SetFlag UNIT_FLAG_DISABLE_ROTATE to disable pet's interface + if(bg && bg->isArena()) + pet->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_ROTATE); + else { - ((Player*)this)->SetTemporaryUnsummonedPetNumber(pet->GetCharmInfo()->GetPetNumber()); - ((Player*)this)->SetOldPetSpell(pet->GetUInt32Value(UNIT_CREATED_BY_SPELL)); + if(pet->isControlled()) + { + ((Player*)this)->SetTemporaryUnsummonedPetNumber(pet->GetCharmInfo()->GetPetNumber()); + ((Player*)this)->SetOldPetSpell(pet->GetUInt32Value(UNIT_CREATED_BY_SPELL)); + } + ((Player*)this)->RemovePet(NULL,PET_SAVE_NOT_IN_SLOT); + return; } - - ((Player*)this)->RemovePet(NULL,PET_SAVE_NOT_IN_SLOT); } - else - ((Player*)this)->SetTemporaryUnsummonedPetNumber(0); + ((Player*)this)->SetTemporaryUnsummonedPetNumber(0); } } @@ -9492,13 +9498,19 @@ void Unit::Unmount() // only resummon old pet if the player is already added to a map // 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 && IsInWorld() && ((Player*)this)->GetTemporaryUnsummonedPetNumber() && isAlive()) + if(GetTypeId() == TYPEID_PLAYER && IsInWorld() && isAlive()) { - Pet* NewPet = new Pet; - if(!NewPet->LoadPetFromDB(this, 0, ((Player*)this)->GetTemporaryUnsummonedPetNumber(), true)) - delete NewPet; - - ((Player*)this)->SetTemporaryUnsummonedPetNumber(0); + if( ((Player*)this)->GetTemporaryUnsummonedPetNumber() ) + { + Pet* NewPet = new Pet; + if(!NewPet->LoadPetFromDB(this, 0, ((Player*)this)->GetTemporaryUnsummonedPetNumber(), true)) + delete NewPet; + ((Player*)this)->SetTemporaryUnsummonedPetNumber(0); + } + else + if(Pet *pPet = GetPet()) + if(pPet->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_ROTATE) && !pPet->hasUnitState(UNIT_STAT_STUNNED)) + pPet->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_ROTATE); } } @@ -12708,7 +12720,11 @@ void Unit::SetStunned(bool apply) { if(isAlive() && getVictim()) SetUInt64Value(UNIT_FIELD_TARGET, getVictim()->GetGUID()); - RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_ROTATE); + + // don't remove UNIT_FLAG_DISABLE_ROTATE 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_DISABLE_ROTATE); if(!hasUnitState(UNIT_STAT_ROOT)) // prevent allow move if have also root effect { From 3a223e0e8075139f4a91572ec33fa2841fd60c2d Mon Sep 17 00:00:00 2001 From: Paradox Date: Fri, 29 May 2009 08:32:59 -0400 Subject: [PATCH 5/5] Fix CRLF... please be sure to check your win32text settings, including cleverencode/cleverdecode settings before pushing to the repo --HG-- branch : trunk --- src/game/Player.cpp | 40 ++++++++++++++++++++-------------------- src/game/Spell.cpp | 14 +++++++------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index b036fd1118..6485355a29 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -16706,26 +16706,26 @@ 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;icharges == -1 && mod->lastAffected == spell) - { - mod->lastAffected = NULL; - mod->charges = 1; - m_SpellModRemoveCount--; - } - } - } +// Restore spellmods in case of failed cast +void Player::RestoreSpellMods(Spell const* spell) +{ + if(!spell || (m_SpellModRemoveCount == 0)) + return; + + for(int i=0;icharges == -1 && mod->lastAffected == spell) + { + mod->lastAffected = NULL; + mod->charges = 1; + m_SpellModRemoveCount--; + } + } + } } void Player::RemoveSpellMods(Spell const* spell) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 001993201e..29892fcfde 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2721,13 +2721,13 @@ void Spell::finish(bool ok) if(!m_caster->IsNonMeleeSpellCasted(false, false, true)) m_caster->clearUnitState(UNIT_STAT_CASTING); - if(!ok) - { - //restore spell mods - if (m_caster->GetTypeId() == TYPEID_PLAYER) - ((Player*)m_caster)->RestoreSpellMods(this); - return; - } + if(!ok) + { + //restore spell mods + if (m_caster->GetTypeId() == TYPEID_PLAYER) + ((Player*)m_caster)->RestoreSpellMods(this); + return; + } // other code related only to successfully finished spells //remove spell mods