public UFO(Game game, UFOModel ufoModel, Vector2 position, int strength) : base(game) { this.ufoModel = ufoModel; SetXY((int)position.X, (int)position.Y); this.strength = strength; timeSinceLastShot = TimeSpan.FromMilliseconds(1000 + RandomManager.Instance.Next(500)); int factor = 30; switch (InvasionGame.Scoreboard.DifficultyLevel) { case DifficultyLevel.Easy: factor = 50; break; case DifficultyLevel.Medium: factor = 35; break; case DifficultyLevel.Hard: factor = 30; break; } switch (ufoModel) { case UFOModel.SilverUFO: msDelayShoot = 100*factor; break; case UFOModel.OrangeUFO: msDelayShoot = 10*factor; break; case UFOModel.RedUFO: msDelayShoot = 70*factor; break; } extraType = SelectExtra(); }
public Extra.ExtraType SelectExtra() { int random = RandomManager.Instance.Next(150); // Original Invasion Game Chances: 32% (48/150) of UFOs have extras int weaponsBonusChances = 3; // original game didn't allow 2 consecutive Weapons bonuses; this version does int pointsBonusChances = 10; int photonAmmoBonusChances = 14; int laserAmmoBonusChances = 19; int shieldBonusChances = 2; switch (InvasionGame.Scoreboard.DifficultyLevel) { case DifficultyLevel.Easy: // 42% (63/150) of UFOs have extras weaponsBonusChances = 6; pointsBonusChances = 13; photonAmmoBonusChances = 16; laserAmmoBonusChances = 22; shieldBonusChances = 6; break; case DifficultyLevel.Medium: // 36% (54/150) of UFOs have extras weaponsBonusChances = 4; pointsBonusChances = 11; photonAmmoBonusChances = 15; laserAmmoBonusChances = 20; shieldBonusChances = 4; break; case DifficultyLevel.Hard: // 30% (45/150) of UFOs have extras weaponsBonusChances = 3; pointsBonusChances = 10; photonAmmoBonusChances = 12; laserAmmoBonusChances = 17; shieldBonusChances = 3; break; } Extra.ExtraType extraType = Extra.ExtraType.NotSet; int slot = 0; if (random < (slot += weaponsBonusChances)) { extraType = Extra.ExtraType.Weapons; } else if (random < (slot += pointsBonusChances)) { extraType = Extra.ExtraType.Hundred; } else if (random < (slot += photonAmmoBonusChances)) { extraType = Extra.ExtraType.PhotonAmmo; } else if (random < (slot += laserAmmoBonusChances)) { extraType = Extra.ExtraType.BlasterAmmo; } else if (random < (slot += shieldBonusChances)) { extraType = Extra.ExtraType.Shield; } Debug.WriteLine("UFO ExtraType: " + extraType); return extraType; }