mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
[10707] Move Glancing Blow early in melee outcome results.
Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
262b3ce1ff
commit
11f13e10bd
2 changed files with 35 additions and 34 deletions
|
|
@ -2579,14 +2579,15 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack
|
|||
return MELEE_HIT_CRIT;
|
||||
}
|
||||
|
||||
bool from_behind = !pVictim->HasInArc(M_PI_F,this);
|
||||
|
||||
if (from_behind)
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "RollMeleeOutcomeAgainst: attack came from behind.");
|
||||
|
||||
// Dodge chance
|
||||
|
||||
// only players can't dodge if attacker is behind
|
||||
if (pVictim->GetTypeId() == TYPEID_PLAYER && !pVictim->HasInArc(M_PI_F,this))
|
||||
{
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "RollMeleeOutcomeAgainst: attack came from behind and victim was a player.");
|
||||
}
|
||||
else
|
||||
if (pVictim->GetTypeId() != TYPEID_PLAYER || !from_behind)
|
||||
{
|
||||
// Reduce dodge chance by attacker expertise rating
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
|
|
@ -2607,14 +2608,9 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack
|
|||
}
|
||||
}
|
||||
|
||||
// parry & block chances
|
||||
|
||||
// parry chances
|
||||
// check if attack comes from behind, nobody can parry or block if attacker is behind
|
||||
if (!pVictim->HasInArc(M_PI_F,this))
|
||||
{
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "RollMeleeOutcomeAgainst: attack came from behind.");
|
||||
}
|
||||
else
|
||||
if (!from_behind)
|
||||
{
|
||||
// Reduce parry chance by attacker expertise rating
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
|
|
@ -2633,27 +2629,6 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack
|
|||
return MELEE_HIT_PARRY;
|
||||
}
|
||||
}
|
||||
|
||||
if(pVictim->GetTypeId()==TYPEID_PLAYER || !(((Creature*)pVictim)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK) )
|
||||
{
|
||||
tmp = block_chance;
|
||||
if ( (tmp > 0) // check if unit _can_ block
|
||||
&& ((tmp -= skillBonus) > 0)
|
||||
&& (roll < (sum += tmp)))
|
||||
{
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "RollMeleeOutcomeAgainst: BLOCK <%d, %d)", sum-tmp, sum);
|
||||
return MELEE_HIT_BLOCK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Critical chance
|
||||
tmp = crit_chance;
|
||||
|
||||
if (tmp > 0 && roll < (sum += tmp))
|
||||
{
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "RollMeleeOutcomeAgainst: CRIT <%d, %d)", sum-tmp, sum);
|
||||
return MELEE_HIT_CRIT;
|
||||
}
|
||||
|
||||
// Max 40% chance to score a glancing blow against mobs that are higher level (can do only players and pets and not with ranged weapon)
|
||||
|
|
@ -2676,6 +2651,32 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack
|
|||
}
|
||||
}
|
||||
|
||||
// block chances
|
||||
// check if attack comes from behind, nobody can parry or block if attacker is behind
|
||||
if (!from_behind)
|
||||
{
|
||||
if(pVictim->GetTypeId()==TYPEID_PLAYER || !(((Creature*)pVictim)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK) )
|
||||
{
|
||||
tmp = block_chance;
|
||||
if ( (tmp > 0) // check if unit _can_ block
|
||||
&& ((tmp -= skillBonus) > 0)
|
||||
&& (roll < (sum += tmp)))
|
||||
{
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "RollMeleeOutcomeAgainst: BLOCK <%d, %d)", sum-tmp, sum);
|
||||
return MELEE_HIT_BLOCK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Critical chance
|
||||
tmp = crit_chance;
|
||||
|
||||
if (tmp > 0 && roll < (sum += tmp))
|
||||
{
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "RollMeleeOutcomeAgainst: CRIT <%d, %d)", sum-tmp, sum);
|
||||
return MELEE_HIT_CRIT;
|
||||
}
|
||||
|
||||
// mobs can score crushing blows if they're 4 or more levels above victim
|
||||
if (GetLevelForTarget(pVictim) >= pVictim->GetLevelForTarget(this) + 4 &&
|
||||
// can be from by creature (if can) or from controlled player that considered as creature
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue