mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-14 01:29:07 +00:00
fix(Core/Unit): add rage gain when attack is fully blocked, dodged or parried (#19377)
* generate rage if victim fully block, dodge, parry * update rage calculation * calc pct at the end * update comment to link to Rage formulae and mention Bornak's bluepost archived link to Bornak's bluepost https://web.archive.org/web/20090604123729/http://forums.worldofwarcraft.com/thread.html?topicId=17367760070&pageNo=13#02500
This commit is contained in:
@@ -1893,6 +1893,23 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss)
|
||||
Unit::DealDamage(this, victim, damageInfo->damages[i].damage, &cleanDamage, DIRECT_DAMAGE, SpellSchoolMask(damageInfo->damages[i].damageSchoolMask), nullptr, durabilityLoss);
|
||||
}
|
||||
|
||||
// gain rage if attack is fully blocked, dodged or parried
|
||||
if (HasActivePowerType(POWER_RAGE) && (damageInfo->TargetState == VICTIMSTATE_BLOCKS || damageInfo->TargetState == VICTIMSTATE_DODGE || damageInfo->TargetState == VICTIMSTATE_PARRY))
|
||||
{
|
||||
switch (damageInfo->attackType)
|
||||
{
|
||||
case BASE_ATTACK:
|
||||
case OFF_ATTACK:
|
||||
{
|
||||
uint32 weaponSpeedHitFactor = uint32(GetAttackTime(damageInfo->attackType) / 1000.0f * (damageInfo->attackType == BASE_ATTACK ? 3.5f : 1.75f));
|
||||
RewardRage(damageInfo->cleanDamage, weaponSpeedHitFactor, true);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If this is a creature and it attacks from behind it has a probability to daze it's victim
|
||||
if ((damageInfo->damages[0].damage + damageInfo->damages[1].damage) && ((damageInfo->hitOutCome == MELEE_HIT_CRIT || damageInfo->hitOutCome == MELEE_HIT_CRUSHING || damageInfo->hitOutCome == MELEE_HIT_NORMAL || damageInfo->hitOutCome == MELEE_HIT_GLANCING) &&
|
||||
!IsPlayer() && !ToCreature()->IsControlledByPlayer() && !victim->HasInArc(M_PI, this)
|
||||
@@ -20112,6 +20129,7 @@ void Unit::SendRemoveFromThreatListOpcode(HostileReference* pHostileReference)
|
||||
|
||||
void Unit::RewardRage(uint32 damage, uint32 weaponSpeedHitFactor, bool attacker)
|
||||
{
|
||||
// Rage formulae https://wowwiki-archive.fandom.com/wiki/Rage#Formulae
|
||||
float addRage;
|
||||
|
||||
float rageconversion = ((0.0091107836f * GetLevel() * GetLevel()) + 3.225598133f * GetLevel()) + 4.2652911f;
|
||||
@@ -20122,9 +20140,10 @@ void Unit::RewardRage(uint32 damage, uint32 weaponSpeedHitFactor, bool attacker)
|
||||
|
||||
if (attacker)
|
||||
{
|
||||
addRage = (damage / rageconversion * 7.5f + weaponSpeedHitFactor) / 2;
|
||||
|
||||
// talent who gave more rage on attack
|
||||
// see Bornak's bluepost explanation (05/29/2009)
|
||||
float rageFromDamageDealt = damage / rageconversion * 7.5f;
|
||||
addRage = (rageFromDamageDealt + weaponSpeedHitFactor) / 2.0f;
|
||||
addRage = std::min(addRage, rageFromDamageDealt * 2.0f);
|
||||
AddPct(addRage, GetTotalAuraModifier(SPELL_AURA_MOD_RAGE_FROM_DAMAGE_DEALT));
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user