Example #1
0
 public void InitNewTurn()
 {
     Phase = BattlePhase.Draw;
     this.Turn.Player.DefenseField.ForEach(c => c.CanBeMoved = true);
     this.Turn.Player.AtackField.ForEach(c => c.CanBeMoved = true);
     if (this.Turn.Player.IsAIControlled)
     {
         AIPlayer _player = new AIPlayer(this.Turn.Player, this);
         _player.PrepareOffense();
     }
 }
Example #2
0
        public int ChooseAttackers(int[] cardIds)
        {
            GameEngine engine = new GameEngine(Session);

            Battle battle = engine.Battle;
            Player player = battle.Turn.Player;

            if (player.IsAIControlled)
                return 0;

            if (battle.Phase == BattlePhase.Main)
                battle.EndPhase();

            if (battle.Phase != BattlePhase.Attack)
                return 0;
            if (cardIds != null)
            {
                var cards = player.ChooseAttackers(cardIds);

                battle.Turn.SetAttackers(cards);
                battle.EndPhase();
                var ai = new AIPlayer(battle.player1, battle);
                ai.PrepareDefense(cardIds);
            }
            else
            {
                battle.EndTurn();
            }

            return 1;
        }