コード例 #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();
    }