Skip to content

Commit

Permalink
[11198] Implement max stack effect of enchantment applied by spell 28…
Browse files Browse the repository at this point in the history
…23 and ranks.

Thanks to "maly32167" for additional input.
  • Loading branch information
laise authored and Lynx3d committed Feb 22, 2011
1 parent c37c8d2 commit 4b61e9a
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 1 deletion.
1 change: 1 addition & 0 deletions sql/mangos_spell_check.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
46 changes: 46 additions & 0 deletions src/game/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/game/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11197"
#define REVISION_NR "11198"
#endif // __REVISION_NR_H__

1 comment on commit 4b61e9a

@teyrnon
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spells occupied whole core..

Please sign in to comment.