Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Test.Play();
            int BattleType = random.Next(1, 3);
            int Choice     = random.Next(1, 4);

            Console.WriteLine(Choice);
            if (Choice == 1)
            {
                MaxHP     = MainPlayer.EntityStats.charHP;
                EnemyType = false;
                TurnStartButton.Visible = true;
                SkillButton.Visible     = true;
                if (BattleType == 1)
                {
                    EnemyBandit = new Bandit();
                    EnemyBandit.GenerateName();
                    GameOuputLabel.Text = "You have encountered the bandit " + EnemyBandit.EntityName;
                    EnemyBandit.GenerateSkills();
                    EnemyBandit.GenerateStats();
                    EnemyBandit.GenerateArmor();
                    EnemyBandit.GenerateWeapon();
                    EnemyBandit.EntityLevel = MainPlayer.EntityLevel;
                    if (EnemyBandit.EntityStats.charDex == MainPlayer.EntityStats.charDex)
                    {
                        EnemyBandit.EntityStats.charDex += -1;
                    }
                    Image oImage = Properties.Resources.BanditIdle;
                    EnemySprite = new Sprite(new Point(0, 0), MySpriteController, oImage, 75, 70, 300, 4);
                    EnemySprite.AddAnimation(new Point(0, 0), Properties.Resources.BanditAttack, 161, 116, 300, 9);
                    EnemySprite.AddAnimation(Properties.Resources.BanditDead);
                    EnemySprite.SpriteAnimationComplete += AttackComplete;
                    EnemySprite.SetName("Bandit");
                    EnemySprite.PutBaseImageLocation(new Point(575, 217));
                    EnemySprite.SetSize(new Size(200, 250));
                }
                if (BattleType == 2)
                {
                    EnemyType  = true;
                    EnemySlime = new Slime();
                    EnemySlime.GenerateName();
                    GameOuputLabel.Text = "You have encountered the slime " + EnemySlime.EntityName;
                    EnemySlime.GenerateSkills();
                    EnemySlime.GenerateStats();
                    EnemySlime.GenerateArmor();
                    EnemySlime.GenerateWeapon();
                    EnemySlime.EntityLevel = MainPlayer.EntityLevel;
                    if (EnemySlime.EntityStats.charDex == MainPlayer.EntityStats.charDex)
                    {
                        EnemySlime.EntityStats.charDex += -1;
                    }
                    Image oImage = Properties.Resources.SlimeIdle;
                    EnemySprite = new Sprite(new Point(0, 0), MySpriteController, oImage, 74, 51, 300, 4);
                    EnemySprite.AddAnimation(new Point(0, 0), Properties.Resources.SlimeAttack, 148, 82, 300, 16);
                    EnemySprite.AddAnimation(new Point(0, 0), Properties.Resources.SlimeMagic, 80, 59, 300, 4);
                    EnemySprite.AddAnimation(Properties.Resources.SlimeDead);
                    EnemySprite.SpriteAnimationComplete += AttackComplete;
                    EnemySprite.SetName("Slime");
                    EnemySprite.PutBaseImageLocation(new Point(575, 217));
                    EnemySprite.SetSize(new Size(200, 250));
                }
            }
            if (Choice == 2)
            {
                EventMerchant = new Merchant();
                EventMerchant.GenerateSaleList();
                EventMerchant.NamePimper();
                GameOuputLabel.Text = "You have encountered a merchant! Here is what they have for sale!";
                MerchantInventory Shops = new MerchantInventory(EventMerchant.WeaponInventory, EventMerchant.ArmorInventory, MainPlayer);

                Shops.ShowDialog();
                if (Shops.TruePurchasedWeapon != null)
                {
                    MainPlayer.WeaponInventory.Add(Shops.TruePurchasedWeapon);
                }
                if (Shops.TruePurchasedArmor != null)
                {
                    MainPlayer.ArmorInventory.Add(Shops.TruePurchasedArmor);
                }
                if (Shops.ErrorMessage != null)
                {
                    GameOuputLabel.Text = Shops.ErrorMessage;
                }
                MainPlayer.PlayerGold = Shops.MainPlayer.PlayerGold;
                RefreshAllLabels();
            }

            if (Choice == 3)
            {
                GameOuputLabel.Text = "You wandered for hours and found nothing!";
            }
        }