Пример #1
0
        public void UpdateEquipment(Bohater Player)
        {
            postac         = Player;
            PlayerPB.Image = postac.getBattleImage();

            setTextColor();

            listBox1.Items.Clear();

            int i = 0;

            foreach (Przedmiot item in Player.Ekwipunek)
            {
                listBox1.Items.Add(Player.Ekwipunek.ElementAt(i).getNazwa().ToString() + " - " +
                                   Player.Ekwipunek.ElementAt(i).getIlosc().ToString());
                i++;
            }

            bohaterHP.Text    = Player.GetHP().ToString();
            bohaterMP.Text    = Player.GetMP().ToString();
            bohaterHPMax.Text = Player.GetMaxHP().ToString();
            bohaterMPMax.Text = Player.GetMaxMP().ToString();

            bohaterLevel.Text   = Player.GetLevel().ToString();
            bohaterPunktyD.Text = Player.GetSkillpoints().ToString();

            bohaterZloto.Text = Player.GetGold().ToString();

            bohaterInteligencja.Text = Player.GetIntelligence().ToString();
            bohaterZrecznosc.Text    = Player.GetDexterity().ToString();
            bohaterSila.Text         = Player.GetStrength().ToString();

            bohaterExp.Maximum = Player.GetEXPtoLevel();
            bohaterExp.Value   = Player.GetEXP();

            uzycie.Enabled = false;
            uzycie.Visible = false;

            zdjecie.Enabled = false;
            zdjecie.Visible = false;

            if (postac.getZalozonaZbroja() != null)
            {
                imageList1.Images.Add(postac.getZalozonaZbroja().getArmorImage());

                ListViewItem listViewItem = new ListViewItem();
                listViewItem.ImageIndex = 0;
                EquippedArmor.Items.Add(listViewItem);
            }

            if (postac.getZalozonaBron() != null)
            {
                imageList2.Images.Add(postac.getZalozonaBron().getWeaponImage());

                ListViewItem listViewItem = new ListViewItem();
                listViewItem.ImageIndex = 0;
                EquippedWeapon.Items.Add(listViewItem);
            }
        }
Пример #2
0
        private void UpdateStats()
        {
            if (Player != null && Enemy != null)
            {
                PlayerHPBP.Maximum        = Player.GetMaxHP();
                PlayerHPBP.Value          = Player.GetHP();
                PlayerHPCurrentLabel.Text = Player.GetHP().ToString();
                PlayerHPSlashLabel.Text   = "/";
                PlayerHPMaxLabel.Text     = Player.GetMaxHP().ToString();
                PlayerHPText.Text         = "Życie";

                PlayerMPBP.Maximum        = Player.GetMaxMP();
                PlayerMPBP.Value          = Player.GetMP();
                PlayerMPCurrentLabel.Text = Player.GetMP().ToString();
                PlayerMPSlashLabel.Text   = "/";
                PlayerMPMaxLabel.Text     = Player.GetMaxMP().ToString();
                PlayerMPText.Text         = "Mana";

                EnemyHPBP.Maximum        = Enemy.GetMaxHP();
                EnemyHPBP.Value          = Enemy.GetHP();
                EnemyHPCurrentLabel.Text = Enemy.GetHP().ToString();
                EnemyHPSlashLabel.Text   = "/";
                EnemyHPMaxLabel.Text     = Enemy.GetMaxHP().ToString();
                EnemyHPText.Text         = "Życie";

                EnemyMPBP.Maximum        = Enemy.GetMaxMP();
                EnemyMPBP.Value          = Enemy.GetMP();
                EnemyMPCurrentLabel.Text = Enemy.GetMP().ToString();
                EnemyMPSlashLabel.Text   = "/";
                EnemyMPMaxLabel.Text     = Enemy.GetMaxMP().ToString();
                EnemyMPText.Text         = "Mana";
            }
        }
Пример #3
0
        private void uzycie_Click(object sender, EventArgs e)
        {
            if (listBox1.SelectedItem != null)
            {
                Przedmiot P = postac.Ekwipunek.ElementAt(listBox1.SelectedIndex) as Przedmiot;
                if (P != null)
                {
                    if (P.getItemType() == ItemType.Armor)
                    {
                        if (postac.getZalozonaZbroja() != null)
                        {
                            listBox1.Items.Add(postac.getZalozonaZbroja().getNazwa().ToString() + " - " + postac.getZalozonaZbroja().getIlosc().ToString());
                            postac.Ekwipunek.Add(postac.getZalozonaZbroja());
                            EquippedArmor.Clear();
                            imageList1.Images.RemoveAt(0);
                        }

                        postac.ZalozZbroje(P as Zbroja);
                        imageList1.Images.Add((P as Zbroja).getArmorImage());

                        ListViewItem listViewItem = new ListViewItem();
                        listViewItem.ImageIndex = 0;
                        EquippedArmor.Items.Add(listViewItem);

                        postac.Ekwipunek.RemoveAt(listBox1.SelectedIndex);
                        listBox1.Items.RemoveAt(listBox1.SelectedIndex);
                        listBox1.ClearSelected();

                        Sound.PlaySound(Sound.Sound_weararmor);
                    }
                    else if (P.getItemType() == ItemType.Consumable)
                    {
                        if (P.GetType() == typeof(Mikstury))
                        {
                            Mikstury potion = P as Mikstury;
                            postac.SetHP(postac.GetHP() + potion.getPotionHp());
                            postac.SetMP(postac.GetMP() + potion.getPotionMp());
                        }

                        postac.addStrenght(P.getItemStrength());
                        postac.addDexterity(P.getItemDexterity());
                        postac.addIntelligence(P.getItemIntelligence());


                        if (postac.Ekwipunek.ElementAt(listBox1.SelectedIndex).getIlosc() == 1)
                        {
                            postac.Ekwipunek.RemoveAt(listBox1.SelectedIndex);
                            listBox1.Items.RemoveAt(listBox1.SelectedIndex);
                            listBox1.ClearSelected();
                        }
                        else
                        {
                            postac.Ekwipunek.ElementAt(listBox1.SelectedIndex).zmniejszIlosc(1);
                            listBox1.Items.RemoveAt(listBox1.SelectedIndex);
                            listBox1.ClearSelected();
                        }

                        Sound.PlaySound(Sound.Sound_healing);
                    }
                    else if (P.getItemType() == ItemType.Weapon)
                    {
                        if (postac.getZalozonaBron() != null)
                        {
                            listBox1.Items.Add(postac.getZalozonaBron().getNazwa().ToString() + " - " + postac.getZalozonaBron().getIlosc().ToString());
                            postac.Ekwipunek.Add(postac.getZalozonaBron());
                            postac.addStrenght(-1 * postac.getZalozonaBron().getItemStrength());
                            EquippedWeapon.Clear();
                            imageList2.Images.RemoveAt(0);
                        }

                        postac.ZalozBron(P as Bron);
                        postac.addStrenght(postac.getZalozonaBron().getItemStrength());
                        imageList2.Images.Add((P as Bron).getWeaponImage());

                        ListViewItem listViewItem = new ListViewItem();
                        listViewItem.ImageIndex = 0;
                        EquippedWeapon.Items.Add(listViewItem);

                        postac.Ekwipunek.RemoveAt(listBox1.SelectedIndex);
                        listBox1.Items.RemoveAt(listBox1.SelectedIndex);
                        listBox1.ClearSelected();

                        Sound.PlaySound(Sound.Sound_wearweapon);
                    }
                }

                P = null;
            }

            UpdateEquipment(postac);
        }