コード例 #1
0
ファイル: DeckListForm.cs プロジェクト: andyaiken/masterplan
        void run_encounter(EncounterDeck deck, bool choose_map)
        {
            MapAreaSelectForm map_dlg = null;

            if (choose_map)
            {
                map_dlg = new MapAreaSelectForm(Guid.Empty, Guid.Empty);
                if (map_dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            Encounter enc = new Encounter();
            bool      ok  = deck.DrawEncounter(enc);

            update_decks();

            if (ok)
            {
                CombatState cs = new CombatState();
                cs.Encounter  = enc;
                cs.PartyLevel = Session.Project.Party.Level;

                if ((map_dlg != null) && (map_dlg.Map != null))
                {
                    cs.Encounter.MapID = map_dlg.Map.ID;

                    if (map_dlg.MapArea != null)
                    {
                        cs.Encounter.MapAreaID = map_dlg.MapArea.ID;
                    }
                }

                CombatForm dlg = new CombatForm(cs);
                dlg.Show();
            }
            else
            {
                string str = "An encounter could not be built from this deck; check that there are enough cards remaining.";
                MessageBox.Show(str, "Masterplan", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #2
0
        private void run_encounter(EncounterDeck deck, bool choose_map)
        {
            MapAreaSelectForm mapAreaSelectForm = null;

            if (choose_map)
            {
                mapAreaSelectForm = new MapAreaSelectForm(Guid.Empty, Guid.Empty);
                if (mapAreaSelectForm.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                {
                    return;
                }
            }
            Encounter encounter = new Encounter();
            bool      flag      = deck.DrawEncounter(encounter);

            this.update_decks();
            if (!flag)
            {
                MessageBox.Show("An encounter could not be built from this deck; check that there are enough cards remaining.", "Masterplan", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            CombatState combatState = new CombatState()
            {
                Encounter  = encounter,
                PartyLevel = Session.Project.Party.Level
            };

            if (mapAreaSelectForm != null && mapAreaSelectForm.Map != null)
            {
                combatState.Encounter.MapID = mapAreaSelectForm.Map.ID;
                if (mapAreaSelectForm.MapArea != null)
                {
                    combatState.Encounter.MapAreaID = mapAreaSelectForm.MapArea.ID;
                }
            }
            (new CombatForm(combatState)).Show();
        }