// attack method public static int attackRoll() { // int attack = DiceRoll.Random(1,7) + DiceRoll.Random(1,7); int res1 = DiceRoll.Random(1, 7); int res2 = DiceRoll.Random(1, 7); int attack = res1 + res2; Console.WriteLine(" dice rolls attack : {0}, {1} = sum {2}", res1, res2, attack); return(attack); }
// methods static private int RandomAbility() { // usando la clase InUtil creada int randomNumber = DiceRoll.Random(1, 21); // usando metodo random distinto var random = new Random((int)DateTime.Now.Ticks); var randomValue = random.Next(1, 21 + 1); return(randomNumber); }
// Combat method public static int Combat(Human p1, Human p2) { int ArmourPierce = DiceRoll.Random(1, 21); if (ArmourPierce > p2.Strength) { Console.WriteLine("Armour Pierce: {0}", ArmourPierce); int attack = attackRoll(); return(attack); } else { Console.WriteLine("********************** fails! {0} ************************************", ArmourPierce); return(0); } }