aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/Player.cpp99
-rw-r--r--src/game/Spell.cpp2
-rw-r--r--src/game/SpellMgr.h2
3 files changed, 66 insertions, 37 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index a68002445bc..d5f1106994a 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -6931,55 +6931,55 @@ void Player::UpdateEquipSpellsAtFormChange()
}
}
-void Player::CastItemCombatSpell(Item *item,Unit* Target, WeaponAttackType attType)
+void Player::CastItemCombatSpell(Item *item, CalcDamageInfo *damageInfo, ItemPrototype const * proto)
{
- if(!item || item->IsBroken())
- return;
-
- ItemPrototype const *proto = item->GetProto();
- if(!proto)
- return;
+ Unit * Target = damageInfo->target;
+ WeaponAttackType attType = damageInfo->attackType;
if (!Target || Target == this )
return;
- for (int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
+ // Can do effect if any damage done to target
+ if (damageInfo->damage)
{
- _Spell const& spellData = proto->Spells[i];
+ for (int i = 0; i < 5; i++)
+ {
+ _Spell const& spellData = proto->Spells[i];
- // no spell
- if(!spellData.SpellId )
- continue;
+ // no spell
+ if(!spellData.SpellId )
+ continue;
- // wrong triggering type
- if(spellData.SpellTrigger != ITEM_SPELLTRIGGER_CHANCE_ON_HIT)
- continue;
+ // wrong triggering type
+ if(spellData.SpellTrigger != ITEM_SPELLTRIGGER_CHANCE_ON_HIT)
+ continue;
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellData.SpellId);
- if(!spellInfo)
- {
- sLog.outError("WORLD: unknown Item spellid %i", spellData.SpellId);
- continue;
- }
+ SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellData.SpellId);
+ if(!spellInfo)
+ {
+ sLog.outError("WORLD: unknown Item spellid %i", spellData.SpellId);
+ continue;
+ }
- // not allow proc extra attack spell at extra attack
- if( m_extraAttacks && IsSpellHaveEffect(spellInfo,SPELL_EFFECT_ADD_EXTRA_ATTACKS) )
- return;
+ // not allow proc extra attack spell at extra attack
+ if( m_extraAttacks && IsSpellHaveEffect(spellInfo,SPELL_EFFECT_ADD_EXTRA_ATTACKS) )
+ return;
- float chance = spellInfo->procChance;
+ float chance = spellInfo->procChance;
- if(spellData.SpellPPMRate)
- {
- uint32 WeaponSpeed = GetAttackTime(attType);
- chance = GetPPMProcChance(WeaponSpeed, spellData.SpellPPMRate, spellInfo);
- }
- else if(chance > 100.0f)
- {
- chance = GetWeaponProcChance();
- }
+ if(spellData.SpellPPMRate)
+ {
+ uint32 WeaponSpeed = GetAttackTime(attType);
+ chance = GetPPMProcChance(WeaponSpeed, spellData.SpellPPMRate, spellInfo);
+ }
+ else if(chance > 100.0f)
+ {
+ chance = GetWeaponProcChance();
+ }
- if (roll_chance_f(chance))
- CastSpell(Target, spellInfo->Id, true, item);
+ if (roll_chance_f(chance))
+ CastSpell(Target, spellInfo->Id, true, item);
+ }
}
// item combat enchantments
@@ -6993,6 +6993,21 @@ void Player::CastItemCombatSpell(Item *item,Unit* Target, WeaponAttackType attTy
if(pEnchant->type[s]!=ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
continue;
+ SpellEnchantProcEntry const* entry = spellmgr.GetSpellEnchantProcEvent(enchant_id);
+
+ if (entry && entry->procEx)
+ {
+ // Check hit/crit/dodge/parry requirement
+ if((entry->procEx & damageInfo->procEx) == 0)
+ continue;
+ }
+ else
+ {
+ // Can do effect if any damage done to target
+ if (!(damageInfo->damage))
+ continue;
+ }
+
SpellEntry const *spellInfo = sSpellStore.LookupEntry(pEnchant->spellid[s]);
if (!spellInfo)
{
@@ -7001,6 +7016,18 @@ void Player::CastItemCombatSpell(Item *item,Unit* Target, WeaponAttackType attTy
}
float chance = pEnchant->amount[s] != 0 ? float(pEnchant->amount[s]) : GetWeaponProcChance();
+
+ if (entry && entry->PPMChance)
+ {
+ uint32 WeaponSpeed = GetAttackTime(attType);
+ chance = GetPPMProcChance(WeaponSpeed, entry->PPMChance, spellInfo);
+ }
+ else if (entry && entry->customChance)
+ chance = entry->customChance;
+
+ // Apply spell mods
+ ApplySpellMod(pEnchant->spellid[s],SPELLMOD_CHANCE_OF_SUCCESS,chance);
+
if (roll_chance_f(chance))
{
if(IsPositiveSpell(pEnchant->spellid[s]))
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 43c33700bce..7e94e86ab4d 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -981,7 +981,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
//Spells with this flag cannot trigger if effect is casted on self
// Slice and Dice, relentless strikes, eviscerate
- bool canEffectTrigger = (m_spellInfo->AttributesEx4 & (SPELL_ATTR_EX4_CANT_PROC_FROM_SELFCAST | SPELL_ATTR_EX4_UNK4) ? m_caster!=unitTarget : true)
+ bool canEffectTrigger = (m_spellInfo->AttributesEx4 & (SPELL_ATTR_EX4_CANT_PROC_FROM_SELFCAST | SPELL_ATTR_EX4_UNK4) ? m_caster!=unitTarget : true);
Unit * spellHitTarget = NULL;
if (missInfo==SPELL_MISS_NONE) // In case spell hit target, do all effect on that target
diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h
index 6869f2e529e..ffaa5f3e32e 100644
--- a/src/game/SpellMgr.h
+++ b/src/game/SpellMgr.h
@@ -468,6 +468,8 @@ enum ProcFlagsEx
PROC_EX_AURA_REMOVE_EXPIRE = 0x0004000, // aura remove by default and by cancel
PROC_EX_EX_TRIGGER_ALWAYS = 0x0010000, // If set trigger always ( no matter another flags) used for drop charges
PROC_EX_EX_ONE_TIME_TRIGGER = 0x0020000, // If set trigger always but only one time (not used)
+ PROC_EX_INTERNAL_DOT = 0x1000000, // Only for internal use
+ PROC_EX_INTERNAL_HOT = 0x2000000, // Only for internal use
PROC_EX_INTERNAL_TRIGGERED = 0x4000000, // Only for internal use
PROC_EX_INTERNAL_ITEM_CAST = 0x8000000
};