public void GivenTheTargetIsWearing(string p0) { //Helmet? Armor toWear = Armor.getHelmet(p0); if (!(toWear is null)) { helmet = toWear; }
public static void testAllCases(int[] ODDS_ARRAY) { Random rand = new Random(); String docPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); using (StreamWriter outputFile = new StreamWriter(Path.Combine(docPath, "Output.txt"))) { List <Armor> helmets = new List <Armor>(); helmets.Add(new Armor()); //nothing helmets.Add(Armor.getHelmet("Kolpak-1S")); helmets.Add(Armor.getHelmet("6B47 Ratnik")); helmets.Add(Armor.getHelmet("Fast MT SUPER HIGH CUT")); helmets.Add(Armor.getHelmet("Altyn helmet")); helmets.Add(Armor.getVisor("Altyn face shield")); helmets.Add(Armor.getHelmet("Vulkan-5")); helmets.Add(Armor.getVisor("Maska 1Sch face shield")); List <Armor> bodyArmors = new List <Armor>(); bodyArmors.Add(new Armor()); //also nothing bodyArmors.Add(Armor.getBodyArmor("PACA")); bodyArmors.Add(Armor.getBodyArmor("UNTAR")); bodyArmors.Add(Armor.getBodyArmor("Kirasa")); bodyArmors.Add(Armor.getBodyArmor("Trooper")); bodyArmors.Add(Armor.getBodyArmor("6B23-2")); bodyArmors.Add(Armor.getBodyArmor("Korund")); bodyArmors.Add(Armor.getBodyArmor("Redut-T5")); bodyArmors.Add(Armor.getBodyArmor("Hexgrid")); bodyArmors.Add(Armor.getBodyArmor("Zabralo-Sh")); List <Bullet> bullets = Bullet.getAllBullets(); //TODO, use json to pull all these numbers out into factory class foreach (Bullet bullet in bullets) { foreach (Armor helmet in helmets) { foreach (Armor bodyArmor in bodyArmors) { int count = 0; for (int i = 0; i < 1000; i++) { Body body = new Body(helmet, bodyArmor); while (!body.isDead()) { body.takeDamage(bullet, randomRegion(ODDS_ARRAY, rand), rand); count++; } } Console.Write(bullet.Name); outputFile.Write(bullet.Name); Console.Write("|"); outputFile.Write("|"); Console.Write(helmet.Name); outputFile.Write(helmet.Name); Console.Write("|"); outputFile.Write("|"); Console.Write(bodyArmor.Name); outputFile.Write(bodyArmor.Name); Console.Write("|"); outputFile.Write("|"); Console.WriteLine(count / 1000f); outputFile.WriteLine(count / 1000f); } } } } Console.ReadLine(); }