public void UpdateEnemyHealth()
        {
            bossName.Text = boss.Name + $" [{_state.Player.GetWeaknessString(boss, _state.SManager)}]";

            // set the values for the subbars again
            bc.SetSubBars(boss.HP);

            int s = 0;

            // for all subbars greater than what's supposed to be visible, reduce their value to 0
            foreach (ProgressBar sub in subbars)
            {
                if (s++ >= bc.GetSubbars())
                {
                    sub.Value = 0;
                }
            }

            bossBar.Value = bc.GetBBPercent();
        }
Exemple #2
0
        private void CreateEnemies()
        {
            PictureBox[]  e_icons = { EnemyPic1, EnemyPic2, EnemyPic3 };
            TextBox[]     e_boxes = { EnemyBox1, EnemyBox2, EnemyBox3 };
            ProgressBar[] e_bars  = { EnemyBar1, EnemyBar2, EnemyBar3 };
            RadioButton[] c_boxes = { Target1, Target2, Target3 };

            IsPlayerTurn = true;

            tp = new TurnPress(p.Turns + p.stats[Stat.TURNS]);

            TurnBox.Text = tp.PrintIcons();

            for (int e = 0; e < e_icons.Length; e++)
            {
                if (e_icons[e].Image != null)
                {
                    e_icons[e].Image = null;
                }
                e_boxes[e].Text    = "";
                c_boxes[e].Enabled = false;
            }

            d.GenerateFight();
            c_boxes[0].Checked = true;

            if (d.isBoss)
            {
                BossGroup.Visible  = true;
                EnemyGroup.Visible = false;
                useBountyKeyToolStripMenuItem.Enabled   = false;
                useEXBountyKeyToolStripMenuItem.Enabled = false;
                useElderKeyToolStripMenuItem.Enabled    = false;

                Enemy boss = d.enemies[0];

                BossPicture.Image = Image.FromFile(boss.image);
                BossName.Text     = boss.weakName;

                bc.CheckDefault(boss.hp);
                bc.SetSubBars(boss.hp);
                BossBar.Maximum = bc.hp_default;

                int subs  = bc.subbars;
                int baseB = bc.baseBar;

                for (int i = 0; i < subs; i++)
                {
                    sbars[i].Visible = true;
                    sbars[i].Value   = sbars[i].Maximum;
                }

                BossBar.Value = baseB;
                mm.Pause();

                if (d.isFinalBoss)
                {
                    mm.Stop();
                    mm.SetFinalBossSong();
                    mm.PlayFinalBossSong();
                }
                else if (d.isElderGod)
                {
                    mm.PlayElderSong();
                }
                else if (d.isEXBoss || d.isEXInvader)
                {
                    mm.PlayEXSong();
                }
                else if (d.isBountyBoss)
                {
                    mm.PlayBountySong();
                }
                else if (d.isInvader)
                {
                    mm.PlayInvaderSong();
                }
                else
                {
                    mm.PlayBossSong();
                }

                TitleCard.Image = Image.FromFile(boss.titleCard);
            }
            else
            {
                BossGroup.Visible  = false;
                EnemyGroup.Visible = true;

                switch (d.enemies.Count)
                {
                case 1:
                    e_icons[1].Image   = Image.FromFile(d.enemies[0].image);
                    e_boxes[1].Text    = d.enemies[0].weakName;
                    e_bars[1].Maximum  = d.enemies[0].hp;
                    e_bars[1].Value    = d.enemies[0].hp;  // change later
                    c_boxes[0].Enabled = true;
                    break;

                case 2:
                    int x = 0;
                    for (int i = 0; i < d.enemies.Count; i++)
                    {
                        e_icons[x].Image   = Image.FromFile(d.enemies[i].image);
                        e_boxes[x].Text    = d.enemies[i].weakName;
                        e_bars[x].Maximum  = d.enemies[i].hp;
                        e_bars[x].Value    = d.enemies[i].hp;
                        c_boxes[i].Enabled = true;
                        x += 2;
                    }
                    break;

                case 3:
                    for (int i = 0; i < d.enemies.Count; i++)
                    {
                        e_icons[i].Image   = Image.FromFile(d.enemies[i].image);
                        e_boxes[i].Text    = d.enemies[i].weakName;
                        e_bars[i].Maximum  = d.enemies[i].hp;
                        e_bars[i].Value    = d.enemies[i].hp;
                        c_boxes[i].Enabled = true;
                    }
                    break;
                }
            }
        }