mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 18:10:26 +00:00
feat(Core/Unit): New helper HasActivePowerType and script hook OnPlayerHasActivePowerType (#18293)
* Create HasActivePower for script intercept * Replace relevant player-related getPowerType() comparators with HasActivePowerType * Change OnPlayerHasActivePowerType to regular bool instead of optional --------- Co-authored-by: NathanHandley <nathanhandley@protonmail.com>
This commit is contained in:
@@ -929,7 +929,7 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage
|
||||
}
|
||||
|
||||
// Rage from Damage made (only from direct weapon damage)
|
||||
if (attacker && cleanDamage && damagetype == DIRECT_DAMAGE && attacker != victim && attacker->getPowerType() == POWER_RAGE)
|
||||
if (attacker && cleanDamage && damagetype == DIRECT_DAMAGE && attacker != victim && attacker->HasActivePowerType(POWER_RAGE))
|
||||
{
|
||||
uint32 weaponSpeedHitFactor;
|
||||
|
||||
@@ -957,10 +957,10 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage
|
||||
// Rage from absorbed damage
|
||||
if (cleanDamage && cleanDamage->absorbed_damage)
|
||||
{
|
||||
if (victim->getPowerType() == POWER_RAGE)
|
||||
if (victim->HasActivePowerType(POWER_RAGE))
|
||||
victim->RewardRage(cleanDamage->absorbed_damage, 0, false);
|
||||
|
||||
if (attacker && attacker->getPowerType() == POWER_RAGE )
|
||||
if (attacker && attacker->HasActivePowerType(POWER_RAGE))
|
||||
attacker->RewardRage(cleanDamage->absorbed_damage, 0, true);
|
||||
}
|
||||
|
||||
@@ -1083,7 +1083,7 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage
|
||||
}
|
||||
|
||||
// Rage from damage received
|
||||
if (attacker != victim && victim->getPowerType() == POWER_RAGE)
|
||||
if (attacker != victim && victim->HasActivePowerType(POWER_RAGE))
|
||||
{
|
||||
uint32 rageDamage = damage + (cleanDamage ? cleanDamage->absorbed_damage : 0);
|
||||
victim->RewardRage(rageDamage, 0, false);
|
||||
@@ -6996,7 +6996,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
// Magic Absorption
|
||||
if (dummySpell->SpellIconID == 459) // only this spell has SpellIconID == 459 and dummy aura
|
||||
{
|
||||
if (getPowerType() != POWER_MANA)
|
||||
if (!HasActivePowerType(POWER_MANA))
|
||||
return false;
|
||||
|
||||
// mana reward
|
||||
@@ -7775,7 +7775,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
// Judgement of Wisdom
|
||||
case 20186:
|
||||
{
|
||||
if (!victim || !victim->IsAlive() || victim->getPowerType() != POWER_MANA || victim->HasSpellCooldown(20268))
|
||||
if (!victim || !victim->IsAlive() || !victim->HasActivePowerType(POWER_MANA) || victim->HasSpellCooldown(20268))
|
||||
return false;
|
||||
|
||||
// 2% of base mana
|
||||
|
||||
Reference in New Issue
Block a user