Exemple #1
0
 private void checkIfDead(Side side, FunctionalRow row, Card card)
 {
     if (card.cardProps.defense <= 0)
     {
         Kill(side, row, card);
     }
 }
 private bool isRowRevealed(FunctionalRow row)
 {
     if (row.revealed)
     {
         return(true);
     }
     return(false);
 }
 private bool rowCanBeAttacked(FunctionalRow row)
 {
     if (row.cardsInContainer.Count > 0 && row.revealed)
     {
         return(true);
     }
     return(false);
 }
Exemple #4
0
        public override void fieldLogic(MouseState mouseState, FunctionalRow row, Card card, BoardFunctionality boardFunc)
        {
            if (clickedInCardBox)
            {
                if (!row.isWithinModifiedPosition(mouseState, card))
                {
                    if (selectAction.TargetEnemyCard(mouseState, boardFunc, false) != null)
                    {
                        MouseTransformer.Set(MouseTransformer.State.Reg);
                        if (selectAction.TargetEnemyCard(mouseState, boardFunc, false).correctRow(boardFunc.enemySide).revealed)
                        {
                            switch (selectAction.TargetEnemyCard(mouseState, boardFunc, false).correctRow(boardFunc.enemySide).type)
                            {
                            case CardType.FieldUnit:
                                boardFunc.Fight(card, selectAction.TargetEnemyCard(mouseState, boardFunc, false));
                                break;

                            case CardType.Army:
                                if (boardFunc.enemySide.Rows[Side.FieldUnit].isEmpty())
                                {
                                    boardFunc.Fight(card, selectAction.TargetEnemyCard(mouseState, boardFunc, false));
                                }
                                else if (!boardFunc.enemySide.Rows[Side.FieldUnit].isEmpty())
                                {
                                    boardFunc.BOARDMESSAGE.addMessage("Cannot fight an Army if a FieldUnit is present on the board!");
                                }
                                break;

                            case CardType.General:
                                boardFunc.BOARDMESSAGE.addMessage("A FieldUnit cannot target a General!");
                                break;
                            }
                        }
                    }
                    else
                    {
                        MouseTransformer.Set(MouseTransformer.State.Atk);
                        resetIfNoSelection(mouseState, row, card, boardFunc);
                    }
                }
                if (mouseState.LeftButton == ButtonState.Released && boardFunc.enemySide.Life.isWithinBox(mouseState))
                {
                    if (boardFunc.enemySide.Rows[Side.FieldUnit].isEmpty() && boardFunc.enemySide.Rows[Side.Armies].isEmpty() && boardFunc.enemySide.Rows[Side.Armies].revealed)
                    {
                        boardFunc.LifeDamage(card);
                    }
                    else
                    {
                        boardFunc.BOARDMESSAGE.addMessage("---> or Fog");
                        boardFunc.BOARDMESSAGE.addMessage("---> an Enemy Army");
                        boardFunc.BOARDMESSAGE.addMessage("---> an Enemy FieldUnit");
                        boardFunc.BOARDMESSAGE.addMessage("Cannot deal damage to a player if there's:");
                    }
                    resetIfNoSelection(mouseState, row, card, boardFunc);
                }
                resetIfNoSelection(mouseState, row, card, boardFunc);
            }
        }
        private int getCumulativeValue(FunctionalRow row)
        {
            int counter = getCumulativeAttack(row) + getCumulativeDefense(row);

            foreach (Card card in row.cardsInContainer)
            {
                counter += card.cardProps.cost.totalCost;
            }
            return(counter);
        }
        private int getCumulativeAttack(FunctionalRow row)
        {
            int counter = 0;

            foreach (Card card in row.cardsInContainer)
            {
                counter += card.cardProps.power;
            }
            return(counter);
        }
        private int getCumulativeDefense(FunctionalRow row)
        {
            int counter = 0;

            foreach (Card card in row.cardsInContainer)
            {
                counter += card.cardProps.defense;
            }
            return(counter);
        }
Exemple #8
0
 public override void fieldLogic(MouseState mouseState, FunctionalRow row, Card card, BoardFunctionality boardFunc)
 {
     if (clickedInCardBox)
     {
         if (!row.isWithinModifiedPosition(mouseState, card))
         {
             resetIfNoSelection(mouseState, row, card, boardFunc);
         }
     }
 }
Exemple #9
0
 public override void setCardToView(MouseState mouseState, FunctionalRow row, BoardFunctionality boardFunc, bool friendly)
 {
     base.setCardToView(mouseState, row, boardFunc, friendly);
     foreach (Card card in row.cardsInContainer)
     {
         if (friendly)
         {
             fieldLogic(mouseState, row, card, boardFunc);
         }
     }
 }
Exemple #10
0
        public override void fieldLogic(MouseState mouseState, FunctionalRow row, Card card, BoardFunctionality boardFunc)
        {
            if (mouseState.RightButton == ButtonState.Pressed && row.isWithinModifiedPosition(mouseState, card) && !card.cardProps.exhausted)
            {
                rightClickedInBox = true;
            }
            if (mouseState.RightButton == ButtonState.Released && rightClickedInBox && row.isWithinModifiedPosition(mouseState, card))
            {
                rightClickedInBox        = false;
                card.cardProps.exhausted = true;

                boardFunc.friendlySide.Resources.Add(card.race);
                boardFunc.cardViewer.resetSelectedCard(boardFunc);
                card.setRegular();
            }

            resetIfNoSelection(mouseState, row, card, boardFunc);
        }
