コード例 #1
0
        public void Defence(string battleFieldId, string robotId, ActionStrength defenceStrength)
        {
            BattleField battleField = BattleFields.GetBattleField(battleFieldId);

            if (battleField.BattleState == BattleState.Running)
            {
                Robot robot = battleField.GetRobot(robotId);

                _robotAction = new RobotActions(robot, defenceStrength);
                new DefenceAction(_robotAction).Execute();
            }
        }
コード例 #2
0
        public string StartDemoBattle(string robotId)
        {
            string battleFieldId = BattleFields.CreateBattleField(robotId, "DemoBattle", RoomType.Private);

            BattleFields.JoinBattleField(battleFieldId, robotId, PlayType.Manual);
            BattleFields.JoinBattleField(battleFieldId, "DEMO", PlayType.Auto);

            BattleField battle = BattleFields.GetBattleField(battleFieldId);

            battle.StartBattle();

            return(battleFieldId);
        }
コード例 #3
0
        public int Rest(string battleFieldId, string robotId, ActionStrength restStrength)
        {
            var healPoints = 0;

            BattleField battleField = BattleFields.GetBattleField(battleFieldId);

            if (battleField.BattleState == BattleState.Running)
            {
                Robot robot = battleField.GetRobot(robotId);

                _robotAction = new RobotActions(robot, restStrength);
                healPoints   = new RestAction(_robotAction).Execute();
            }

            return(healPoints);
        }
コード例 #4
0
        public int Attack(string battleFieldId, string robotId, ActionStrength attackStrength)
        {
            int         damage;
            BattleField battleField = BattleFields.GetBattleField(battleFieldId);

            if (battleField.BattleState == BattleState.Running)
            {
                Robot robot = battleField.GetRobot(robotId);

                _robotAction = new RobotActions(robot, attackStrength);
                damage       = new AttackAction(_robotAction).Execute();
            }
            else
            {
                damage = -99; //battle not running
            }

            return(damage);
        }
コード例 #5
0
        public int RobotsInBattleCount(string battleFieldId)
        {
            BattleField battle = BattleFields.GetBattleField(battleFieldId);

            return(battle.Robots.Count);
        }
コード例 #6
0
        public List <Robot> RobotsInBattle(string battleFieldId)
        {
            BattleField battle = BattleFields.GetBattleField(battleFieldId);

            return(battle.Robots);
        }
コード例 #7
0
 public BattleField GetBattle(string battleFieldId)
 {
     return(BattleFields.GetBattleField(battleFieldId));
 }