Exemple #1
0
    //levels up or class changes a card on the field
    //should only be called by the ContextMenu buttons and so doesn't do any checks on location, etc.
    public void PlayToFieldFromHand(BasicCard card, bool classChange)
    {
        //Increment the used bond count before anything on the board changes.
        if (classChange)
        {
            GameManager.instance.bondDeployCount += card.PromotionCost;
        }
        else    //this is just a level up
        {
            GameManager.instance.bondDeployCount += card.DeploymentCost;
        }

        //remove the card from the hand.
        Hand.Remove(card);

        //Find the location on the field to play the card to.
        CardStack stackToAddTo = FieldStacks.Find(x => x.TopCard.CompareNames(card, true));

        //Post this action to the Game Log
        if (classChange)
        {
            CardReader.instance.UpdateGameLog(card.Owner.playerName + " class changes " + stackToAddTo.TopCard.CharName + " into "
                                              + card.CharName + ": " + card.CharTitle + "!");
        }
        else
        {
            CardReader.instance.UpdateGameLog(card.Owner.playerName + " levels up " + stackToAddTo.TopCard.CharName + " into "
                                              + card.CharName + ": " + card.CharTitle + "!");
        }

        stackToAddTo.AddCardToStack(card, classChange);

        //Draw a card and/or call skills as appropriate.
        if (classChange)
        {
            Draw(1);
            //Call class change SKILLS
        }
        else //this is just a level up
        {
            //call level up SKILLS
        }

        //TEMP location for the FieldChangeEvent skill calls.  Should actually be before class change and/or level up skills once implemented?
        FieldChangeEvent.Invoke();

        //once any skills have activated, then we can update the deployment text with any changes.
        GameManager.instance.UpdateDeploymentHintText();
    }
Exemple #2
0
    //This helper method discards a given card from the field.  This is tricky as both the card and its stack need to be discarded.
    public void DiscardCardFromField(BasicCard card)
    {
        if (!FieldCards.Contains(card))
        {
            Debug.LogError(card.ToString() + " was not found on the field.  Why are you calling DiscardCardFromField()???");
            return;
        }

        //Find the stack that contains the card to be removed.
        CardStack stackToRemove = FieldStacks.Find(x => x.TopCard == card);

        //Remove the stack from the field.
        if (FrontLineStacks.Contains(stackToRemove))
        {
            frontLine.Remove(stackToRemove);
        }
        else if (BackLineStacks.Contains(stackToRemove))
        {
            backLine.Remove(stackToRemove);
        }
        else
        {
            Debug.LogError(stackToRemove.ToString() + " could not be found in the field stacks.  Please investigate!");
            return;
        }

        CardReader.instance.UpdateGameLog(playerName + "'s " + card.CharName + " is sent to the Retreat Area.");

        List <BasicCard> stackedCards = layoutManager.RemoveStackFromField(stackToRemove);

        //place the cards removed from the field in the retreat zone.
        for (int i = 0; i < stackedCards.Count; i++)
        {
            retreat.Add(stackedCards[i]);
            layoutManager.PlaceInRetreat(stackedCards[i]);
            Debug.Log(card.ToString() + " was placed in the Retreat Zone.");
        }

        //Activate any effects related to the change in the field or sending a card to the retreat.
        FieldChangeEvent.Invoke();
    }
Exemple #3
0
    //This general method decides where/how to deploy a given card and then calls an appropriate helper method.
    //NOTE: This method was made obsolete by the deploy/LevelUp/ClassChange split, but is being kept for reintegration for skill deploys
    //New Name: PlayToFieldWithSkill

    /*
     * public void DeployToField(BasicCard card, List<BasicCard> presentLocation)
     * {
     *  //Check if the card is where it should be right now, then remove it, else throw an error.
     *  if (!presentLocation.Contains(card))
     *  {
     *      Debug.LogError("ERROR! Tried to deploy card, but " + card.ToString() + " not found in " + presentLocation.ToString());
     *  }
     *  else
     *  {
     *      presentLocation.Remove(card);
     *
     *      //Checks if the card is already on the field in which case this is a level up or class change.
     *      if (FieldCards.Exists(x => x.CharName.Equals(card.CharName)))
     *      {
     *          Debug.Log(card.CharName + " is already on the field.  Performing a Level up.");
     *          CardStack stackToAddTo = FieldStacks.Find(x => x.TopCard.CharName.Equals(card.CharName));
     *          stackToAddTo.AddCardToStack(card);
     *          if (card.PromotionCost > 0)
     *          {
     *              GameManager.instance.bondDeployCount += card.PromotionCost;
     *          }
     *          else
     *          {
     *              GameManager.instance.bondDeployCount += card.DeploymentCost;
     *          }
     *          GameManager.instance.UpdateDeploymentHintText();
     *      }
     *      else //The card is not on the field, so we need to know where to deploy it.  Call a dialogue box.
     *      {
     *          DialogueWindowDetails details = new DialogueWindowDetails
     *          {
     *              windowTitleText = "Deployment",
     *              questionText = "Where would you like to deploy " + card.CharName + "?",
     *              button1Details = new DialogueButtonDetails
     *              {
     *                  buttonText = "Front Line",
     *                  buttonAction = () => { frontLine.Add(layoutManager.PlaceInFrontLine(card));
     *                      GameManager.instance.bondDeployCount += card.DeploymentCost; GameManager.instance.UpdateDeploymentHintText();
     *                  },
     *              },
     *              button2Details = new DialogueButtonDetails
     *              {
     *                  buttonText = "Back Line",
     *                  buttonAction = () => { backLine.Add(layoutManager.PlaceInBackLine(card));
     *                      GameManager.instance.bondDeployCount += card.DeploymentCost; GameManager.instance.UpdateDeploymentHintText();
     *                  },
     *              }
     *          };
     *
     *          DialogueWindow dialogueWindow = DialogueWindow.Instance();
     *          dialogueWindow.MakeChoice(details);
     *      }
     *  }
     * }
     */

    //moves a card from one part of the field to the other.  This is something of a catch all method and so tapping is done in another place.
    public void MoveCard(BasicCard card)
    {
        Debug.Log("Moving " + card.ToString() + ".");

        //Check if the card is where it should be else throw an error.
        if (!FieldCards.Contains(card))
        {
            Debug.LogError("ERROR! Tried to move card, but " + card.ToString() + " not found on the field.");
        }
        else
        {
            //Locates the CardStack to move on the field.
            CardStack stackToMove = FieldStacks.Find(x => x.TopCard == card);

            //determines how and from where to move the stack.
            if (FrontLineStacks.Contains(stackToMove))
            {
                MoveStackToBackLine(stackToMove);
                CardReader.instance.UpdateGameLog(playerName + "'s " + card.CharName + ": " + card.CharTitle
                                                  + " moves to the Back Line!");
            }
            else if (BackLineStacks.Contains(stackToMove))
            {
                MoveStackToFrontLine(stackToMove);
                CardReader.instance.UpdateGameLog(playerName + "'s " + card.CharName + ": " + card.CharTitle
                                                  + " moves to the Front Line!");
            }
            else
            {
                Debug.LogError("The CardStack " + stackToMove.ToString() + " could not be found on the field...");
            }



            CheckForcedMarch();
        }
    }