コード例 #1
0
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listBox1.SelectedItem == null)
            {
                textBox1.Text = "";
            }
            else
            {
                textBox1.Text = quests.ElementAt(listBox1.SelectedIndex).getDescription().ToString();

                if (quests.ElementAt(listBox1.SelectedIndex).GetType() == typeof(QuestKillEnemy))
                {
                    QuestKillEnemy _quest = quests.ElementAt(listBox1.SelectedIndex) as QuestKillEnemy;

                    textBox1.Text += Environment.NewLine;
                    textBox1.Text += Environment.NewLine;

                    textBox1.Text += _quest.GetEnemiesKilled().ToString() + " / " + _quest.GetEnemiesToKill().ToString();
                }
            }
        }
コード例 #2
0
        private void AttackBtn_Click(object sender, EventArgs e)
        {
            if (playerTurn)
            {
                Enemy.SetHP(Enemy.GetHP() - (Player.GetObrazenia() * PlayerDmgMultiplier) / EnemyDefMultiplier);
                Sound.PlaySound(Sound.Sound_playerbasicattack);

                if (Enemy.GetHP() <= 0)
                {
                    Enemy.SetHP(0);
                    Enemy.SetMP(0);
                    Enemy.setIsAlive(false);

                    playerWin = true;
                    inCombat  = false;

                    Player.DodajEXP(Enemy.getNagrodaExp());
                    Player.DodajGold(Enemy.getNagrodaGold());

                    foreach (Quest quest in Player.quests)
                    {
                        if (quest.getStatus() == QuestStatus.Active)
                        {
                            if (quest.GetType() == typeof(QuestKillEnemy))
                            {
                                QuestKillEnemy _quest = quest as QuestKillEnemy;
                                if (_quest.GetQuestEnemyID() == Enemy.getId())
                                {
                                    _quest.IncrementCounter();
                                    _quest.CheckCompletion();
                                }
                            }
                        }
                    }

                    Enemy = null;

                    if (CombatSoundPlayer.settings.volume > 0)
                    {
                        timer2.Start();
                    }

                    if (Sound.SongPlayer.settings.volume < 100)
                    {
                        timer1.Start();
                    }

                    this.Close();
                }
            }

            PlayerDmgMultiplier = 1;
            PlayerDefMultiplier = 1;
            EnemyDmgMultiplier  = 1;
            EnemyDefMultiplier  = 1;

            playerTurn              = false;
            AttackBtn.Enabled       = false;
            SpecialSkillBtn.Enabled = false;
            BlockBtn.Enabled        = false;
            ItemsBtn.Enabled        = false;

            UpdateStats();
            Delay.Start();
        }