示例#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];
        }
示例#2
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, "", "");
                        }
                    }
                }
            }
        }
示例#3
0
 public static void ShieldChanceReduceDamage(float damage, float goThroughShield, DamageType damageType, Ship ship, Shield shield)
 {
     if (Globals.Randomizer.Next(0, 101) < 50)
     {
         ship.TakeDamage(damage / 2, goThroughShield, damageType, true);
     }
     else
     {
         ship.TakeDamage(damage, goThroughShield, damageType, true);
     }
 }
示例#4
0
 public static void ShieldChanceToTeleport(float damage, float goThroughShield, DamageType damageType, Ship ship, Shield shield)
 {
     if (Globals.Randomizer.Next(0, 101) < shield.Chance)
     {
         List <int> locations = new List <int>();
         for (int i = 0; i < 3; i++)
         {
             if (i != (int)ship.ShipLocation)
             {
                 locations.Add(i);
             }
         }
         ship.ShipLocation = (Location)locations[Globals.Randomizer.Next(0, locations.Count())];
         ship.Size         = 0;
         ship.Position     = new Vector2((int)ship.ShipLocation * 100 + 200, ship.Position.Y);
     }
     else
     {
         ship.TakeDamage(damage, goThroughShield, damageType, true);
     }
 }
示例#5
0
 public static void ShieldBonusDamage(float damage, float goThroughShield, DamageType damageType, Ship ship, Shield shield)
 {
     ship.TakeDamage(damage, goThroughShield, damageType, true);
     ship.BonusDamageOneFight += Globals.Randomizer.Next(1, 4);
 }
示例#6
0
 public static void ShieldDamageEnergy(float damage, float goThroughShield, DamageType damageType, Ship ship, Shield shield)
 {
     if (Globals.Randomizer.Next(0, 101) < shield.Chance && ship.GetType().Name == "Player")
     {
         Player p = (Player)ship;
         p.Energy.Change(-damage);
     }
     else
     {
         ship.TakeDamage(damage, goThroughShield, damageType, true);
     }
 }
示例#7
0
 public static void ShieldDamageOverTime(float damage, float goThroughShield, DamageType damageType, Ship ship, Shield shield)
 {
     ship.SetDamageOverTime(damage / 5, 5, goThroughShield);
 }
示例#8
0
 public static void ShieldCounterShoot(float damage, float goThroughShield, DamageType damageType, Ship ship, Shield shield)
 {
     if (Globals.Randomizer.Next(0, 101) < shield.Chance)
     {
         ship.CurrentWeapon.Method(ship, ship.CurrentWeapon, 3, SceneManager.mapScene.CurrentLevel, false);
     }
     ship.TakeDamage(damage, goThroughShield, damageType, true);
 }
示例#9
0
 public static void ShieldReflect(float damage, float goThroughShield, DamageType damageType, Ship ship, Shield shield)
 {
     if (damageType == DamageType.laser && Globals.Randomizer.Next(0, 101) < shield.Chance)
     {
         List <string> targets = new List <string>();
         targets.Add(ship.GetType().Name == "Player" ? "Enemy" : "Player");
         SceneManager.mapScene.CurrentLevel.ToAdd.Add(new Shot(ship.Position, MathHelper.Lerp((float)Math.PI + 0.2f, (float)Math.PI * 2 - 0.2f, (float)Globals.Randomizer.NextDouble()), damage, Shot.HitBasic, targets, 0f, 0));
     }
     else
     {
         ship.TakeDamage(damage, goThroughShield, damageType, true);
     }
 }
示例#10
0
 public static void ShieldStandard(float damage, float goThroughShield, DamageType damageType, Ship ship, Shield shield)
 {
     ship.TakeDamage(damage, goThroughShield, damageType, true);
 }
示例#11
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, "", "");
                        }
                    }
                }
            }
        }
示例#12
0
        public void RankUp()
        {
            int random = Globals.Randomizer.Next(0, 7);

            SceneManager.mapScene.NewRank.Flash = 10;
            if (random == 0)
            {
                AddItem(new Shield(new Vector2(200, Globals.ScreenSize.Y - 35), 100, 20, 60 + Globals.Randomizer.Next(-10, 20), Globals.Randomizer.Next(0, Shield.ListOfShieldMethods().Count()), Rank - 1));
                RankPerks.Add("Shield Module");
            }
            else if (random == 1)
            {
                AddItem(new Hull(this, Globals.Randomizer.Next(0, Hull.ListOfHullMethods().Count()), Rank - 1));
                RankPerks.Add("Hull Module");
            }
            else if (random == 2)
            {
                AddItem(new Weapon(this, Globals.Randomizer.Next(0, Weapon.ListOfMethods().Count()), Rank - 1));
                RankPerks.Add("Weapon Module");
            }
            else if (random == 3)
            {
                for (int i = 0; i < 2; i++)
                {
                    AddItem(new Item(Globals.Heal));
                    AddItem(new Item(Globals.Flee));
                }
                RankPerks.Add("Misc items");
            }
            else if (random == 4)
            {
                Health.MaxValue += 10;
                Health.Change(10);
                RankPerks.Add("Increase health by 10");
            }
            else if (random == 5)
            {
                shieldRegeneration += 0.01f;
                RankPerks.Add("Increase shield regeneration");
            }
            else if (random == 6)
            {
                BonusDamage += 2;
                RankPerks.Add("Increase damage");
            }
        }