SHARE
TWEET

CalculateActualDamage_Matrix

a guest Jan 24th, 2020 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public int CalculateActualDamage(Creature target)
  2.         {
  3.             // create matrix(table) of multipliers based on the int values of the enums:
  4.             // each row is an AttackType and each collumn is Armortype
  5.             double[,] damageTable = // ... Double damage ;)
  6.             {
  7.                 { 1.25 , 1, 0.75 },
  8.                 { 1, 1.25, 0.75 },
  9.                 { 0.75, 1, 1.25}
  10.             };
  11.             // multiplier is determined by cross referencing the corresponding attack and armor types
  12.             double multiplier = damageTable[(int)this.AttackType, (int)target.ArmorType];
  13.             int actualDamage = (int)Math.Floor(this.Damage * multiplier);
  14.             return actualDamage;
  15.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top