Exemple #11
0
        public void viewLogic(MouseState mouseState, FunctionalRow row, Card card, BoardFunctionality boardFunc)
        {
            if (mouseState.LeftButton == ButtonState.Pressed && row.isWithinModifiedPosition(mouseState, card))
            {
                //card.setPos(mouseState.X - card.getWidth() / 2, mouseState.Y - card.getHeight() / 2);
                clickedInCardBox = true;
            }

            if (mouseState.LeftButton == ButtonState.Released && clickedInCardBox)
            {
                if (row.isWithinModifiedPosition(mouseState, card))
                {
                    clickedInCardBox = false;
                    boardFunc.state  = BoardFunctionality.State.CardView;
                }
                clickedInCardBox = false;
                MouseTransformer.Set(MouseTransformer.State.Reg);
            }
        }
Exemple #12
0
 public Side(Player player)
 {
     Deck          = player.deck;
     Player        = player;
     Deck          = new Deck();
     Rows          = new FunctionalRow[MaxRows];
     Resources     = new List <Race>();
     Rows[General] = new FunctionalRow(CardType.General);
     Rows[General].setVisibility(false);
     Rows[Armies] = new ArmyRow(CardType.Army);
     Rows[Armies].setVisibility(false);
     Rows[FieldUnit] = new FunctionalRow(CardType.FieldUnit);
     Rows[FieldUnit].setVisibility(true);
     boardFunc = new BoardFunctionality();
     Hand      = new Hand();
     Oblivion  = new CardContainer();
     LifeTotal = SetLife;
     Life      = new CardContainer();
 }
Exemple #13
0
        private void setBoardPosition(FunctionalRow row)
        {
            int counter = 0;
            int spacing = 10; //already Preset

            row.resetCardSpacingInHorizontalContainer();

            foreach (Card card in row.cardsInContainer)
            {
                if (card != SELECTEDCARD && !card.makingAction)
                {
                    scaleToBoard(card);
                    card.resetCardSelector();
                    row.setCorrectCenterSpacing(card);
                    Vector2 newPosition = new Vector2(row.getPosition().X - row.initialSpacing + spacing + counter * (card.getWidth() - row.horizontalSpacing), row.getPosition().Y);
                    card.setPos(newPosition);
                }
                counter++;
            }
        }
Exemple #14
0
        public virtual void setCardToView(MouseState mouseState, FunctionalRow row, BoardFunctionality boardFunc, bool friendly)
        {
            foreach (Card card in row.cardsInContainer)
            {
                if (card.isSelected())
                {
                    if (friendly)
                    {
                        boardFunc.SELECTEDCARD = card;
                        if (boardFunc.state != BoardFunctionality.State.CardView)
                        {
                            fieldLogic(mouseState, row, card, boardFunc);
                            viewLogic(mouseState, row, card, boardFunc);
                        }
                        else
                        {
                            boardFunc.cardViewer.viewCardWithAbilities(mouseState, card, boardFunc);
                        }
                    }
                    if (!friendly && row.revealed)
                    {
                        if (boardFunc.state != BoardFunctionality.State.CardView)
                        {
                            boardFunc.ENEMYSELECTEDCARD = card;
                            //boardFunc.SELECTEDCARD = card;
                            viewLogic(mouseState, row, card, boardFunc);
                        }
                        else
                        {
                            boardFunc.cardViewer.viewFullSizeCard(mouseState, card, boardFunc);
                        }
                    }
                }

                /*if (boardFunc.state == BoardFunctionality.State.Regular)
                 * {
                 *  viewLogic(mouseState, row, card, boardFunc);
                 * }*/
            }
        }
        public void attackRow(FunctionalRow row, BoardFunctionality boardFunc)
        {
            playDictionary = new Dictionary <Card, CardPlayShell>();
            foreach (Card friendlyCard in boardFunc.friendlySide.Rows[Side.FieldUnit].cardsInContainer)
            {
                if (!friendlyCard.cardProps.exhausted)
                {
                    CardPlayShell cardPlayShell = new CardPlayShell();
                    foreach (Card enemyCard in row.cardsInContainer)
                    {
                        cardPlayShell.AddEnemy(enemyCard);
                    }
                    cardPlayShell.SetCardToMakePlay(friendlyCard);
                    cardPlayShell.SetPlays(boardFunc);
                    playDictionary.Add(friendlyCard, cardPlayShell);
                }
            }

            List <Card> list       = boardFunc.friendlySide.Rows[Side.FieldUnit].cardsInContainer;
            int         lastMember = boardFunc.friendlySide.Rows[Side.FieldUnit].unexhaustedCount() - 1;

            Iterate(lastMember, list);                   //biggish load of work for comp, maybe make this async?
            groupPlayManager.executeBestPlay(boardFunc); //assign those sweet actions
        }
Exemple #16
0
 public abstract void fieldLogic(MouseState mouseState, FunctionalRow row, Card card, BoardFunctionality boardFunc);
Exemple #17
0
 public void Kill(Side side, FunctionalRow row, Card card)
 {
     actionConstructor.moveTo(row, side.Oblivion, card, this);
 }