mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-25 06:36:24 +00:00
New hooks OnAfterUpdateMaxPower and OnBeforeRollMeleeOutcomeAgainst
This commit is contained in:
@@ -2184,13 +2184,15 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit* victim, WeaponAttackTy
|
||||
float parry_chance = victim->GetUnitParryChance();
|
||||
|
||||
// Useful if want to specify crit & miss chances for melee, else it could be removed
|
||||
;//sLog->outStaticDebug("MELEE OUTCOME: miss %f crit %f dodge %f parry %f block %f", miss_chance, crit_chance, dodge_chance, parry_chance, block_chance);
|
||||
//sLog->outStaticDebug("MELEE OUTCOME: miss %f crit %f dodge %f parry %f block %f", miss_chance, crit_chance, dodge_chance, parry_chance, block_chance);
|
||||
|
||||
return RollMeleeOutcomeAgainst(victim, attType, int32(crit_chance*100), int32(miss_chance*100), int32(dodge_chance*100), int32(parry_chance*100), int32(block_chance*100));
|
||||
return RollMeleeOutcomeAgainst(victim, attType, int32(crit_chance * 100), int32(miss_chance * 100), int32(dodge_chance * 100), int32(parry_chance * 100), int32(block_chance * 100));
|
||||
}
|
||||
|
||||
MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackType attType, int32 crit_chance, int32 miss_chance, int32 dodge_chance, int32 parry_chance, int32 block_chance) const
|
||||
MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit* victim, WeaponAttackType attType, int32 crit_chance, int32 miss_chance, int32 dodge_chance, int32 parry_chance, int32 block_chance) const
|
||||
{
|
||||
sScriptMgr->OnBeforeRollMeleeOutcomeAgainst(this, victim, attType, crit_chance, miss_chance, dodge_chance, parry_chance, block_chance);
|
||||
|
||||
if (victim->GetTypeId() == TYPEID_UNIT && victim->ToCreature()->IsInEvadeMode())
|
||||
return MELEE_HIT_EVADE;
|
||||
|
||||
@@ -2205,15 +2207,15 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT
|
||||
int32 sum = 0, tmp = 0;
|
||||
int32 roll = urand (0, 10000);
|
||||
|
||||
;//sLog->outStaticDebug ("RollMeleeOutcomeAgainst: skill bonus of %d for attacker", skillBonus);
|
||||
;//sLog->outStaticDebug ("RollMeleeOutcomeAgainst: rolled %d, miss %d, dodge %d, parry %d, block %d, crit %d",
|
||||
//sLog->outStaticDebug ("RollMeleeOutcomeAgainst: skill bonus of %d for attacker", skillBonus);
|
||||
//sLog->outStaticDebug ("RollMeleeOutcomeAgainst: rolled %d, miss %d, dodge %d, parry %d, block %d, crit %d",
|
||||
// roll, miss_chance, dodge_chance, parry_chance, block_chance, crit_chance);
|
||||
|
||||
tmp = miss_chance;
|
||||
|
||||
if (tmp > 0 && roll < (sum += tmp))
|
||||
{
|
||||
;//sLog->outStaticDebug ("RollMeleeOutcomeAgainst: MISS");
|
||||
//sLog->outStaticDebug ("RollMeleeOutcomeAgainst: MISS");
|
||||
return MELEE_HIT_MISS;
|
||||
}
|
||||
|
||||
@@ -2229,7 +2231,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT
|
||||
// only players can't dodge if attacker is behind
|
||||
if (victim->GetTypeId() == TYPEID_PLAYER && !victim->HasInArc(M_PI, this) && !victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION))
|
||||
{
|
||||
;//sLog->outStaticDebug ("RollMeleeOutcomeAgainst: attack came from behind and victim was a player.");
|
||||
//sLog->outStaticDebug ("RollMeleeOutcomeAgainst: attack came from behind and victim was a player.");
|
||||
}
|
||||
// Xinef: do not allow to dodge with CREATURE_FLAG_EXTRA_NO_DODGE flag
|
||||
else if (victim->GetTypeId() == TYPEID_PLAYER || !(victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_DODGE))
|
||||
|
||||
Reference in New Issue
Block a user