Пример #1
0
    public override void LearnHand(PlayerController owner)
    {
        CardController cc = owner.RevealHand(this);

        Debug.LogFormat("{0} now knows that {1} has the {2} in hand!", this, owner, cc);
        MyPerceptor.LearnHand(owner, cc);
    }
Пример #2
0
 protected float GetTacticalDanger(PlayerController Player, CardController RemainingHand)
 {
     if (Player == null || Player == this)
     {
         return(0);
     }
     else
     {
         float roundHistoryDanger    = GetRelativePriority(Player, MyPerceptor.HowManyOthersHasPlayerKnockedOut);
         float playerKnowledgeDanger = (MyPerceptor.PlayerThinksMyHandIs(Player) == RemainingHand.Value) ? 1f : 0;
         return((roundHistoryDanger + playerKnowledgeDanger) / 2f);
     }
 }
Пример #3
0
 public override CardController RevealHand(PlayerController toPlayer)
 {
     MyPerceptor.RevealHand(toPlayer);
     return(myHand);
 }
Пример #4
0
 protected override void postMoveSelectHook()
 {
     MyPerceptor.UpdateOwnHand(myHand, justDrawn);
 }
Пример #5
0
 public override void Reset()
 {
     base.Reset();
     MyPerceptor.ResetMemory();
 }
Пример #6
0
    // Returns whether the move under consideration looks stupid or not
    protected bool IsMoveStupid(MoveData move, CardController otherCard)
    {
        // Penalize playing against the human playing before they had a first turn after launching a game
        if (move.Target == Game.HumanPlayer && !MyPerceptor.HumanPlayerHasActed)
        {
            return(true);
        }
        // Playing anything against a player protected by a Handmaid looks stupid
        if (move.Target != null && move.Target.Protected)
        {
            return(true);
        }
        // NOT playing your hand when someone else knows your hand and there are still Guards in play
        if (MyPerceptor.SomeoneKnowsMyHand && move.Card != myHand && move.Card.Value != otherCard.Value &&
            move.Card.Value != CardController.VALUE_HANDMAID &&
            MyPerceptor.GetRevealedCardCount(CardController.VALUE_GUARD) < GameController.CARD_COUNT[CardController.VALUE_GUARD])
        {
            return(true);
        }
        // Playing the higher card in the very last round
        if (MyPerceptor.RemainingDeckSize <= 1 && move.Card.Value > otherCard.Value)
        {
            return(true);
        }
        // Otherwise, it depends on the type of card
        switch (move.Card.Value)
        {
        case CardController.VALUE_GUARD:
            // Guessing a card when all cards of that value are either on the discard pile, or in your own hand
            if (MyPerceptor.GetRevealedCardCount(move.TargetHandGuess) >= GameController.CARD_COUNT[move.TargetHandGuess])
            {
                return(true);
            }
            else if (MyPerceptor.GetCertainHandValue(move.Target) != move.TargetHandGuess && KnowAtLeastOneOtherHand)
            {
                // Playing a Guard against a player whose hand you don't know when you know someone else's hand
                return(true);
            }
            return(false);

        case CardController.VALUE_PRIEST:
            // Playing a Priest against a player whose hand you already know
            return(MyPerceptor.GetCertainHandValue(move.Target) > 0);

        case CardController.VALUE_BARON:
            // Playing a Baron when your other card is a guard is stupid, period
            if (otherCard.Value == CardController.VALUE_GUARD)
            {
                return(true);
            }
            else if (otherCard.Value < MyPerceptor.GetCertainHandValue(move.Target))
            {
                // Playing a Baron against a player who you know has as higher hand
                return(true);
            }
            return(false);

        case CardController.VALUE_PRINCE:
            // Playing a Prince against yourself in general
            if (move.Target == this)
            {
                return(true);
            }
            else
            {
                // Playing a Prince against anyone else when you know who has the Princess
                int hasThePrincess = WhoHasThePrincess;
                return(hasThePrincess >= 0 && move.Target.SittingOrder != hasThePrincess);
            }

        case CardController.VALUE_KING:
            // Playing a King when your other card is a guard is just handing them the key to knock you out
            if (otherCard.Value == CardController.VALUE_GUARD)
            {
                return(true);
            }
            else
            {
                // Playing a King against anyone who will have a chance to knock you out
                bool thereAreStillGuardsInPlay = (MyPerceptor.GetRevealedCardCount(CardController.VALUE_GUARD) < GameController.CARD_COUNT[CardController.VALUE_GUARD]);
                return(MyPerceptor.WillThisPlayerHaveAnotherTurn(move.Target) && thereAreStillGuardsInPlay);
            }

        default:
            return(false);
        }
    }