Skip to content

Instantly share code, notes, and snippets.

@dagochen
Created September 4, 2016 07:25
Show Gist options
  • Save dagochen/3f8d25a4ec3ac9879ab167e445736022 to your computer and use it in GitHub Desktop.
Save dagochen/3f8d25a4ec3ac9879ab167e445736022 to your computer and use it in GitHub Desktop.
Parry 2.0
// parry chances
// check if attack comes from behind, nobody can parry or block if attacker is behind
if (!from_behind && (pVictim->GetTypeId() == TYPEID_PLAYER || !(((Creature*)pVictim)->GetCreatureInfo()->ExtraFlags & CREATURE_EXTRA_FLAG_NO_PARRY)))
{
tmp = parry_chance - skillBonus;
// check if unit _can_ parry
if (roll < (sum += tmp))
{
DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "RollMeleeOutcomeAgainst: PARRY %d)", tmp);
return MELEE_HIT_PARRY;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment