Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public int CalculateActualDamage(Creature target)
- {
- // create matrix(table) of multipliers based on the int values of the enums:
- // each row is an AttackType and each collumn is Armortype
- double[,] damageTable = // ... Double damage ;)
- {
- { 1.25 , 1, 0.75 },
- { 1, 1.25, 0.75 },
- { 0.75, 1, 1.25}
- };
- // multiplier is determined by cross referencing the corresponding attack and armor types
- double multiplier = damageTable[(int)this.AttackType, (int)target.ArmorType];
- int actualDamage = (int)Math.Floor(this.Damage * multiplier);
- return actualDamage;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement