Advertisement
Guest User

CalculateActualDamage_Matrix

a guest
Jan 24th, 2020
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.72 KB | None | 0 0
  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.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement