Example #1
0
        public Boss()
            : base(Difficulty.Hard)
        {
            this.TextureBackground = TextureManager.boss;
            this.Texture = TextureManager.bossForeground;
            this.charge = ChargeState.NotCharging;
            this.dodge = DodgeState.NotDodging;
            this.Depth = 0.5f;
            this.Opacity = 0f;
            this.possibleAttacks = new List<int>();
            this.EngineAnimation = TextureManager.bossEngineAnimation;
            this.MaxFrame = 3;
            this.FrameWidth = 163;
            this.FrameHeight = 139;
            this.Colour = Color.Red;

            // Modules
            this.Health = new Bar(new Vector2(70, 10), 200, 25, 150, Color.Red);
            ShipShield = new Shield(new Vector2(270, 10), (int)ShipShield.Width, 20, 0, 0, 3);
            ShipShield.Description = "|W|Shield: |0,0,255|" + ShipShield.MaxValue + "|W|\nWill teleport to another location just before being hit.";
            ShipHull = new Hull(this, 0, 3);
            ShipHull.Description = "|W|Armor: |255,255,0|" + ShipHull.Armor + "|255,255,100|\nPlaces mines on tiles in the tileboard.\nThe Player will take 20 damage when matching tiles with mines.\nMines will be disarmed when matched or then falling.";
            Weapons[0].Description = "|W|Charges forward and deals massive damage if it hits the Player.\nThe Boss is vurnerable when charging.";
            Weapons[1].Description = "|W|Shoot several shots, eighter in a X pattern or a V patterns.";
            Weapons[1].Method = Weapon.ListOfMethods()[0];
        }
Example #2
0
        public void Initialize(Player player)
        {
            if (EnemyDifficulty != Difficulty.Boss)
            {
                SoundManager.ChangeMusic(SoundManager.combat);
            }
            else
            {
                SoundManager.ChangeMusic(SoundManager.boss);
            }
            Started = false;
            if (!Initialized)
            {
                GameObjects.Clear();
                GameObjects.Add(player);
                if (EnemyDifficulty != Difficulty.Boss)
                {
                    GameObjects.Add(new Enemy(EnemyDifficulty));
                }
                else
                {
                    GameObjects.Add(new Boss());
                }
                // Reward for defeating enemy
                for (int i = 0; i < Globals.Randomizer.Next(1, 3); i++)
                {
                    int random = Globals.Randomizer.Next(0, 3);
                    if (random == 0)
                    {
                        Rewards.Add(new Weapon(Player, Globals.Randomizer.Next(0, Weapon.ListOfMethods().Count()), (int)EnemyDifficulty));
                    }
                    else if (random == 1)
                    {
                        Rewards.Add(new Shield(new Vector2(200, Globals.ScreenSize.Y - 35), 100, 20, 60 + (int)EnemyDifficulty * 20 + Globals.Randomizer.Next(-5, 15), Globals.Randomizer.Next(0, Shield.ListOfShieldMethods().Count()), (int)EnemyDifficulty));
                    }
                    if (random == 2)
                    {
                        Rewards.Add(new Hull(Player, Globals.Randomizer.Next(0, Hull.ListOfHullMethods().Count()), (int)EnemyDifficulty));
                    }

                    // Consumable
                    if (Globals.Randomizer.Next(0, 101) < 55)
                    {
                        random = Globals.Randomizer.Next(0, 101);
                        if (random < 35)
                        {
                            Rewards.Add(new Item(Globals.Flee));
                        }
                        else
                        {
                            Rewards.Add(new Item(Globals.Heal));
                        }
                    }
                }
                InitializeTiles();
                Initialized = true;
            }
            else
            {
                GameObjects.RemoveAll(item => !(item is Enemy));
                GameObjects.Add(player);
            }
            Player.Position    += new Vector2(0, 70);
            Player.ShipLocation = Location.middle;
            Player.MoveLeft     = 0;
            Player.MoveRight    = 0;
            player.ShipShield.Change(player.ShipShield.MaxValue);
            player.Energy.Change(1000);
            SceneManager.mapScene.KilledPlayer = (Enemy)GameObjects.First(item => item is Enemy);
        }
Example #3
0
 public static void HullWeaponChance(Ship ship, Hull hull)
 {
     hull.WeaponChance = Globals.Randomizer.Next(10, 21);
 }
Example #4
0
 public static void HullTileShootChance(Ship ship, Hull hull)
 {
     for (int i = 0; i < 15; i++)
     {
         hull.TileChance.Add(TileType.shoot);
     }
 }
Example #5
0
 public static void HullTileShieldChance(Ship ship, Hull hull)
 {
     for (int i = 0; i < 20; i++)
     {
         hull.TileChance.Add(TileType.shield);
     }
 }
Example #6
0
 public static void HullStandard(Ship ship, Hull hull)
 {
 }
Example #7
0
 public static void HullRockResist(Ship ship, Hull hull)
 {
     hull.RockResistance = 0.5f;
 }
Example #8
0
 public static void HullIncreaseWeaponAccuracy(Ship ship, Hull hull)
 {
     hull.WeaponAccuracy += 0.25f;
 }
Example #9
0
 public static void HullFlashPossibleTiles(Ship ship, Hull hull)
 {
     hull.FlashPossibleTiles = true;
 }
Example #10
0
        public void UpdateInventory()
        {
            // Crafting
            if (currentlyCrafting > 0)
            {
                for (int i = 0; i < Globals.Randomizer.Next(5, 10); i++)
                {
                    SceneManager.GameObjects.Add(new Piece(new Vector2(864, 350), TextureManager.explosion, 90, 1.5f));
                }
            }

            craft.Update();
            currentlyCrafting--;
            if (CanCraft() && currentlyCrafting < 0)
            {
                if (craft.Press())
                {
                    currentlyCrafting = 60;
                    SoundManager.craft.Play();
                }
            }
            if (currentlyCrafting == 0)
            {
                SoundManager.explosion.Play();
                int itemLevel = (int)((Inventory[0, 6].ItemLevel + Inventory[1, 6].ItemLevel + Inventory[2, 6].ItemLevel) / 3 + MathHelper.Lerp(-0.2f, 0.2f, (float)Globals.Randomizer.NextDouble()));
                Inventory[0, 6] = new Item(Globals.Nothing);
                Inventory[1, 6] = new Item(Globals.Nothing);
                Inventory[2, 6] = new Item(Globals.Nothing);
                if (Inventory[3, 6].Type != ItemType.nothing)
                {
                    AddItem(Inventory[3, 6]);
                }
                int random = Globals.Randomizer.Next(0, 3);
                if (random == 0)
                {
                    Inventory[3, 6] = new Weapon(this, Globals.Randomizer.Next(0, Weapon.ListOfMethods().Count()), itemLevel);
                }
                else if (random == 1)
                {
                    Inventory[3, 6] = new Hull(this, Globals.Randomizer.Next(0, Hull.ListOfHullMethods().Count()), itemLevel);
                }
                else if (random == 2)
                {
                    Inventory[3, 6] = new Shield(new Vector2(200, Globals.ScreenSize.Y - 35), 100, 20, 60 + itemLevel * 20 + Globals.Randomizer.Next(-5, 15), Globals.Randomizer.Next(0, Shield.ListOfShieldMethods().Count()), itemLevel);
                }
            }

            for (int i = 0; i < Inventory.GetLength(0); i++)
            {
                for (int j = 0; j < Inventory.GetLength(1); j++)
                {
                    if (Inventory[i, j].Pressed() && Inventory[i, j].Type != ItemType.nothing)
                    {
                        selectedItem = Inventory[i, j];
                        selectedItemArrayPosition = new Point(i, j);
                    }

                    // Right click
                    if (Inventory[i, j].PressedRight() && Inventory[i, j].Type != ItemType.nothing)
                    {
                        Inventory[i, j].UseItem(this, Inventory[i, j]);
                    }
                }
            }

            if (Globals.MState.LeftButton == ButtonState.Released)
            {
                if (selectedItem != null)
                {
                    // Move item in inventory
                    for (int i = 0; i < Inventory.GetLength(0); i++)
                    {
                        for (int j = 0; j < Inventory.GetLength(1); j++)
                        {
                            if (Inventory[i, j].HoverOver())
                            {
                                if ((i == 0 && j == 5) || (selectedItemArrayPosition.X == 0 && selectedItemArrayPosition.Y == 5)) // shield
                                {
                                    if (selectedItem.Type == ItemType.shield && Inventory[i, j].Type == ItemType.shield)
                                    {
                                        SwapItem(new Point(i, j));
                                        break;
                                    }
                                }
                                else if ((i == 1 && j == 5) || (selectedItemArrayPosition.X == 1 && selectedItemArrayPosition.Y == 5)) // hull
                                {
                                    if (selectedItem.Type == ItemType.hull && Inventory[i, j].Type == ItemType.hull)
                                    {
                                        SwapItem(new Point(i, j));
                                        break;
                                    }
                                }
                                else if ((i > 1 && j == 5) || (selectedItemArrayPosition.X > 1 && selectedItemArrayPosition.Y == 5)) // weapons
                                {
                                    if ((((selectedItem.Type == ItemType.weapon || Inventory[i, j].Type == ItemType.weapon) && Inventory[i, j].Type == ItemType.nothing) && (Weapons.Count > 1 || !Weapons.Any(item => item == selectedItem)) || (selectedItem.Type == ItemType.weapon && Inventory[i, j].Type == ItemType.weapon)))
                                    {
                                        int numberOfWeapons = Weapons.Count();
                                        SwapItem(new Point(i, j));
                                        if (numberOfWeapons > Weapons.Count())
                                        {
                                            SelectedWeapon = 0;
                                        }
                                        break;
                                    }
                                }
                                else if (!(i > 2 && j == 6)) // inventory
                                {
                                    SwapItem(new Point(i, j));
                                    break;
                                }
                            }
                        }
                    }
                }

                selectedItem = null;
                selectedItemArrayPosition = new Point(0, 0);

                // remove
                for (int i = Inventory.GetLength(0) - 1; i >= 0; i--)
                {
                    for (int j = Inventory.GetLength(1) - 1; j >= 0; j--)
                    {
                        if (Inventory[i, j].Dead)
                        {
                            Inventory[i, j] = new Item(Item.Nothing, ItemType.nothing, TextureManager.none, "", "");
                        }
                    }
                }
            }
        }
Example #11
0
 public static void HullIncreaseWeaponAccuracy(Ship ship, Hull hull)
 {
     hull.WeaponAccuracy += 0.25f;
 }
Example #12
0
 public static void HullFlashPossibleTiles(Ship ship, Hull hull)
 {
     hull.FlashPossibleTiles = true;
 }
Example #13
0
 public static void HullWeaponChance(Ship ship, Hull hull)
 {
     hull.WeaponChance = Globals.Randomizer.Next(10, 21);
 }
Example #14
0
 public static void HullRockResist(Ship ship, Hull hull)
 {
     hull.RockResistance = 0.5f;
 }
Example #15
0
 public static void HullStandard(Ship ship, Hull hull)
 {
 }
Example #16
0
        public void UpdateInventory()
        {
            // Crafting
            if (currentlyCrafting > 0)
            {
                for (int i = 0; i < Globals.Randomizer.Next(5, 10); i++)
                {
                    SceneManager.GameObjects.Add(new Piece(new Vector2(864, 350), TextureManager.explosion, 90, 1.5f));
                }
            }

            craft.Update();
            currentlyCrafting--;
            if (CanCraft() && currentlyCrafting < 0)
            {
                if (craft.Press())
                {
                    currentlyCrafting = 60;
                    SoundManager.craft.Play();
                }
            }
            if (currentlyCrafting == 0)
            {
                SoundManager.explosion.Play();
                int itemLevel = (int)((Inventory[0, 6].ItemLevel + Inventory[1, 6].ItemLevel + Inventory[2, 6].ItemLevel) / 3 + MathHelper.Lerp(-0.2f, 0.2f, (float)Globals.Randomizer.NextDouble()));
                Inventory[0, 6] = new Item(Globals.Nothing);
                Inventory[1, 6] = new Item(Globals.Nothing);
                Inventory[2, 6] = new Item(Globals.Nothing);
                if (Inventory[3, 6].Type != ItemType.nothing)
                {
                    AddItem(Inventory[3, 6]);
                }
                int random = Globals.Randomizer.Next(0, 3);
                if (random == 0)
                {
                    Inventory[3, 6] = new Weapon(this, Globals.Randomizer.Next(0, Weapon.ListOfMethods().Count()), itemLevel);
                }
                else if (random == 1)
                {
                    Inventory[3, 6] = new Hull(this, Globals.Randomizer.Next(0, Hull.ListOfHullMethods().Count()), itemLevel);
                }
                else if (random == 2)
                {
                    Inventory[3, 6] = new Shield(new Vector2(200, Globals.ScreenSize.Y - 35), 100, 20, 60 + itemLevel * 20 + Globals.Randomizer.Next(-5, 15), Globals.Randomizer.Next(0, Shield.ListOfShieldMethods().Count()), itemLevel);
                }
            }

            for (int i = 0; i < Inventory.GetLength(0); i++)
            {
                for (int j = 0; j < Inventory.GetLength(1); j++)
                {
                    if (Inventory[i, j].Pressed() && Inventory[i, j].Type != ItemType.nothing)
                    {
                        selectedItem = Inventory[i, j];
                        selectedItemArrayPosition = new Point(i, j);
                    }

                    // Right click
                    if (Inventory[i, j].PressedRight() && Inventory[i, j].Type != ItemType.nothing)
                    {
                        Inventory[i, j].UseItem(this, Inventory[i, j]);
                    }
                }
            }

            if (Globals.MState.LeftButton == ButtonState.Released)
            {
                if (selectedItem != null)
                {
                    // Move item in inventory
                    for (int i = 0; i < Inventory.GetLength(0); i++)
                    {
                        for (int j = 0; j < Inventory.GetLength(1); j++)
                        {
                            if (Inventory[i, j].HoverOver())
                            {
                                if ((i == 0 && j == 5) || (selectedItemArrayPosition.X == 0 && selectedItemArrayPosition.Y == 5)) // shield
                                {
                                    if (selectedItem.Type == ItemType.shield && Inventory[i, j].Type == ItemType.shield)
                                    {
                                        SwapItem(new Point(i, j));
                                        break;
                                    }
                                }
                                else if ((i == 1 && j == 5) || (selectedItemArrayPosition.X == 1 && selectedItemArrayPosition.Y == 5)) // hull
                                {
                                    if (selectedItem.Type == ItemType.hull && Inventory[i, j].Type == ItemType.hull)
                                    {
                                        SwapItem(new Point(i, j));
                                        break;
                                    }
                                }
                                else if ((i > 1 && j == 5) || (selectedItemArrayPosition.X > 1 && selectedItemArrayPosition.Y == 5)) // weapons
                                {
                                    if ((((selectedItem.Type == ItemType.weapon || Inventory[i, j].Type == ItemType.weapon) && Inventory[i, j].Type == ItemType.nothing) && (Weapons.Count > 1 || !Weapons.Any(item => item == selectedItem)) || (selectedItem.Type == ItemType.weapon && Inventory[i, j].Type == ItemType.weapon)))
                                    {
                                        int numberOfWeapons = Weapons.Count();
                                        SwapItem(new Point(i, j));
                                        if (numberOfWeapons > Weapons.Count())
                                        {
                                            SelectedWeapon = 0;
                                        }
                                        break;
                                    }
                                }
                                else if (!(i > 2 && j == 6)) // inventory
                                {
                                    SwapItem(new Point(i, j));
                                    break;
                                }
                            }
                        }
                    }
                }

                selectedItem = null;
                selectedItemArrayPosition = new Point(0, 0);

                // remove
                for (int i = Inventory.GetLength(0) - 1; i >= 0; i--)
                {
                    for (int j = Inventory.GetLength(1) - 1; j >= 0; j--)
                    {
                        if (Inventory[i, j].Dead)
                        {
                            Inventory[i, j] = new Item(Item.Nothing, ItemType.nothing, TextureManager.none, "", "");
                        }
                    }
                }
            }
        }