示例#1
0
        public string Move(int x, int y)
        {
            string txt  = null;
            Tile   tile = board.Move(x, y);

            txt = "You entered the room.\n";
            if (tile.Visited == false)
            {
                switch (tile.Type)
                {
                case "enemy1":
                    fight = true;
                    enemy = goblin.Clone() as Enemy;
                    txt  += "You encourntered a " + enemy.Name + ": HP=" + enemy.HP.ToString() + "/Atk=" + enemy.Attack.ToString() + "\n";
                    txt  += Action(false);
                    break;

                case "enemy2":
                    fight = true;
                    enemy = orc.Clone() as Enemy;
                    txt  += "You encourntered a " + enemy.Name + ": HP=" + enemy.HP.ToString() + "/Atk=" + enemy.Attack.ToString() + "\n";
                    txt  += Action(false);
                    break;

                case "potion1":
                    int a = player.Heal(5);
                    txt += "A potion! You healed " + a.ToString() + "HP\n";
                    break;

                case "potion2":
                    int b = player.Heal(10);
                    txt += "A potion! You healed " + b.ToString() + "HP\n";
                    break;

                case "end":
                    txt = "You found the exit, you win!";
                    end = true;
                    break;
                }
            }
            return(txt);
        }