Skip to content

Commit

Permalink
[11281] Code cleanup in Player::CastItemCombatSpell
Browse files Browse the repository at this point in the history
  • Loading branch information
VladimirMangos committed Mar 25, 2011
1 parent b3674b9 commit 7990867
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 10 additions & 8 deletions src/game/Player.cpp
Expand Up @@ -7628,13 +7628,15 @@ void Player::CastItemCombatSpell(Unit* Target, WeaponAttackType attType)
if(!pEnchant) continue;
for (int s = 0; s < 3; ++s)
{
if (pEnchant->type[s]!=ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
uint32 proc_spell_id = pEnchant->spellid[s];

if (pEnchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
continue;

SpellEntry const *spellInfo = sSpellStore.LookupEntry(pEnchant->spellid[s]);
SpellEntry const *spellInfo = sSpellStore.LookupEntry(proc_spell_id);
if (!spellInfo)
{
sLog.outError("Player::CastItemCombatSpell Enchant %i, cast unknown spell %i", pEnchant->ID, pEnchant->spellid[s]);
sLog.outError("Player::CastItemCombatSpell Enchant %i, cast unknown spell %i", pEnchant->ID, proc_spell_id);
continue;
}

Expand All @@ -7646,20 +7648,20 @@ void Player::CastItemCombatSpell(Unit* Target, WeaponAttackType attType)
: pEnchant->amount[s] != 0 ? float(pEnchant->amount[s]) : GetWeaponProcChance();


ApplySpellMod(spellInfo->Id,SPELLMOD_CHANCE_OF_SUCCESS,chance);
ApplySpellMod(spellInfo->Id,SPELLMOD_FREQUENCY_OF_SUCCESS,chance);
ApplySpellMod(spellInfo->Id,SPELLMOD_CHANCE_OF_SUCCESS, chance);
ApplySpellMod(spellInfo->Id,SPELLMOD_FREQUENCY_OF_SUCCESS, chance);

if (roll_chance_f(chance))
{
if(IsPositiveSpell(pEnchant->spellid[s]))
CastSpell(this, pEnchant->spellid[s], true, item);
if (IsPositiveSpell(spellInfo->Id))
CastSpell(this, spellInfo->Id, 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);
CastSpell(Target, spellInfo->Id, true, item);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11280"
#define REVISION_NR "11281"
#endif // __REVISION_NR_H__

0 comments on commit 7990867

Please sign in to comment.