* Allow spells to trigger ItemCombatSpells if spell is melee/ranged damage based. Original patch by freegajnja
* Tabs to spaces. --HG-- branch : trunk
This commit is contained in:
@@ -267,7 +267,6 @@ MapManager::Update(time_t diff)
|
||||
update_queue[i]->Update(i_timer.GetCurrent());
|
||||
sWorld.RecordTimeDiff("UpdateMap %u", update_queue[i]->GetId());
|
||||
// sLog.outError("This is thread %d out of %d threads,updating map %u",omp_get_thread_num(),omp_get_num_threads(),iter->second->GetId());
|
||||
|
||||
}
|
||||
|
||||
ObjectAccessor::Instance().Update(i_timer.GetCurrent());
|
||||
|
||||
+48
-12
@@ -6990,17 +6990,53 @@ void Player::UpdateEquipSpellsAtFormChange()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Player::CastItemCombatSpell(Item *item, CalcDamageInfo *damageInfo, ItemPrototype const * proto)
|
||||
void Player::CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32 procVictim, uint32 procEx)
|
||||
{
|
||||
Unit * Target = damageInfo->target;
|
||||
WeaponAttackType attType = damageInfo->attackType;
|
||||
|
||||
if (!Target || Target == this )
|
||||
if(!target || !target->isAlive() || target == this)
|
||||
return;
|
||||
|
||||
for(int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; i++)
|
||||
{
|
||||
// If usable, try to cast item spell
|
||||
if (Item * item = ((Player*)this)->GetItemByPos(INVENTORY_SLOT_BAG_0,i))
|
||||
if(!item->IsBroken())
|
||||
if (ItemPrototype const *proto = item->GetProto())
|
||||
{
|
||||
// Additional check for weapons
|
||||
if (proto->Class==ITEM_CLASS_WEAPON)
|
||||
{
|
||||
// offhand item cannot proc from main hand hit etc
|
||||
EquipmentSlots slot;
|
||||
switch (attType)
|
||||
{
|
||||
case BASE_ATTACK: slot = EQUIPMENT_SLOT_MAINHAND; break;
|
||||
case OFF_ATTACK: slot = EQUIPMENT_SLOT_OFFHAND; break;
|
||||
case RANGED_ATTACK: slot = EQUIPMENT_SLOT_RANGED; break;
|
||||
default: slot = EQUIPMENT_SLOT_END; break;
|
||||
}
|
||||
if (slot != i)
|
||||
continue;
|
||||
// Check if item is useable (forms or disarm)
|
||||
if (attType == BASE_ATTACK)
|
||||
{
|
||||
if (!((Player*)this)->IsUseEquipedWeapon(true))
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (((Player*)this)->IsInFeralForm())
|
||||
continue;
|
||||
}
|
||||
}
|
||||
((Player*)this)->CastItemCombatSpell(target, attType, procVictim, procEx, item, proto);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Player::CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32 procVictim, uint32 procEx, Item *item, ItemPrototype const * proto)
|
||||
{
|
||||
// Can do effect if any damage done to target
|
||||
if (damageInfo->procVictim & PROC_FLAG_TAKEN_ANY_DAMAGE)
|
||||
if (procVictim & PROC_FLAG_TAKEN_ANY_DAMAGE)
|
||||
{
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
@@ -7022,7 +7058,7 @@ void Player::CastItemCombatSpell(Item *item, CalcDamageInfo *damageInfo, ItemPro
|
||||
}
|
||||
|
||||
// not allow proc extra attack spell at extra attack
|
||||
if( m_extraAttacks && IsSpellHaveEffect(spellInfo,SPELL_EFFECT_ADD_EXTRA_ATTACKS) )
|
||||
if( m_extraAttacks && IsSpellHaveEffect(spellInfo, SPELL_EFFECT_ADD_EXTRA_ATTACKS) )
|
||||
return;
|
||||
|
||||
float chance = spellInfo->procChance;
|
||||
@@ -7038,7 +7074,7 @@ void Player::CastItemCombatSpell(Item *item, CalcDamageInfo *damageInfo, ItemPro
|
||||
}
|
||||
|
||||
if (roll_chance_f(chance))
|
||||
CastSpell(Target, spellInfo->Id, true, item);
|
||||
CastSpell(target, spellInfo->Id, true, item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7058,13 +7094,13 @@ void Player::CastItemCombatSpell(Item *item, CalcDamageInfo *damageInfo, ItemPro
|
||||
if (entry && entry->procEx)
|
||||
{
|
||||
// Check hit/crit/dodge/parry requirement
|
||||
if((entry->procEx & damageInfo->procEx) == 0)
|
||||
if((entry->procEx & procEx) == 0)
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Can do effect if any damage done to target
|
||||
if (!(damageInfo->procVictim & PROC_FLAG_TAKEN_ANY_DAMAGE))
|
||||
if (!(procVictim & PROC_FLAG_TAKEN_ANY_DAMAGE))
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -7093,7 +7129,7 @@ void Player::CastItemCombatSpell(Item *item, CalcDamageInfo *damageInfo, ItemPro
|
||||
if(IsPositiveSpell(pEnchant->spellid[s]))
|
||||
CastSpell(this, pEnchant->spellid[s], true, item);
|
||||
else
|
||||
CastSpell(Target, pEnchant->spellid[s], true, item);
|
||||
CastSpell(target, pEnchant->spellid[s], true, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -1798,7 +1798,8 @@ class TRINITY_DLL_SPEC Player : public Unit
|
||||
void ApplyItemEquipSpell(Item *item, bool apply, bool form_change = false);
|
||||
void ApplyEquipSpell(SpellEntry const* spellInfo, Item* item, bool apply, bool form_change = false);
|
||||
void UpdateEquipSpellsAtFormChange();
|
||||
void CastItemCombatSpell(Item *item, CalcDamageInfo *damageInfo, ItemPrototype const * proto);
|
||||
void CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32 procVictim, uint32 procEx);
|
||||
void CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32 procVictim, uint32 procEx, Item *item, ItemPrototype const * proto);
|
||||
|
||||
void SendInitWorldStates(bool force = false, uint32 forceZoneId = 0);
|
||||
void SendUpdateWorldState(uint32 Field, uint32 Value);
|
||||
|
||||
+8
-3
@@ -1043,11 +1043,16 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
|
||||
procEx = createProcExtendMask(&damageInfo, missInfo);
|
||||
procVictim |= PROC_FLAG_TAKEN_ANY_DAMAGE;
|
||||
|
||||
// Do triggers for unit (reflect triggers passed on hit phase for correct drop charge)
|
||||
if (missInfo != SPELL_MISS_REFLECT)
|
||||
caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, damageInfo.damage, m_attackType, m_spellInfo, m_canTrigger);
|
||||
|
||||
caster->DealSpellDamage(&damageInfo, true);
|
||||
// Do triggers for unit (reflect triggers passed on hit phase for correct drop charge)
|
||||
if (missInfo != SPELL_MISS_REFLECT)
|
||||
{
|
||||
caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, damageInfo.damage, m_attackType, m_spellInfo, m_canTrigger);
|
||||
if(caster->GetTypeId() == TYPEID_PLAYER && (m_spellInfo->Attributes & SPELL_ATTR_STOP_ATTACK_TARGET) == 0 &&
|
||||
(m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE || m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED))
|
||||
((Player *)caster)->CastItemCombatSpell(unitTarget, m_attackType, procVictim, procEx);
|
||||
}
|
||||
|
||||
// Shadow Word: Death - deals damage equal to damage done to caster if victim is not killed
|
||||
if (m_spellInfo->SpellFamilyName == SPELLFAMILY_PRIEST && m_spellInfo->SpellFamilyFlags&0x0000000200000000LL &&
|
||||
|
||||
Reference in New Issue
Block a user