Exemplo n.º 1
0
        private void bnBattle_Click(object sender, EventArgs e)
        {
            Function.SoundManager.PlayButtonSound();
            if (player.ControlledCharacters.Count > 0)
            {
                FindLocalBattleForm battlechoose = new FindLocalBattleForm(player);
                var result = battlechoose.ShowDialog();
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    List <Core.Units.Character> list = new List <Core.Units.Character>();
                    bool battleWasWon = false;

                    foreach (var item in battlechoose.ReturnChars())
                    {
                        list.Add(item);
                    }

                    BattleForm battle = new BattleForm(list, battlechoose.ReturnDifficulty(), player.Settings);
                    if (battle.ShowDialog() == DialogResult.OK)
                    {
                        Function.SoundManager.PlayMain(true, this, player.Settings.SoundVolume);
                        list = battle.ReturnChars(player);

                        List <Item> loot = GenerateLoot(battlechoose.ReturnDifficulty(), ReturnAverageLevel(list), battle.ReturnNumberOfPlayers(), battle.ReturnedEnemy().UnitLevel);
                        battleWasWon = true;
                    }

                    List <EnumCharClass> classesUsed = new List <EnumCharClass>();
                    foreach (var item in list)
                    {
                        classesUsed.Add(item.CharClass);
                    }

                    CheckForQuest(battlechoose.ReturnDifficulty(), battle.ReturnedEnemy(), battle.ReturnedHealingDone(), ReturnLowestPercent(list), classesUsed, battleWasWon);

                    UpdateQuestVisual();

                    foreach (var item in list)
                    {
                        this.player.ControlledCharacters.RemoveAll(x => x.UnitName == item.UnitName);
                    }

                    this.player.ControlledCharacters.AddRange(battle.ReturnChars(player));

                    UpdateChars();

                    UpdateInventoryVisual();
                }
            }
            else
            {
                RPG.UI.MessageForm mes = new RPG.UI.MessageForm("You dont have any characters to battle with!");
                mes.ShowDialog();
            }

            this.ResumeLayout();
        }
Exemplo n.º 2
0
        private void bnBattle_Click(object sender, EventArgs e)
        {
            Function.SoundManager.PlayButtonSound();
            if (player.ControlledCharacters.Count > 0)
            {
                FindLocalBattleForm battlechoose = new FindLocalBattleForm(player);
                var result = battlechoose.ShowDialog();
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    List<Core.Units.Character> list = new List<Core.Units.Character>();
                    bool battleWasWon = false;

                    foreach (var item in battlechoose.ReturnChars())
                    {
                        list.Add(item);
                    }

                    Function.SoundManager.PauseMainMenuMusic();

                    BattleForm battle = new BattleForm(list, battlechoose.ReturnDifficulty(), player.Settings);
                    if (battle.ShowDialog() == DialogResult.OK)
                    {
                        Function.SoundManager.ResumeMainMenuMusic();
                        list = battle.ReturnChars(player);

                        List<Item> loot = GenerateLoot(battlechoose.ReturnDifficulty(), ReturnAverageLevel(list), battle.ReturnNumberOfPlayers(), battle.ReturnedEnemy().UnitLevel);
                        battleWasWon = true;
                    }

                    List<EnumCharClass> classesUsed = new List<EnumCharClass>();
                    foreach (var item in list)
                    {
                        classesUsed.Add(item.CharClass);
                    }

                    CheckForQuest(battlechoose.ReturnDifficulty(), battle.ReturnedEnemy(), battle.ReturnedHealingDone(), ReturnLowestPercent(list), classesUsed, battleWasWon);

                    UpdateQuestVisual();

                    foreach (var item in list)
                    {
                        this.player.ControlledCharacters.RemoveAll(x => x.UnitName == item.UnitName);
                    }

                    this.player.ControlledCharacters.AddRange(battle.ReturnChars(player));

                    UpdateChars();

                    UpdateInventoryVisual();
                }
            }
            else
            {
                RPG.UI.MessageForm mes = new RPG.UI.MessageForm("You dont have any characters to battle with!");
                mes.ShowDialog();
            }

            this.ResumeLayout();
        }