Beispiel #1
0
 public static IEnumerator <ulong> AboutTheWar()
 {
     TownScreen.Instance.PlayerMoveEnabled = false;
     ChoiceScreen.Show("Would you like to know more about the war?",
                       new Choice("Yes",
                                  delegate
     {
         MessageScreen.Show("This war is rooted in the differences of Traditionalists and Futurists.");
         return(null);
     }),
                       new Choice("No",
                                  delegate
     {
         MessageScreen.Show("You don't really care do you?");
         return(null);
     })
                       );
     while (game.InputHandler.Focused is DialogScreen)
     {
         yield return(5);
     }
     TownScreen.Instance.PlayerMoveEnabled = true;
     yield break;
 }
Beispiel #2
0
 public static IEnumerator <ulong> FightOrFlee()
 {
     TownScreen.Instance.PlayerMoveEnabled = false;
     ChoiceScreen.Show("Would you rather fight or flee?",
                       new Choice("Fight",
                                  delegate
     {
         MessageScreen.Show("Careful, don't forget about your team");
         return(null);
     }),
                       new Choice("Flee",
                                  delegate
     {
         MessageScreen.Show("You can't always run...");
         return(null);
     })
                       );
     while (game.InputHandler.Focused is DialogScreen)
     {
         yield return(5);
     }
     TownScreen.Instance.PlayerMoveEnabled = true;
     yield break;
 }
Beispiel #3
0
 public static IEnumerator <ulong> ChooseYourFate()
 {
     TownScreen.Instance.PlayerMoveEnabled = false;
     ChoiceScreen.Show("Choose your fate.",
                       new Choice("Traditionalist",
                                  delegate
     {
         MessageScreen.Show("Your backwardness is preventing equality for all.");
         return(null);
     }),
                       new Choice("Futurist",
                                  delegate
     {
         MessageScreen.Show("Your technology is destroying the earth.");
         return(null);
     })
                       );
     while (game.InputHandler.Focused is DialogScreen)
     {
         yield return(5);
     }
     TownScreen.Instance.PlayerMoveEnabled = true;
     yield break;
 }
Beispiel #4
0
        public IEnumerator <ulong> Pressed()
        {
            switch (State)
            {
            case BattleState.SETUP:
                if (cursorX < ALLOWED_INITIAL_REGION && !positions.Values.Contains <Point>(new Point(cursorX, cursorY)) && tileEngine.MapPassability[cursorY, cursorX])
                {
                    positions[Player.Party[setupIndex]] = new Point(cursorX, cursorY);
                    setupIndex++;
                    State = BattleState.NOTIF;
                }
                else
                {
                    MessageScreen.Show("You can't use that position.");
                    while (Game.InputHandler.Focused is DialogScreen)
                    {
                        yield return(5);
                    }
                }
                break;

            case BattleState.CHARACTER_SELECT:
                foreach (Character c in Player.Party)
                {
                    if (positions[c].X == cursorX && positions[c].Y == cursorY)
                    {
                        if (c.CurrMovementPoints <= 0)
                        {
                            MessageScreen.Show(c.Name + " has no movement points left and can't do anymore actions.");
                        }
                        else
                        {
                            ChoiceScreen.Show("What will " + c.Name + " do with his remaining " + c.CurrMovementPoints + " movement points?",
                                              new Choice("Attack",
                                                         delegate
                            {
                                selectedCharacterX = cursorX;
                                selectedCharacterY = cursorY;
                                Choice[] attacks   = new Choice[c.KnownAttacks.Count + 1];
                                for (int i = 0; i < c.KnownAttacks.Count; i++)
                                {
                                    Attack curr = c.KnownAttacks[i];
                                    attacks[i]  = new Choice(curr.Name,
                                                             delegate
                                    {
                                        if (c.CurrMovementPoints < curr.MovementCost)
                                        {
                                            MessageScreen.Show(c.Name + " does not have enough movement points for that.");
                                        }
                                        else
                                        {
                                            SelectAttack(c, curr);
                                            MessageScreen.Show("Choose a position to attack. Press the Escape Key to cancel.");
                                            State = BattleState.CHARACTER_ATTACK;
                                        }
                                        return(null);
                                    });
                                }
                                attacks[attacks.Length - 1] = new Choice("Nevermind", MiScreen.DoNothing);
                                ChoiceScreen.Show("Which Attack?", attacks);
                                return(null);
                            }),
                                              new Choice("Move",
                                                         delegate
                            {
                                SelectMove(c);
                                MessageScreen.Show("Choose where to move. Press the Escape Key to cancel.");
                                State = BattleState.CHARACTER_MOVE;
                                return(null);
                            }),
                                              new Choice("Nevermind", MiScreen.DoNothing)
                                              );
                        }
                        break;
                    }
                }
                break;

            case BattleState.CHARACTER_MOVE:
                if (Move(cursorX, cursorY))
                {
                    State = BattleState.NOTIF;
                }
                else
                {
                    MessageScreen.Show("You can't choose that position");
                    while (Game.InputHandler.Focused is DialogScreen)
                    {
                        yield return(5);
                    }
                }
                break;

            case BattleState.CHARACTER_ATTACK:
                if (Attack(cursorX, cursorY))
                {
                    colorChanged = true;
                    State        = BattleState.NOTIF;
                }
                else
                {
                    MessageScreen.Show("Target out of range.");
                    while (Game.InputHandler.Focused is DialogScreen)
                    {
                        yield return(5);
                    }
                }
                break;
            }
            yield break;
        }
Beispiel #5
0
        public override void Update(GameTime gameTime)
        {
            flash.Update(gameTime);
            if (Game.InputHandler.Focused is DialogScreen)
            {
                return;
            }

            if (Player.Party.Count == 0)
            {
                ChoiceScreen.Show("You died!", new Choice("Yeah Whatever...", Escaped));
                return;
            }

            if (enemies.Count == 0)
            {
                ChoiceScreen.Show("You won!", new Choice("Yeah Whatever...", Escaped));
                return;
            }

            if (!waiting)
            {
                switch (State)
                {
                case BattleState.NOTIF:
                    if (setupIndex < Player.Party.Count)
                    {
                        MessageScreen.Show("Select Location for " + Player.Party[setupIndex].Name);
                        for (int row = 0; row < tileEngine.MapGraphics.GetLength(0); row++)
                        {
                            for (int col = 0; col < ALLOWED_INITIAL_REGION; col++)
                            {
                                tileEngine.MapGraphics[row, col].Color = Color.Yellow;
                            }
                        }
                        colorChanged = true;
                        State        = BattleState.SETUP;
                    }
                    else
                    {
                        if (colorChanged)
                        {
                            for (int row = 0; row < tileEngine.MapGraphics.GetLength(0); row++)
                            {
                                for (int col = 0; col < tileEngine.MapGraphics.GetLength(1); col++)
                                {
                                    tileEngine.MapGraphics[row, col].Color = Color.White;
                                }
                            }
                            colorChanged = false;
                        }
                        ChoiceScreen.Show("What to do?",
                                          new Choice("Fight", Fight),
                                          new Choice("End Turn",
                                                     delegate
                        {
                            foreach (Character c in Player.Party)
                            {
                                c.CurrMovementPoints = c.MaxMovementPoints;
                            }
                            State = BattleState.ENEMY_TURN;
                            return(null);
                        }),
                                          new Choice("Run", ExitSequence));
                    }
                    break;
                }
            }

            cursor.Update(gameTime);
        }