Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Melee hit tables updated to classic values #209

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions src/game/Objects/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2592,6 +2592,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit *pVictim, WeaponAttackT

// bonus from skills is 0.04%
int32 skillBonus = 4 * (attackerWeaponSkill - victimMaxSkillValueForLevel);
int32 levelSkillDelta = attackerMaxSkillValueForLevel - victimMaxSkillValueForLevel;
int32 sum = 0, tmp = 0;
int32 roll = urand(0, 10000);

Expand Down Expand Up @@ -2623,10 +2624,11 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit *pVictim, WeaponAttackT
// only players can't dodge if attacker is behind
if (pVictim->GetTypeId() != TYPEID_PLAYER || !from_behind)
{
// See https://us.forums.blizzard.com/en/wow/t/bug-hit-tables/185675/12
tmp = dodge_chance;
if ((tmp > 0) // check if unit _can_ dodge
&& ((tmp -= skillBonus) > 0)
&& roll < (sum += tmp))
tmp -= 10 * levelSkillDelta;
tmp -= skillBonus;
if (tmp > 0 && roll < (sum += tmp))
{
DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "RollMeleeOutcomeAgainst: DODGE <%d, %d)", sum - tmp, sum);
return MELEE_HIT_DODGE;
Expand All @@ -2637,6 +2639,11 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit *pVictim, WeaponAttackT
// check if attack comes from behind, nobody can parry or block if attacker is behind
if (!from_behind)
{
// Based on https://us.forums.blizzard.com/en/wow/t/bug-hit-tables/185675/12,
// and Beta test data https://github.com/magey/classic-warrior/issues/5
if (levelSkillDelta < -10)
parry_chance += 900;

if (parry_chance > 0 && (pVictim->GetTypeId() == TYPEID_PLAYER || !(((Creature*)pVictim)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_PARRY)))
{
parry_chance -= skillBonus;
Expand Down Expand Up @@ -2712,6 +2719,11 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit *pVictim, WeaponAttackT
// Critical chance
tmp = crit_chance;

// Critical Strike chance is reduced by 1% per each additional level the target has over the player.
// See https://us.forums.blizzard.com/en/wow/t/bug-hit-tables/185675/12
if (levelSkillDelta < 0)
tmp += levelSkillDelta * 20;

if (tmp > 0 && roll < (sum += tmp))
{
DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "RollMeleeOutcomeAgainst: CRIT <%d, %d)", sum - tmp, sum);
Expand Down Expand Up @@ -2900,8 +2912,14 @@ float Unit::MeleeSpellMissChance(Unit *pVictim, WeaponAttackType attType, int32
// Hit chance depends from victim auras
if (attType == RANGED_ATTACK)
hitChance += pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE);
else
hitChance += pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE);
else {
// The first hit from gear (and likely talents) was ignored by mobs with > 10 skill difference
int32 hitFromAuras = pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to get the total aura modifiers from gear only? The blue post seems to indicate that talents would not be considered in this penalty.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both are auras, so i wouldn't think so.

if (skillDiff < -10 && hitFromAuras >= 1)
hitFromAuras -= 1;

hitChance += hitFromAuras;
}

// Spellmod from SPELLMOD_RESIST_MISS_CHANCE
if (Player *modOwner = GetSpellModOwner())
Expand Down Expand Up @@ -3345,6 +3363,7 @@ float Unit::MeleeMissChanceCalc(const Unit *pVictim, WeaponAttackType attType) c
else
missChance -= pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE);


// Limit miss chance from 0 to 60%
if (missChance < 0.0f)
return 0.0f;
Expand Down