// Constructor(s) public Weapon(Ship ship, int method, int itemLevel) : base(Item.Nothing, ItemType.weapon, TextureManager.weapons[1], "", "Weapon") { if (itemLevel != -1) { this.Damage = Globals.Randomizer.Next(10 + itemLevel * 5, 20 + itemLevel * 5); this.ShieldPiercing = (float)Math.Round(MathHelper.Lerp(0, 0.15f, (float)Globals.Randomizer.NextDouble()), 2); this.Chance = Globals.Randomizer.Next(20 + itemLevel * 2, 30 + itemLevel * 2); } else { this.Damage = 14; this.ShieldPiercing = 0.1f; this.Chance = 23; } this.Depth = 0.5f; this.ShotsToShoot = new List<Shot>(); this.method = method; this.ItemLevel = itemLevel; this.TextureBackground = TextureManager.weapons[0]; Method = ListOfMethods()[method]; // Initialize weapon Method(ship, this, 0, null, true); // Description LoadDescriptions(); }
public static void HitCrit(Ship ship, Level level, Shot shot) { if (Globals.Randomizer.Next(0, 101) < shot.Chance) { ship.TakeDamage(shot.Damage * 2, shot.ShieldPiercing, DamageType.laser); level.CombatText("CRIT!"); } else { ship.TakeDamage(shot.Damage, shot.ShieldPiercing, DamageType.laser); } }
// Constructor(s) public Hull(Ship ship, int method, int itemLevel) : base(Item.Nothing, ItemType.hull, TextureManager.hulls[Globals.Randomizer.Next(0, TextureManager.hulls.Count)], "", "Hull") { this.Type = ItemType.hull; this.ItemLevel = itemLevel; // Method variables RockResistance = 1; this.TileChance = new List<TileType>(); for (int i = 0; i < Enum.GetNames(typeof(TileType)).Length; i++) { for (int j = 0; j < 20; j++) { TileChance.Add((TileType)i); } } if (itemLevel != -1) { this.Armor = Globals.Randomizer.Next(5 + itemLevel * 3, 10 + itemLevel * 4); } else { this.Armor = 7; } this.Method = ListOfHullMethods()[method]; Method(ship, this); this.Descriptions = new List<string>(); Descriptions.Add("A standard hull."); Descriptions.Add("Rocks deals half damage."); Descriptions.Add("Increase |255, 70, 0|weapon chance|W| by " + WeaponChance + "%"); Descriptions.Add("Increase the chance of cog tiles appearing by 100%"); Descriptions.Add("Increase the chance of shield tiles appearing by 100%"); Descriptions.Add("Increase the chance of weapon tiles appearing by 75%"); Descriptions.Add("Flash a random possible tilematch when there has been no match for a few seconds."); Descriptions.Add("Increases the accuracy of some weapons."); this.Description = "|W|Armor: |255,255,0|" + Armor + "|W|\n" + Descriptions[method]; }
// Constructor(s) public Hull(Ship ship) : base() { // Method variables RockResistance = 1; this.Texture = TextureManager.hulls[Globals.Randomizer.Next(0, TextureManager.hulls.Count)]; this.Armor = Globals.Randomizer.Next(5, 10); this.HullMethods = new List<HullMethod>(); HullMethods.Add(HullStandard); HullMethods.Add(HullRockResist); HullMethods.Add(HullWeaponChance); this.Method = Globals.Randomizer.Next(0, HullMethods.Count); HullMethods[Method](ship); this.Description = new List<string>(); Description.Add("A standard hull."); Description.Add("Rocks deals half damage."); Description.Add("Increase |255, 70, 0|weapon chance|W| by " + WeaponChance + "%"); }
public static void FireBossX(Ship shooter, Weapon weapon, int tilesMatched, Level level, bool initialize) { Boss boss = (Boss)shooter; float directionRight = (float)Math.Atan2(level.Player.Position.Y - boss.RightShootPosition.Y, (int)boss.ShipLocation * 100 + 100 - boss.RightShootPosition.X); float directionLeft = (float)Math.Atan2(level.Player.Position.Y - boss.LeftShootPosition.Y, (int)boss.ShipLocation * 100 + 300 - boss.LeftShootPosition.X); if (!initialize) { for (int i = 0; i < 10; i++) { weapon.ShotsToShoot.Add(new Shot(boss.RightShootPosition, directionRight, 5, Shot.HitBasic, shooter.Targets, 0, 0)); weapon.ShotsToShoot.Add(new Shot(boss.LeftShootPosition, directionLeft, 5, Shot.HitBasic, shooter.Targets, 0, 0)); } } }
public static void FireDamageOverTime(Ship shooter, Weapon weapon, int tilesMatched, Level level, bool initialize) { if (!initialize) { level.ToAdd.Add(new Shot(shooter.Position, shooter.Direction, weapon.ShotDamage(tilesMatched, shooter), Shot.HitDamageOverTime, shooter.Targets, weapon.ShieldPiercing, weapon.WeaponChance(shooter))); } else { weapon.Damage -= 2; } }
public static void HitBasic(Ship ship, Level level, Shot shot) { ship.TakeDamage(shot.Damage, shot.ShieldPiercing, DamageType.laser); }
public static void HullTileShieldChance(Ship ship, Hull hull) { for (int i = 0; i < 20; i++) { hull.TileChance.Add(TileType.shield); } }
public static void HullWeaponChance(Ship ship, Hull hull) { hull.WeaponChance = Globals.Randomizer.Next(10, 21); }
public static void HullFlashPossibleTiles(Ship ship, Hull hull) { hull.FlashPossibleTiles = true; }
public static void HullRockResist(Ship ship, Hull hull) { hull.RockResistance = 0.5f; }
public static void FireMovingShot(Ship shooter, Weapon weapon, int tilesMatched, Level level, bool initialize) { if (!initialize) { level.ToAdd.Add(new Shot(shooter.Position, shooter.Direction, weapon.ShotDamage(tilesMatched, shooter), Shot.HitBasic, shooter.Targets, weapon.ShieldPiercing, weapon.WeaponChance(shooter))); int random = Globals.Randomizer.Next(0, 101); if (random < weapon.WeaponChance(shooter) / 2) { if ((int)shooter.ShipLocation < 2) { shooter.ShipLocation++; } } else if (random < weapon.WeaponChance(shooter)) { if ((int)shooter.ShipLocation > 0) { shooter.ShipLocation--; } } } }
public static void FireRandom(Ship shooter, Weapon weapon, int tilesMatched, Level level, bool initialize) { if (!initialize) { level.ToAdd.Add(new Shot(shooter.Position, shooter.Direction, weapon.ShotDamage(tilesMatched, shooter), Shot.UpdateRandom, shooter.Targets, weapon.ShieldPiercing, weapon.WeaponChance(shooter))); } else { weapon.Damage = (int)(weapon.Damage * 1.5f); } }
public static void FireChanceToBreak(Ship shooter, Weapon weapon, int tilesMatched, Level level, bool initialize) { if (!initialize) { if (Globals.Randomizer.Next(0, 101) < 100 - weapon.WeaponChance(shooter)) { weapon.Disabled = 180; shooter.TakeDamage(weapon.Damage / 2, weapon.ShieldPiercing, DamageType.laser, false); } level.ToAdd.Add(new Shot(shooter.Position, shooter.Direction, weapon.ShotDamage(tilesMatched, shooter), Shot.HitBasic, shooter.Targets, weapon.ShieldPiercing, weapon.WeaponChance(shooter))); } else { weapon.Chance += Globals.Randomizer.Next(30, 50); weapon.Damage += Globals.Randomizer.Next(5, 7); } }
public static void FireMatchFourExtraShot(Ship shooter, Weapon weapon, int tilesMatched, Level level, bool initialize) { if (!initialize) { level.ToAdd.Add(new Shot(shooter.Position, shooter.Direction, weapon.ShotDamage(tilesMatched, shooter), Shot.HitBasic, shooter.Targets, weapon.ShieldPiercing, weapon.WeaponChance(shooter))); if (tilesMatched > 3) { weapon.ShotsToShoot.Add(new Shot(shooter.Position, shooter.Direction, weapon.ShotDamage(tilesMatched, shooter), Shot.HitBasic, shooter.Targets, weapon.ShieldPiercing, weapon.WeaponChance(shooter))); } } }
public static void FireIncreasingChanceOfTwo(Ship shooter, Weapon weapon, int tilesMatched, Level level, bool initialize) { if (!initialize) { if (Globals.Randomizer.Next(0, 101) < weapon.WeaponChance(shooter)) { weapon.ShotsToShoot.Add(new Shot(shooter.Position, shooter.Direction, weapon.ShotDamage(tilesMatched, shooter), Shot.HitBasic, shooter.Targets, weapon.ShieldPiercing, weapon.WeaponChance(shooter))); weapon.Chance = 0; } level.ToAdd.Add(new Shot(shooter.Position, shooter.Direction, weapon.ShotDamage(tilesMatched, shooter), Shot.HitBasic, shooter.Targets, weapon.ShieldPiercing, weapon.WeaponChance(shooter))); weapon.Chance += 15; } }
public static void FireExtraDamageCollideShot(Ship shooter, Weapon weapon, int tilesMatched, Level level, bool initialize) { if (!initialize) { level.ToAdd.Add(new Shot(shooter.Position, shooter.Direction, weapon.ShotDamage(tilesMatched, shooter), Shot.UpdateExtraDamageCollideShot, shooter.Targets, weapon.ShieldPiercing, weapon.WeaponChance(shooter))); } }
public static void FireEveryOther(Ship shooter, Weapon weapon, int tilesMatched, Level level, bool initialize) { if (!initialize) { if (weapon.WeaponChance(shooter) == 100) { weapon.Chance = 0; level.ToAdd.Add(new Shot(shooter.Position, shooter.Direction, weapon.ShotDamage(tilesMatched, shooter), Shot.HitBasic, shooter.Targets, weapon.ShieldPiercing, weapon.Chance)); } else { shooter.KnockBack = 0; weapon.Chance = 100; } } else { weapon.Chance = 0; weapon.Damage = weapon.Damage * 2 + weapon.Damage / 4; } }
public static void HitDamageOverTime(Ship ship, Level level, Shot shot) { ship.TakeDamage(shot.Damage, shot.ShieldPiercing, DamageType.laser); ship.SetDamageOverTime(shot.Damage / 6, 6, shot.ShieldPiercing); }
public static void FireScattered(Ship shooter, Weapon weapon, int tilesMatched, Level level, bool initialize) { if (!initialize) { for (int i = 0; i < Globals.Randomizer.Next(3, 6); i++) { weapon.ShotsToShoot.Add(new Shot(shooter.Position, shooter.Direction + MathHelper.Lerp(-0.5f + shooter.ShipHull.WeaponAccuracy, 0.5f - shooter.ShipHull.WeaponAccuracy, (float)Globals.Randomizer.NextDouble()), weapon.ShotDamage(tilesMatched, shooter), Shot.HitBasic, shooter.Targets, weapon.ShieldPiercing, weapon.WeaponChance(shooter))); } } else { weapon.Damage /= 3; } }
public static void HitEnemyShotDelay(Ship ship, Level level, Shot shot) { ship.TakeDamage(shot.Damage, shot.ShieldPiercing, DamageType.laser); if (Globals.Randomizer.Next(0, 101) < shot.Chance) { ship.Weapons[Globals.Randomizer.Next(0, ship.Weapons.Count)].Disabled = 120; level.CombatText(ship.GetType().Name + " Weapon Jammed!"); } }
public static void FireThreeShots(Ship shooter, Weapon weapon, int tilesMatched, Level level, bool initialize) { if (!initialize) { level.ToAdd.Add(new Shot(shooter.Position, shooter.Direction, weapon.ShotDamage(tilesMatched, shooter) / 3, Shot.HitBasic, shooter.Targets, weapon.ShieldPiercing, weapon.WeaponChance(shooter))); for (int i = 0; i < 2; i++) { weapon.ShotsToShoot.Add(new Shot(shooter.Position, shooter.Direction, weapon.ShotDamage(tilesMatched, shooter) / 3, Shot.HitBasic, shooter.Targets, weapon.ShieldPiercing, weapon.WeaponChance(shooter))); } } }
public static void HullIncreaseWeaponAccuracy(Ship ship, Hull hull) { hull.WeaponAccuracy += 0.25f; }
public static void FireBoomerang(Ship shooter, Weapon weapon, int tilesMatched, Level level, bool initialize) { if (!initialize) { level.ToAdd.Add(new Shot(shooter.Position, shooter.Direction, weapon.ShotDamage(tilesMatched, shooter), Shot.UpdateBoomerang, shooter.Targets, weapon.ShieldPiercing, weapon.WeaponChance(shooter))); } else { weapon.Damage += Globals.Randomizer.Next(5, 10); } }
public static void HullStandard(Ship ship, Hull hull) { }
public int ShotDamage(int tilesMatched, Ship shooter) { if (tilesMatched < 3) { tilesMatched = 3; } return Damage + (tilesMatched - 3) * (Damage / 3) + shooter.BonusDamageOneFight + shooter.BonusDamage; }
public static void HullTileShootChance(Ship ship, Hull hull) { for (int i = 0; i < 15; i++) { hull.TileChance.Add(TileType.shoot); } }
public int WeaponChance(Ship shooter) { return Chance + shooter.ShipHull.WeaponChance; }
public static void FireTwoInV(Ship shooter, Weapon weapon, int tilesMatched, Level level, bool initialize) { if (!initialize) { level.ToAdd.Add(new Shot(shooter.Position, shooter.Direction + 0.2f, weapon.ShotDamage(tilesMatched, shooter), Shot.HitBasic, shooter.Targets, weapon.ShieldPiercing, weapon.WeaponChance(shooter))); level.ToAdd.Add(new Shot(shooter.Position, shooter.Direction - 0.2f, weapon.ShotDamage(tilesMatched, shooter), Shot.HitBasic, shooter.Targets, weapon.ShieldPiercing, weapon.WeaponChance(shooter))); } }
public static void FireChanceToMiss(Ship shooter, Weapon weapon, int tilesMatched, Level level, bool initialize) { if (!initialize) { float miss = 0; if (Globals.Randomizer.Next(0, 101) > weapon.WeaponChance(shooter)) { miss = MathHelper.Lerp(-0.5f + shooter.ShipHull.WeaponAccuracy, 0.5f - shooter.ShipHull.WeaponAccuracy, (float)Globals.Randomizer.NextDouble()); } level.ToAdd.Add(new Shot(shooter.Position, shooter.Direction + miss, weapon.ShotDamage(tilesMatched, shooter), Shot.HitBasic, shooter.Targets, weapon.ShieldPiercing, weapon.WeaponChance(shooter))); } else { weapon.Damage += 7; weapon.Chance = 60; } }