Example #1
0
        public Combat(ref Player aPlayerObject, ref Label HealthLabel, ref Label WeaponLabel, ref Label VehicleLabel, ref Label OriginalMoney, ref RefBool Lose)
        {
            InitializeComponent();
            PlayerHealth.Text  = "Health:  " + aPlayerObject.Health.ToString() + " / " + aPlayerObject.MaxHealth.ToString();
            PlayerWeapon.Text  = "Weapon:  " + WeaponLabel.Text;
            PlayerVehicle.Text = "Vehicle:  " + VehicleLabel.Text;
            Stupid             = aPlayerObject;
            OrigMoney          = OriginalMoney;
            Cops = Lose;

            RunHelper = 0;

            OrigHealth = HealthLabel;


            Random random = new Random();

            if (aPlayerObject.Day <= 12)
            {
                generateEnemyWeaponNone();
            }
            else
            {
                generateEnemyWeaponWeak();
            }

            EnemiesLeft      = NumberOfEnemies;
            HealthOfEnemy    = 100;
            label1.Text      = "Number of Enemies:  " + NumberOfEnemies.ToString();
            EnemyWeapon.Text = "Enemy Weapon:  " + WeaponOfEnemy.Name;
        }
        private void advanceDay()
        {
            getPriceGreen();

            LocalTravel++;
            if (LocalTravel == 1)
            {
                label14.Text = "Morning";
            }
            if (LocalTravel == 2)
            {
                label14.Text = "Noon";
            }
            if (LocalTravel == 3)
            {
                label14.Text = "Afternoon";
            }
            if (LocalTravel == 4)
            {
                label14.Text = "Evening";
            }
            if (LocalTravel == 5)
            {
                label14.Text = "Night";
            }

            if (MyPlayer.Day >= 8)
            {
                if (Fight[MyPlayer.Location] == true)
                {
                    bool DoubleJeopardy = random.Next() % 2 == 0 ? true : false;
                    if (DoubleJeopardy == false)
                    {
                        DoubleJeopardy = random.Next() % 2 == 0 ? true : false;
                    }
                    if (DoubleJeopardy == true)
                    {
                        RefBool Success = new RefBool(false);
                        Combat  ComForm = new Combat(ref MyPlayer, ref label16, ref label8, ref label7, ref label2, ref Success);
                        ComForm.ControlBox    = false;
                        ComForm.StartPosition = FormStartPosition.CenterParent;
                        ComForm.ShowDialog(this);
                        Fight[MyPlayer.Location] = false;

                        if (MyPlayer.Health <= 0)
                        {
                            MyPlayer.Health = 10;
                            MyPlayer.SellDrugs.Acid.Quantity             = 0;
                            MyPlayer.SellDrugs.Acid.PurchasePrice        = 0;
                            MyPlayer.SellDrugs.Cocaine.Quantity          = 0;
                            MyPlayer.SellDrugs.Cocaine.PurchasePrice     = 0;
                            MyPlayer.SellDrugs.Crack.Quantity            = 0;
                            MyPlayer.SellDrugs.Crack.PurchasePrice       = 0;
                            MyPlayer.SellDrugs.CrystalMeth.Quantity      = 0;
                            MyPlayer.SellDrugs.CrystalMeth.PurchasePrice = 0;
                            MyPlayer.SellDrugs.Ecstasy.Quantity          = 0;
                            MyPlayer.SellDrugs.Ecstasy.PurchasePrice     = 0;
                            MyPlayer.SellDrugs.Hash.Quantity             = 0;
                            MyPlayer.SellDrugs.Hash.PurchasePrice        = 0;
                            MyPlayer.SellDrugs.Heroin.Quantity           = 0;
                            MyPlayer.SellDrugs.Heroin.PurchasePrice      = 0;
                            MyPlayer.SellDrugs.Mescaline.Quantity        = 0;
                            MyPlayer.SellDrugs.Mescaline.PurchasePrice   = 0;
                            MyPlayer.SellDrugs.Morphine.Quantity         = 0;
                            MyPlayer.SellDrugs.Morphine.PurchasePrice    = 0;
                            MyPlayer.SellDrugs.Mushrooms.Quantity        = 0;
                            MyPlayer.SellDrugs.Mushrooms.PurchasePrice   = 0;
                            MyPlayer.SellDrugs.Weed.Quantity             = 0;
                            MyPlayer.SellDrugs.Weed.PurchasePrice        = 0;

                            MyPlayer.Money = MyPlayer.Money / 2;
                        }
                    }
                }
            }

            if (LocalTravel >= MyPlayer.PlayerVehicle.Speeds)
            {
                LocalTravel  = 0;
                label14.Text = "Early Morning";
                MyPlayer.Day++;


                MyPlayer.Bank += getPercent(MyPlayer.Bank, 5);
                MyPlayer.Debt += getPercent(MyPlayer.Debt, DebtRate);

                generateFightLocations();


                BuyDrugs[0].generateAmounts();
                BuyDrugs[0].generatePrices();
                BuyDrugs[1].generateAmounts();
                BuyDrugs[1].generatePrices();
                BuyDrugs[2].generateAmounts();
                BuyDrugs[2].generatePrices();
                BuyDrugs[3].generateAmounts();
                BuyDrugs[3].generatePrices();
                BuyDrugs[4].generateAmounts();
                BuyDrugs[4].generatePrices();
                BuyDrugs[5].generateAmounts();
                BuyDrugs[5].generatePrices();

                if ((MyPlayer.Day == (DayOfPriceWarning + 1)) && (SpecialEvent == true))
                {
                    specialEventAdd();
                    SpecialEvent = true;
                    richTextBox1.Clear();
                    resetSpecialEventItems();
                }
            }
            repopulateBuyList();
            repopulateSellList();

            if (MyPlayer.OwnCalculator == true)
            {
                hidePictures();
                showPictures();
            }
            else
            {
                hidePictures();
            }


            if (MyPlayer.Day == 1)
            {
                MyPlayer.Debt  = 5500;
                MyPlayer.Money = 2500;
            }


            if ((MyPlayer.Day == 31) && (GameOverYet == false))
            {
                if (LocalTravel == 0)
                {
                    bool Winner = false;
                    if (((MyPlayer.Money + MyPlayer.Bank) - MyPlayer.Debt) >= 1000000)
                    {
                        Winner = true;
                    }

                    GameOverForm GameOver = new GameOverForm(Winner);
                    GameOver.StartPosition = FormStartPosition.CenterParent;
                    GameOver.ShowDialog(this);
                    GameOverYet = true;
                }
            }
            if ((((MyPlayer.Money + MyPlayer.Bank) - MyPlayer.Debt) >= 1000000) && (GameOverYet == false))
            {
                GameOverForm GameOver = new GameOverForm(true);
                GameOver.StartPosition = FormStartPosition.CenterParent;
                GameOver.ShowDialog(this);
                GameOverYet = true;
            }


            int r = random.Next(1, 10);

            if ((r > 4) && (r < 7))//in ten chance of a price rising or lowering
            {
                SpecialEvent      = true;
                DayOfPriceWarning = MyPlayer.Day;
                generateSpecialEvent();
            }

            if (MyPlayer.Day == DayToCollectDebt)
            {
                DebtCollector ChoiceHere = new DebtCollector(ref MyPlayer, ref label2, ref label4, ref label16);
                ChoiceHere.ControlBox    = false;
                ChoiceHere.StartPosition = FormStartPosition.CenterParent;

                ChoiceHere.ShowDialog(this);

                if (MyPlayer.Debt > 0)
                {
                    DayToCollectDebt += 5;
                }
            }

            label2.Text  = formatStringToCurrency(MyPlayer.Money);
            label4.Text  = formatStringToCurrency(MyPlayer.Debt);
            label21.Text = formatStringToCurrency(MyPlayer.Bank);
            label10.Text = MyPlayer.Day.ToString();
            label16.Text = MyPlayer.Health + " / " + MyPlayer.MaxHealth;
            label7.Text  = MyPlayer.PlayerVehicle.Name;
            label8.Text  = MyPlayer.PlayerWeapon.Name;
        }