diff --git a/sql/mangos_spell_check.sql b/sql/mangos_spell_check.sql index a2d4389bd..f9022f7c5 100644 --- a/sql/mangos_spell_check.sql +++ b/sql/mangos_spell_check.sql @@ -636,6 +636,7 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas ( 0, 9,0x0008000000000000,0x00000000, -1, -1, -1, 2, -1,-1,'Counterattack', 'Spell::EffectSchoolDMG'), ( 0, 5, -1, -1, -1, -1,1179, -1, -1,-1,'Curse of Doom', 'Spell::CheckTargetCreatureType'), ( 0, 8,0x0000000000010000,0x00000000, -1, -1, -1, -1, 3,-1,'Deadly poison', 'Spell::EffectSchoolDMG'), +( 0, 8,0x0000000000010000,0x00000000, -1, -1, -1, 6, -1,-1,'Deadly Poison', 'Player::CastItemCombatSpell'), ( 0,15,0x0000000000002000,0x00000000, -1, -1, -1, 3, -1,-1,'Death Coil', 'Spell::EffectDummy'), ( 0,15,0x0000000000000010,0x00000000, -1, -1, -1, 31, -1, 1,'Death Strike', 'Spell::EffectWeaponDmg'), ( 0,15,0x0000000000000010,0x00000000, -1, -1, -1, 3, -1, 2,'Death Strike', 'Spell::EffectDummy'), diff --git a/src/game/Player.cpp b/src/game/Player.cpp index a0150543d..283872b9b 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -7528,6 +7528,46 @@ void Player::UpdateEquipSpellsAtFormChange() } } +/// handles unique effect of Deadly Poison: apply poison of the other weapon when already at max. stack +void Player::_HandleDeadlyPoison(Unit* Target, WeaponAttackType attType, SpellEntry const *spellInfo) +{ + SpellAuraHolder const* dPoison = NULL; + SpellAuraHolderConstBounds holders = Target->GetSpellAuraHolderBounds(spellInfo->Id); + for (SpellAuraHolderMap::const_iterator iter = holders.first; iter != holders.second; ++iter) + { + if (iter->second->GetCaster() == this) + { + dPoison = iter->second; + break; + } + } + if (dPoison && dPoison->GetStackAmount() == spellInfo->StackAmount) + { + Item *otherWeapon = GetWeaponForAttack(attType == BASE_ATTACK ? OFF_ATTACK : BASE_ATTACK ); + if (!otherWeapon) + return; + + // all poison enchantments are temporary + uint32 enchant_id = otherWeapon->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT); + if (!enchant_id) + return; + + SpellItemEnchantmentEntry const* pSecondEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); + if (!pSecondEnchant) + return; + + for (int s = 0; s < 3; ++s) + { + if (pSecondEnchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL) + continue; + + SpellEntry const* combatEntry = sSpellStore.LookupEntry(pSecondEnchant->spellid[s]); + if (combatEntry && combatEntry->Dispel == DISPEL_POISON) + CastSpell(Target, combatEntry, true, otherWeapon); + } + } +} + void Player::CastItemCombatSpell(Unit* Target, WeaponAttackType attType) { Item *item = GetWeaponForAttack(attType, true, false); @@ -7614,7 +7654,13 @@ void Player::CastItemCombatSpell(Unit* Target, WeaponAttackType attType) if(IsPositiveSpell(pEnchant->spellid[s])) CastSpell(this, pEnchant->spellid[s], true, item); else + { + // Deadly Poison, unique effect needs to be handled before casting triggered spell + if (spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE && spellInfo->SpellFamilyFlags & UI64LIT(0x10000)) + _HandleDeadlyPoison(Target, attType, spellInfo); + CastSpell(Target, pEnchant->spellid[s], true, item); + } } } } diff --git a/src/game/Player.h b/src/game/Player.h index f4c73b6f5..7318639eb 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -2630,6 +2630,7 @@ class MANGOS_DLL_SPEC Player : public Unit Runes *m_runes; EquipmentSets m_EquipmentSets; private: + void _HandleDeadlyPoison(Unit* Target, WeaponAttackType attType, SpellEntry const *spellInfo); // internal common parts for CanStore/StoreItem functions uint8 _CanStoreItem_InSpecificSlot( uint8 bag, uint8 slot, ItemPosCountVec& dest, ItemPrototype const *pProto, uint32& count, bool swap, Item *pSrcItem ) const; uint8 _CanStoreItem_InBag( uint8 bag, ItemPosCountVec& dest, ItemPrototype const *pProto, uint32& count, bool merge, bool non_specialized, Item *pSrcItem, uint8 skip_bag, uint8 skip_slot ) const; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index d8562b666..1fc5b9557 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11197" + #define REVISION_NR "11198" #endif // __REVISION_NR_H__