示例#1
0
文件: Enemy.cs 项目: Penjat/SQuest
 private void Attack()
 {
     _delegate.AttackPlayer(2);
     _delegate.EnemyMsg("The " + "Imp".ColorFor(Entity.ENEMY) + " slaps you");
     _card.Attack();
     StartCoroutine(WaitFor(2.0f, DoneTurn));
 }
示例#2
0
        private AI_DFS_Decision MakeDecision_Using_Board(AI_DFS_Decision previousState)
        {
            AI_DFS_Decision bestDecision = previousState;

            for (int i = 0; i < previousState.GetPlayerState(playerNr).GetValidBoardOptions().Count; i++)
            {
                //No need for duplicating the board yet, as we are only getting possible targets
                List <ICard>   originalOptions       = previousState.GetPlayerState(playerNr).GetValidBoardOptions();
                List <ITarget> originalTargetOptions = originalOptions[i].GetAttackTargetOptions(previousState.GetBoard());
                for (int y = 0; y < originalTargetOptions.Count; y++)
                {
                    BoardState       newBoard       = previousState.GetBoard().Copy();
                    PlayerBoardState newPlayerState = newBoard.GetPlayer(playerNr);
                    ICard            actionCard     = newPlayerState.GetValidBoardOptions()[i];
                    ITarget          target         = actionCard.GetAttackTargetOptions(newBoard)[y];

                    Singletons.GetPrinter().AI_AttackCard(actionCard, target);

                    if (target.GetOwner() == actionCard.GetOwner())
                    {
                        throw new Exception("ATTACKING MY OWN UNITS!?");
                    }

                    actionCard.Attack(target);
                    AI_DFS_Decision exhaustedDecision = MakeDecision(new AI_DFS_Decision(newBoard, GetBoardStateAsValue(newBoard)));

                    if (bestDecision.GetValue() < exhaustedDecision.GetValue())
                    {
                        bestDecision = exhaustedDecision;
                    }
                }
            }
            return(bestDecision);

            //List<ICard> options = playerState.GetValidBoardOptions();
            //ICard actionCard = options[random.Next(0, options.Count)];

            //List<ITarget> targetOptions = actionCard.GetAttackTargetOptions(state);
            //ITarget target = targetOptions[random.Next(0, targetOptions.Count)];

            //Singletons.GetPrinter().AttackCard(actionCard, target);


            //if (target.GetOwner() == actionCard.GetOwner())
            //    throw new Exception("ATTACKING MY OWN UNITS!?");

            //actionCard.Attack(target);
        }
示例#3
0
        private void MakeDecision_CardPool_Board(BoardState state)
        {
            List <ICard> options    = GetPlayer(state).GetValidBoardOptions();
            ICard        actionCard = options[random.Next(0, options.Count)];

            List <ITarget> targetOptions = actionCard.GetAttackTargetOptions(state);
            ITarget        target        = targetOptions[random.Next(0, targetOptions.Count)];

            Singletons.GetPrinter().AttackCard(actionCard, target);


            if (target.GetOwner() == actionCard.GetOwner())
            {
                throw new Exception("ATTACKING MY OWN UNITS!?");
            }

            actionCard.Attack(target);
        }
示例#4
0
 public void Play(BoardState board, PlayerBoardState playerState)
 {
     actionCard.Attack(playerState.opponent.Hero);
 }
示例#5
0
 public void Play(BoardState board, PlayerBoardState playerState)
 {
     actionCard.Attack(target);
 }