*Allow Hots to proc-this should fix talents like 33776 effect from hots.

--HG--
branch : trunk
This commit is contained in:
QAston
2009-05-11 23:46:45 +02:00
parent 95504364e0
commit 51b5f2aa64
6 changed files with 89 additions and 58 deletions
+1 -8
View File
@@ -6991,15 +6991,8 @@ void Player::UpdateEquipSpellsAtFormChange()
}
}
void Player::CastItemCombatSpell(Item *item, CalcDamageInfo *damageInfo)
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;
+1 -1
View File
@@ -1797,7 +1797,7 @@ 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);
void CastItemCombatSpell(Item *item, CalcDamageInfo *damageInfo, ItemPrototype const * proto);
void SendInitWorldStates(bool force = false, uint32 forceZoneId = 0);
void SendUpdateWorldState(uint32 Field, uint32 Value);
+16 -13
View File
@@ -5440,12 +5440,13 @@ void Aura::PeriodicTick()
SpellEntry const* spellProto = GetSpellProto();
// Set trigger flag
uint32 procAttacker = PROC_FLAG_ON_DO_PERIODIC;// | PROC_FLAG_SUCCESSFUL_HARMFUL_SPELL_HIT;
uint32 procVictim = PROC_FLAG_ON_TAKE_PERIODIC;// | PROC_FLAG_TAKEN_HARMFUL_SPELL_HIT;
uint32 procAttacker = PROC_FLAG_ON_DO_PERIODIC;
uint32 procVictim = PROC_FLAG_ON_TAKE_PERIODIC;
uint32 procEx = PROC_EX_INTERNAL_DOT;
pdamage = (pdamage <= absorb+resist) ? 0 : (pdamage-absorb-resist);
if (pdamage)
procVictim|=PROC_FLAG_TAKEN_ANY_DAMAGE;
pCaster->ProcDamageAndSpell(target, procAttacker, procVictim, PROC_EX_NORMAL_HIT, pdamage, BASE_ATTACK, spellProto);
pCaster->ProcDamageAndSpell(target, procAttacker, procVictim, procEx, pdamage, BASE_ATTACK, spellProto);
pCaster->DealDamage(target, pdamage, &cleanDamage, DOT, GetSpellSchoolMask(spellProto), spellProto, true);
break;
@@ -5560,12 +5561,13 @@ void Aura::PeriodicTick()
float multiplier = spellProto->EffectMultipleValue[GetEffIndex()] > 0 ? spellProto->EffectMultipleValue[GetEffIndex()] : 1;
// Set trigger flag
uint32 procAttacker = PROC_FLAG_ON_DO_PERIODIC;// | PROC_FLAG_SUCCESSFUL_HARMFUL_SPELL_HIT;
uint32 procVictim = PROC_FLAG_ON_TAKE_PERIODIC;// | PROC_FLAG_TAKEN_HARMFUL_SPELL_HIT;
uint32 procAttacker = PROC_FLAG_ON_DO_PERIODIC;
uint32 procVictim = PROC_FLAG_ON_TAKE_PERIODIC;
uint32 procEx = PROC_EX_INTERNAL_DOT;
pdamage = (pdamage <= absorb+resist) ? 0 : (pdamage-absorb-resist);
if (pdamage)
procVictim|=PROC_FLAG_TAKEN_ANY_DAMAGE;
pCaster->ProcDamageAndSpell(target, procAttacker, procVictim, PROC_EX_NORMAL_HIT, pdamage, BASE_ATTACK, spellProto);
pCaster->ProcDamageAndSpell(target, procAttacker, procVictim, procEx, pdamage, BASE_ATTACK, spellProto);
int32 new_damage = pCaster->DealDamage(target, pdamage, &cleanDamage, DOT, GetSpellSchoolMask(spellProto), spellProto, false);
if (!target->isAlive() && pCaster->IsNonMeleeSpellCasted(false))
@@ -5670,11 +5672,12 @@ void Aura::PeriodicTick()
}
}
uint32 procAttacker = PROC_FLAG_ON_DO_PERIODIC;// | PROC_FLAG_SUCCESSFUL_HEAL;
uint32 procVictim = 0;//ROC_FLAG_ON_TAKE_PERIODIC | PROC_FLAG_TAKEN_HEAL;
uint32 procAttacker = PROC_FLAG_ON_DO_PERIODIC;
uint32 procVictim = PROC_FLAG_ON_TAKE_PERIODIC;
uint32 procEx = PROC_EX_INTERNAL_HOT;
// ignore item heals
// if(procSpell && !haveCastItem)
// pCaster->ProcDamageAndSpell(target, procAttacker, procVictim, PROC_EX_NORMAL_HIT, pdamage, BASE_ATTACK, spellProto);
if(procSpell && !haveCastItem)
pCaster->ProcDamageAndSpell(target, procAttacker, procVictim, procEx, pdamage, BASE_ATTACK, spellProto);
break;
}
case SPELL_AURA_PERIODIC_MANA_LEECH:
@@ -5863,9 +5866,9 @@ void Aura::PeriodicTick()
pCaster->SendSpellNonMeleeDamageLog(&damageInfo);
// Set trigger flag
uint32 procAttacker = PROC_FLAG_ON_DO_PERIODIC;// | PROC_FLAG_SUCCESSFUL_HARMFUL_SPELL_HIT;
uint32 procVictim = PROC_FLAG_ON_TAKE_PERIODIC;// | PROC_FLAG_TAKEN_HARMFUL_SPELL_HIT;
uint32 procEx = createProcExtendMask(&damageInfo, SPELL_MISS_NONE);
uint32 procAttacker = PROC_FLAG_ON_DO_PERIODIC;
uint32 procVictim = PROC_FLAG_ON_TAKE_PERIODIC;
uint32 procEx = createProcExtendMask(&damageInfo, SPELL_MISS_NONE) | PROC_EX_INTERNAL_DOT;
if (damageInfo.damage)
procVictim|=PROC_FLAG_TAKEN_ANY_DAMAGE;
+36 -1
View File
@@ -1213,6 +1213,41 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const * spellP
if((procFlags & EventProcFlag) == 0)
return false;
/* Check Periodic Auras
* Both hots and dots can trigger if spell has no PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL
nor PROC_FLAG_SUCCESSFUL_NEGATIVE_SPELL_HIT
*Only Hots can trigger if spell has PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL
*Only dots can trigger if spell has both positivity flags or PROC_FLAG_SUCCESSFUL_NEGATIVE_SPELL_HIT
*/
if (EventProcFlag & PROC_FLAG_ON_DO_PERIODIC)
{
if (procFlags & PROC_FLAG_SUCCESSFUL_NEGATIVE_SPELL_HIT)
{
if (!(procExtra & PROC_EX_INTERNAL_DOT))
return false;
}
else if (procFlags & PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL
&& !(procExtra & PROC_EX_INTERNAL_HOT))
return false;
}
if (EventProcFlag & PROC_FLAG_ON_TAKE_PERIODIC)
{
if (procFlags & PROC_FLAG_TAKEN_NEGATIVE_SPELL_HIT)
{
if (!(procExtra & PROC_EX_INTERNAL_DOT))
return false;
}
else if (procFlags & PROC_FLAG_TAKEN_POSITIVE_SPELL
&& !(procExtra & PROC_EX_INTERNAL_HOT))
return false;
}
// Always trigger for this
if (EventProcFlag & (PROC_FLAG_KILLED | PROC_FLAG_KILL_AND_GET_XP))
return true;
@@ -1337,7 +1372,7 @@ void SpellMgr::LoadSpellEnchantProcData()
uint32 count = 0;
// 0 1 2 3
QueryResult *result = WorldDatabase.Query("SELECT entry, customChance, PPMChance, procEx");
QueryResult *result = WorldDatabase.Query("SELECT entry, customChance, PPMChance, procEx FROM spell_enchant_proc_data");
if( !result )
{
+3 -1
View File
@@ -547,7 +547,9 @@ enum ProcFlagsEx
PROC_EX_RESERVED2 = 0x0004000,
PROC_EX_RESERVED3 = 0x0008000,
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
PROC_EX_EX_ONE_TIME_TRIGGER = 0x0020000, // If set trigger always but only one time
PROC_EX_INTERNAL_HOT = 0x1000000, // Only for internal use
PROC_EX_INTERNAL_DOT = 0x2000000 // Only for internal use
};
struct SpellProcEventEntry
+15 -17
View File
@@ -1615,41 +1615,39 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
{
for(int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; i++)
{
EquipmentSlots slot = (EquipmentSlots)i;
// For weapon slots check if valid attack type and if weapon useable
if (i == EQUIPMENT_SLOT_MAINHAND
|| i == EQUIPMENT_SLOT_OFFHAND
|| i == EQUIPMENT_SLOT_RANGED)
// 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 (damageInfo->attackType)
{
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;
default: slot = EQUIPMENT_SLOT_END; break;
}
// offhand item cannot proc from main hand hit etc
if (slot != i)
slot=EQUIPMENT_SLOT_END;
else
{
continue;
// Check if item is useable (forms or disarm)
if (damageInfo->attackType == BASE_ATTACK)
{
if (!((Player*)this)->IsUseEquipedWeapon(true))
slot=EQUIPMENT_SLOT_END;
continue;
}
else if (damageInfo->attackType == OFF_ATTACK)
else
{
if (((Player*)this)->IsInFeralForm())
slot=EQUIPMENT_SLOT_END;
continue;
}
}
((Player*)this)->CastItemCombatSpell(item, damageInfo, proto);
}
// If usable, try to cast item spell
if(slot!=EQUIPMENT_SLOT_END)
((Player*)this)->CastItemCombatSpell(((Player*)this)->GetItemByPos(INVENTORY_SLOT_BAG_0,i), damageInfo);
}
}