public void generateLoot(Field f) { Random r = new Random(); int generatedValue = randomGenerator.Next(5); if (generatedValue == 0) { f.placeObject(new Ammo() { Bullets = randomGenerator.Next(5) + 1, Grenades = 1 }); } else if (generatedValue == 1) { f.placeObject(new MedKit() { Health = randomGenerator.Next(8) + 3 }); } else if (generatedValue == 2) { f.placeObject(new Weapon() { Damage = randomGenerator.Next(10) + 1 }); } else if (generatedValue == 3) { f.placeObject(new RangedWeapon() { Damage = randomGenerator.Next(10) + 1, Range = randomGenerator.Next(10) + 1, Chance = randomGenerator.NextDouble() }); } else { f.placeObject(new GrenadeWeapon() { Damage = randomGenerator.Next(10) + 5, Range = randomGenerator.Next(10) + 1, Spread = randomGenerator.Next(3)+1, Ammo = 1 + randomGenerator.Next(3) }); } }
public void generateLoot(Field f) { Random r = new Random(); int generatedValue = randomGenerator.Next(23); if (0 <= generatedValue && generatedValue <= 3) { int spread = randomGenerator.Next(4) + 1; f.placeObject(new GrenadeWeapon() { Damage = randomGenerator.Next(9) + 5, Range = 1 + randomGenerator.Next(9) + spread, Spread = spread, Ammo = 1 + randomGenerator.Next(3) }); } else if (4 <= generatedValue && generatedValue <= 7) { MeleeWeapon w = new MeleeWeapon() { Damage = randomGenerator.Next(10) + 1 }; w.BrokeChance = (double)(1 + w.Damage/5 + r.Next(4)) / 100; f.placeObject(w); } else if (8 <= generatedValue && generatedValue <= 11) { f.placeObject(new RangedWeapon() { Damage = randomGenerator.Next(10) + 1, Range = randomGenerator.Next(10) + 1, Chance = 0.1 + 0.9*randomGenerator.NextDouble(), Ammo = 10 + r.Next(15) }); } else if (12 <= generatedValue && generatedValue <= 16) { f.placeObject(new Ammo() { Bullets = randomGenerator.Next(8) + 4, Grenades = randomGenerator.Next(3) }); } else if (17 <= generatedValue && generatedValue <= 22) { f.placeObject(new MedKit() { Health = randomGenerator.Next(8) + 3 }); } else { } }
public void generateLoot(Field f) { Random r = new Random(); int generatedValue = randomGenerator.Next(23); if (0 <= generatedValue && generatedValue <= 3) { int spread = randomGenerator.Next(4) + 1; f.placeObject(new GrenadeWeapon() { Damage = randomGenerator.Next(9) + 5, Range = 1 + randomGenerator.Next(9) + spread, Spread = spread, Ammo = 1 + randomGenerator.Next(3) }); } else if (4 <= generatedValue && generatedValue <= 7) { MeleeWeapon w = new MeleeWeapon() { Damage = randomGenerator.Next(10) + 1 }; w.BrokeChance = (double)(1 + w.Damage / 5 + r.Next(4)) / 100; f.placeObject(w); } else if (8 <= generatedValue && generatedValue <= 11) { f.placeObject(new RangedWeapon() { Damage = randomGenerator.Next(10) + 1, Range = randomGenerator.Next(10) + 1, Chance = 0.1 + 0.9 * randomGenerator.NextDouble(), Ammo = 10 + r.Next(15) }); } else if (12 <= generatedValue && generatedValue <= 16) { f.placeObject(new Ammo() { Bullets = randomGenerator.Next(8) + 4, Grenades = randomGenerator.Next(3) }); } else if (17 <= generatedValue && generatedValue <= 22) { f.placeObject(new MedKit() { Health = randomGenerator.Next(8) + 3 }); } else { } }
public void generateLoot(Field f) { Random r = new Random(); int generatedValue = randomGenerator.Next(5); if (generatedValue == 0) { f.placeObject(new Ammo() { Bullets = randomGenerator.Next(5) + 1, Grenades = 1 }); } else if (generatedValue == 1) { f.placeObject(new MedKit() { Health = randomGenerator.Next(8) + 3 }); } else if (generatedValue == 2) { f.placeObject(new Weapon() { Damage = randomGenerator.Next(10) + 1 }); } else if (generatedValue == 3) { f.placeObject(new RangedWeapon() { Damage = randomGenerator.Next(10) + 1, Range = randomGenerator.Next(10) + 1, Chance = randomGenerator.NextDouble() }); } else { f.placeObject(new GrenadeWeapon() { Damage = randomGenerator.Next(10) + 5, Range = randomGenerator.Next(10) + 1, Spread = randomGenerator.Next(3) + 1, Ammo = 1 + randomGenerator.Next(3) }); } }