public override bool doIParticipateInTournament(Player currPlayer, ActiveTourney tourney, Player[] players)
    {
        tounamentReward = tourney.getAwardNum();
        bool someoneWillEvolve = false;

        for (int i = 0; i < players.Length; i++)
        {
            if (players[i] != player)
            {
                if (hp.willPlayerEvolve(players[i], tounamentReward))
                {
                    someoneWillEvolve = true;
                }
            }
        }
        if (currPlayer == player && someoneWillEvolve)
        {
            Debug.Log("Joining tournament");
            return(true);
        }
        else
        {
            Debug.Log("Not joining tournament");
            return(false);
        }
    }
 public void createTourney(Card tourneyCard)
 {
     log.log("Tournament at " + tourneyCard.getName() + " has begun");
     tourney = new ActiveTourney(tourneyCard);
     ui.showCard(tourneyCard);
     activePlayerSub = activePlayerMeta;
     getPlayersTourney();
 }
示例#3
0
 public override bool doIParticipateInTournament(Player currPlayer, ActiveTourney tourney, Player[] players)
 {
     if (currPlayer == player)
     {
         Debug.Log("Joining tournament");
         return(true);
     }
     else
     {
         Debug.Log("Not joining tournament");
         return(false);
     }
 }
 public void endTourney()
 {
     gameState = state.TOURNEYWRAPUP;
     if (tourney.getPlayerNum() == 0)
     {
         drawQuestCard();
         return;
     }
     tourney.awardShields();
     log.log(tourney.getWinner().getName() + " won the tournament and is awarded " + tourney.getAwardNum() + " shields");
     ui.displayAlert(tourney.getWinner().getName() + " won the tournament and is awarded " + tourney.getAwardNum() + " shields");
     tourney = null;
     drawQuestCard();
 }
示例#5
0
    public override Card[] playTournament(ActiveTourney tourney)
    {
        Card[] tempHand = getOnlyType("ally", "weapon", "amour");
        tempHand = sortHand(tempHand);
        int BPtotal = 0;

        Card[] submit = null;
        for (int i = tempHand.Length - 1; i >= 0; i--)
        {
            if (BPtotal < 50 && BPtotal + tempHand[i].getBP() <= 50)                //if we have less than 50, and adding this wouldn't go over 50, add it, then find the next card cost down
            {
                submit  = hp.addCard(submit, tempHand[i]);
                BPtotal = BPtotal + tempHand [i].getBP();
            }
            if (BPtotal >= 50)
            {
                break;
            }
        }
        return(submit);
    }
示例#6
0
 abstract public Card[] playTournament(ActiveTourney tourney);
示例#7
0
 //When tournament is played, this is called so AI decides whether/what to submit. Returns the cards it wants to play. If empty array, AI refuses to play.
 abstract public bool doIParticipateInTournament(Player currPlayer, ActiveTourney tourney, Player[] players);
    public override Card[] playTournament(ActiveTourney tourney)
    {
        bool someoneWillEvolve = false;
        bool iWillEvolve       = false;

        Card[] tempHand = getOnlyType("ally", "weapon", "amour");
        tempHand = sortHand(tempHand);
        int BPtotal = 0;

        Card[] submit = null;

        for (int i = 0; i < tourney.getPlayerArr().Length; i++)
        {
            if (tourney.getPlayerArr()[i] != player)
            {
                if (hp.willPlayerEvolve(tourney.getPlayerArr()[i], tounamentReward))
                {
                    someoneWillEvolve = true;
                }
            }
        }

        iWillEvolve = hp.willPlayerEvolve(player, tounamentReward);
        if (iWillEvolve || someoneWillEvolve)
        {
            Card [] weaponHand = getOnlyType("weapon");
            weaponHand = sortHand(weaponHand);

            Card [] amourHand = getOnlyType("amour");
            amourHand = sortHand(amourHand);

            Card [] allyHand = getOnlyType("ally");
            allyHand = sortHand(allyHand);

            if (amourHand != null)
            {
                for (int i = 0; i < amourHand.Length; i++)
                {
                    submit = hp.addCard(submit, amourHand[i]);
                }
            }
            if (allyHand != null)
            {
                for (int i = 0; i < allyHand.Length; i++)
                {
                    submit = hp.addCard(submit, allyHand[i]);
                }
            }
            if (weaponHand != null)
            {
                for (int i = 0; i < weaponHand.Length; i++)
                {
                    if (!hp.checkIfArrayContainsCard(submit, weaponHand[i]))
                    {
                        submit = hp.addCard(submit, weaponHand[i]);
                    }
                }
            }
            player.discardCard(submit);
            return(submit);
        }
        else
        {
            for (int i = 0; i < hand.Length; i++)
            {
                if (hp.numberOfCardInstancesInHand(hand, hand[i]) >= 2)
                {
                    submit = hp.addCard(submit, hand[i]);
                    player.discardCard(submit);
                    return(submit);
                }
            }
        }
        return(submit);
    }