Skip to content

Instantly share code, notes, and snippets.

@dagochen
Created September 4, 2016 07:19
Show Gist options
  • Save dagochen/d0000eb18e2a1c110b3ef75241d7385f to your computer and use it in GitHub Desktop.
Save dagochen/d0000eb18e2a1c110b3ef75241d7385f to your computer and use it in GitHub Desktop.
Parry
// parry chances
// check if attack comes from behind, nobody can parry or block if attacker is behind
if (!from_behind)
{
tmp = parry_chance - skillBonus;
// check if unit _can_ parry
if ((pVictim->GetTypeId() == TYPEID_PLAYER || !(((Creature*)pVictim)->GetCreatureInfo()->ExtraFlags & CREATURE_EXTRA_FLAG_NO_PARRY)) && 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