コード例 #1
0
    // Get power from card.
    public int getPowerFromCard(Card c)
    {
        if (c.GetType() == typeof(WeaponCard))
        {
            WeaponCard currWeapon = (WeaponCard)c;
            return(currWeapon.power);
        }

        if (c.GetType() == typeof(AmourCard))
        {
            AmourCard currAmour = (AmourCard)c;
            return(currAmour.power);
        }

        if (c.GetType() == typeof(AllyCard))
        {
            AllyCard currAlly = (AllyCard)c;

            int currAllyPower = currAlly.power;

            //Quest Condition
            if (_storyCard.GetType() == typeof(QuestCard))
            {
                QuestCard currQuest = (QuestCard)_storyCard;
                //Same Quest
                if (currAlly.questCondition == currQuest.name)
                {
                    currAllyPower += currAlly.bonusPower;
                }
            }

            //Ally Condition
            if (currAlly.allyCondition != null)
            {
                //Go Through The Players
                for (int x = 0; x < _players.Count; x++)
                {
                    List <Card> currInPlay = _players[x].inPlay;
                    for (int i = 0; i < currInPlay.Count; i++)
                    {
                        //If ally card
                        if (currInPlay[i].GetType() == typeof(AllyCard))
                        {
                            AllyCard compareAlly = (AllyCard)currInPlay[i];
                            if (currAlly.allyCondition == compareAlly.name)
                            {
                                currAllyPower += currAlly.bonusPower;
                                return(currAllyPower);
                            }
                        }
                    }
                }
            }
            return(currAllyPower);
        }

        return(0);
    }
コード例 #2
0
    public void Test_Amour()
    {
        AmourCard amourCard = new AmourCard("amour", 10, 10, "amour.png");

        Assert.AreEqual(amourCard.name, "amour");
        Assert.AreEqual(amourCard.power, 10);
        Assert.AreEqual(amourCard.bid, 10);
        Assert.AreEqual(amourCard.asset, "amour.png");
    }
コード例 #3
0
    public void AmourCard_CreatedWithGiven_WillHaveTheVariables()
    {
        var amour = new AmourCard("Amour Card", "Amour", " ", 1, 10);

        amour.display();
        Assert.AreEqual("Amour Card", amour.type);
        Assert.AreEqual("Amour", amour.name);
        Assert.AreEqual(" ", amour.texturePath);
        Assert.AreEqual(1, amour.bid);
        Assert.AreEqual(10, amour.battlePoints);

        // Use the Assert class to test conditions.
    }
コード例 #4
0
    protected List <AmourCard> extractAmours(List <Card> hand)
    {
        List <AmourCard> amourCards = new List <AmourCard>();

        for (int i = 0; i < hand.Count; i++)
        {
            if (hand [i] is AmourCard)
            {
                AmourCard currAmour = (AmourCard)hand [i];
                amourCards.Add(currAmour);
            }
        }
        return(amourCards);
    }
コード例 #5
0
    //NEEDS CHANGESSSSSSSSSSSS!!!!!!!!!!!!!!
    public void CalculateTotalBP()
    {
        int total = 0;

        strategyUtil util = new strategyUtil();

        for (int i = 0; i < selectedCards.Count; i++)
        {
            if (selectedCards[i].type == "Foe Card")
            {
                FoeCard foe = (FoeCard)selectedCards[i];

                if (QuestState.currentQuest != null)
                {
                    total += util.getContextBP(foe, QuestState.currentQuest.foe);
                }
                else
                {
                    total += foe.minBP;
                }
            }
            else if (selectedCards[i].type == "Weapon Card")
            {
                WeaponCard weapon = (WeaponCard)selectedCards[i];
                total += weapon.battlePoints;
            }
            else if (selectedCards[i].type == "Ally Card")
            {
                AllyCard ally = (AllyCard)selectedCards[i];
                total += ally.battlePoints;
            }
            else if (selectedCards[i].type == "Amour Card")
            {
                AmourCard amour = (AmourCard)selectedCards[i];
                total += amour.battlePoints;
            }
        }

        totalBP.text = "BP: " + total.ToString();
    }
コード例 #6
0
    // Load the cards up.
    public void loadCards(List <Card> cards, GameObject area)
    {
        Card currCard;

        // Create Card GameObject's.
        for (int i = 0; i < cards.Count; i++)
        {
            currCard = cards[i];

            area.GetComponent <CardArea>().addCard(currCard);
            GameObject CardUI = null;

            // TODO: Clean this up.
            if (currCard.GetType() == typeof(WeaponCard))
            {
                WeaponCard currWeapon = (WeaponCard)currCard;
                CardUI = Instantiate(WeaponCard, new Vector3(), Quaternion.identity);
                //CardUI = Instantiate(WeaponCard ,area.transform);
                CardUI.GetComponent <WeaponCard>().name  = currWeapon.name;
                CardUI.GetComponent <WeaponCard>().asset = currWeapon.asset;
                CardUI.GetComponent <WeaponCard>().power = currWeapon.power;
            }
            else if (currCard.GetType() == typeof(FoeCard))
            {
                FoeCard currFoe = (FoeCard)currCard;
                CardUI = Instantiate(FoeCard, new Vector3(), Quaternion.identity);
                //CardUI = Instantiate(FoeCard,area.transform);
                CardUI.GetComponent <FoeCard>().name    = currFoe.name;
                CardUI.GetComponent <FoeCard>().type    = currFoe.type;
                CardUI.GetComponent <FoeCard>().loPower = currFoe.loPower;
                CardUI.GetComponent <FoeCard>().hiPower = currFoe.hiPower;
                CardUI.GetComponent <FoeCard>().special = currFoe.special;
                CardUI.GetComponent <FoeCard>().asset   = currFoe.asset;
            }
            else if (currCard.GetType() == typeof(AllyCard))
            {
                AllyCard currAlly = (AllyCard)currCard;
                CardUI = Instantiate(AllyCard, new Vector3(), Quaternion.identity);
                //CardUI = Instantiate(AllyCard,area.transform);
                CardUI.GetComponent <AllyCard>().name           = currAlly.name;
                CardUI.GetComponent <AllyCard>().asset          = currAlly.asset;
                CardUI.GetComponent <AllyCard>().special        = currAlly.special;
                CardUI.GetComponent <AllyCard>().power          = currAlly.power;
                CardUI.GetComponent <AllyCard>().bid            = currAlly.bid;
                CardUI.GetComponent <AllyCard>().bonusPower     = currAlly.bonusPower;
                CardUI.GetComponent <AllyCard>().bonusBid       = currAlly.bonusBid;
                CardUI.GetComponent <AllyCard>().questCondition = currAlly.questCondition;
                CardUI.GetComponent <AllyCard>().allyCondition  = currAlly.allyCondition;
            }
            else if (currCard.GetType() == typeof(AmourCard))
            {
                AmourCard currAmour = (AmourCard)currCard;
                CardUI = Instantiate(AmourCard, new Vector3(), Quaternion.identity);
                CardUI = Instantiate(AmourCard, area.transform);
                CardUI.GetComponent <AmourCard>().name  = currAmour.name;
                CardUI.GetComponent <AmourCard>().asset = currAmour.asset;
                CardUI.GetComponent <AmourCard>().power = currAmour.power;
                CardUI.GetComponent <AmourCard>().bid   = currAmour.bid;
            }
            else if (currCard.GetType() == typeof(TestCard))
            {
                TestCard currTest = (TestCard)currCard;
                CardUI = Instantiate(TestCard, new Vector3(), Quaternion.identity);
                //CardUI = Instantiate(TestCard,area.transform);
                CardUI.GetComponent <TestCard>().name    = currTest.name;
                CardUI.GetComponent <TestCard>().asset   = currTest.asset;
                CardUI.GetComponent <TestCard>().minBids = currTest.minBids;
            }

            // Load the card sprite.
            Sprite card = Resources.Load <Sprite>(currCard.asset);
            CardUI.gameObject.GetComponent <Image>().sprite = card;

            currCard.obj = CardUI;
            currCard.obj.transform.parent = area.transform;
        }
    }
コード例 #7
0
ファイル: iStoryQuest.cs プロジェクト: ahmed-alzahrani/QUEST
    public void execute(List <Player> players, Card storyCard, Controller game)
    {
        //FIND A SPONSOR FOR THE QUEST
        if (QuestState.state == "FindingSponsor")
        {
            QuestState.currentQuest = game.currentQuest;
            QueryingUtil.SponsorCheck(game);

            if (game.numIterations >= game.numPlayers)
            {
                game.numIterations = 0;

                Debug.Log("CheckSponsorship" + GameUtil.CheckSponsorship(game.players));
                if (GameUtil.CheckSponsorship(game.players) != -1)
                {
                    QuestState.state = "Sponsoring";

                    QuestState.invalidQuestSubmitted = false;

                    game.userInput.DeactivateUI();
                    game.userInput.ActivateCardUIPanel("What FOE or TEST cards would you like to add?");
                }
                else
                {
                    game.isDoneStoryEvent = true;
                }
            }
        }

        // GET SPONSOR'S CARDS FOR THE QUEST
        if (QuestState.state == "Sponsoring")
        {
            //Displays a prompt for the player if the quest they submitted is invalid.
            if (QuestState.invalidQuestSubmitted)
            {
                InvalidQuestPrompt(game);
            }
            else
            {
                QueryingUtil.SponsorQuery(game);

                if (game.numIterations >= game.currentQuest.stages)
                {
                    QuestState.stages = new List <Card> [game.currentQuest.stages];
                    System.Array.Copy(game.sponsorQueriedCards, QuestState.stages, game.currentQuest.stages);
                    game.numIterations = 0;

                    if (ValidQuest())
                    {
                        QuestState.state = "CheckingForParticipants";
                        UIUtil.UpdatePlayerTurn(game);
                        game.userInput.DeactivateUI();
                        game.userInput.ActivateBooleanCheck("Participate in the QUEST?");
                    }
                    else
                    {
                        QuestState.invalidQuestSubmitted = true;

                        for (int i = 0; i < game.sponsorQueriedCards.Length; i++)
                        {
                            if (game.sponsorQueriedCards[i] != null)
                            {
                                for (int j = 0; j < game.sponsorQueriedCards[i].Count; j++)
                                {
                                    game.players[game.currentPlayerIndex].hand.Add(game.sponsorQueriedCards[i][j]);
                                    UIUtil.AddCardToPanel(UIUtil.CreateUIElement(game.sponsorQueriedCards[i][j], game.cardPrefab), game.handPanel);
                                    game.sponsorQueriedCards[i].RemoveAt(j);
                                    j--;
                                }
                            }
                        }

                        UIUtil.PopulatePlayerBoard(game);
                        game.userInput.DeactivateUI();
                        game.userInput.ActivateBooleanCheck("Invalid Quest Submitted. Please try again.");
                    }
                }
            }
        }

        //CHECKING FOR QUEST PARTICIPANTS
        if (QuestState.state == "CheckingForParticipants")
        {
            QueryingUtil.ParticipationCheck("Quest", game);

            if (game.numIterations >= game.numPlayers)
            {
                Debug.Log("Done Participation Check");
                if (GameUtil.CheckParticipation(game.players) < 1)
                {
                    EndQuest(game);
                }
                else
                {
                    QuestState.state  = "PlayingQuest";
                    QuestState.amours = new List <Card> [game.numPlayers];

                    for (int i = 0; i < QuestState.amours.Length; i++)
                    {
                        QuestState.amours[i] = new List <Card>();
                    }

                    QuestState.testBids         = new int[game.numPlayers];
                    QuestState.testBidSubmitted = false;
                    QuestState.bidsOver         = false;

                    DrawForStageStart(game);
                    //game.populatePlayerBoard();
                    //game.populateQuestBoard(false);
                    UIUtil.PopulatePlayerBoard(game);
                    UIUtil.PopulateQuestBoard(game, false);
                    game.numIterations = 0;
                    game.userInput.DeactivateUI();
                    if (QuestState.stages[QuestState.currentStage][0].type == "Test Card")
                    {
                        QuestState.round = 0;
                        TestCard tempTestCard = (TestCard)QuestState.stages[0][0];
                        string[] minBidString = new string[1];
                        minBidString[0] = GetMinRequiredBid().ToString();
                        game.userInput.ActivateUserInputCheck("A Test is in play, the minimum bid is: " + GetMinRequiredBid().ToString());
                    }
                    else
                    {
                        game.userInput.ActivateCardUIPanel("Play Ally, Weapon and/or Amour cards for this stage of the quest");
                    }
                }
            }
        }

        //QUEST GAMEPLAY HERE
        else if (QuestState.state == "PlayingQuest")
        {
            if (QuestState.currentStage >= game.currentQuest.getStages() || GameUtil.CheckParticipation(game.players) < 1)
            {
                Debug.Log("Called EndQuest here");
                EndQuest(game);
            }
            else
            {
                if (QuestState.stages[QuestState.currentStage][0].type == "Test Card")
                {
                    if (!QuestState.bidsOver)
                    {
                        TestQuery(game);
                        if (GameUtil.CheckParticipation(game.players) < 2 && QuestState.testBidSubmitted == true)
                        {
                            //check for test card thing

                            QuestState.bidsOver = true;
                            game.userInput.DeactivateUI();
                            //game.populatePlayerBoard();
                            UIUtil.PopulatePlayerBoard(game);
                            game.userInput.ActivateCardUIPanel("Please submit " + (Mathf.Max(QuestState.testBids[game.currentPlayerIndex] - game.players[game.currentPlayerIndex].calculateBid(game.currentQuest.name, game.players), 0)).ToString() + " cards to discard.");
                        }
                    }
                    else
                    {
                        DiscardCards(game);
                    }
                }
                else
                {
                    QueryingUtil.CardQuerying("Quest", game);

                    //get player's cards for the quest
                    if (game.userInput.cardPrompt.selectedCards.Count > 0)
                    {
                        //game.populateQuestBoard(false);

                        UIUtil.PopulateQuestBoard(game, false);
                    }
                    if (game.numIterations >= game.numPlayers)
                    {
                        for (int i = 0; i < game.queriedCards.Length; i++)
                        {
                            if (GameUtil.CheckSponsorship(game.players) == i)
                            {
                                continue;
                            }
                            if (!game.players[i].participating)
                            {
                                continue;
                            }

                            int sum = 0;

                            if (game.queriedCards[i] != null)
                            {
                                for (int j = 0; j < game.queriedCards[i].Count; j++)
                                {
                                    if (game.queriedCards[i][j] == null)
                                    {
                                        continue;
                                    }

                                    if (game.queriedCards[i][j].type == "Weapon Card")
                                    {
                                        Debug.Log("Weapon Card at " + j.ToString() + " bp value is " + ((WeaponCard)game.queriedCards[i][j]).battlePoints.ToString());
                                        sum += ((WeaponCard)game.queriedCards[i][j]).battlePoints;
                                    }
                                    else if (game.queriedCards[i][j].type == "Amour Card")
                                    {
                                        QuestState.amours[i].Add(game.queriedCards[i][j]);
                                        game.queriedCards[i].RemoveAt(j);
                                        j--;
                                    }
                                }

                                if (QuestState.amours[i] != null)
                                {
                                    for (int j = 0; j < QuestState.amours[i].Count; j++)
                                    {
                                        AmourCard tempAmourCard = (AmourCard)QuestState.amours[i][j];
                                        sum += tempAmourCard.battlePoints;
                                    }
                                }

                                sum += game.players[i].CalculateBP(storyCard.name, players);
                                if (sum < GetStageBP(QuestState.currentStage, game.currentQuest))
                                {
                                    Debug.Log("Stage Failed Result: GetStageBP = " + GetStageBP(QuestState.currentStage, game.currentQuest).ToString() + " Sum of player strength = " + sum.ToString());
                                    game.players[i].participating = false;
                                }
                            }
                        }
                    }
                }
            }

            if (game.numIterations >= game.numPlayers)
            {
                Debug.Log("currentStage: " + QuestState.currentStage);
                //game.populateQuestBoard(true);
                UIUtil.PopulateQuestBoard(game, true);

                if (!(QuestState.stages[QuestState.currentStage][0].type == "Test Card"))
                {
                    QuestState.previousQuestBP = GetStageBP(QuestState.currentStage, QuestState.currentQuest);
                }

                QuestState.currentStage++;
                if (QuestState.currentStage >= game.currentQuest.getStages())
                {
                    EndQuest(game);
                }
                else if (GameUtil.CheckParticipation(game.players) < 1)
                {
                    EndQuest(game);
                }
                else
                {
                    DrawForStageStart(game);
                    UIUtil.PopulatePlayerBoard(game);
                    game.numIterations = 0;
                    game.userInput.DeactivateUI();
                    System.Array.Clear(game.queriedCards, 0, game.queriedCards.Length);

                    //check for discard at the end of each stage
                    game.playerStillOffending = GameUtil.PlayerOffending(game.players);

                    if (game.playerStillOffending)
                    {
                        game.numIterations = 0;
                        //find first offending player
                        while (!game.players[game.currentPlayerIndex].handCheck() && game.numIterations < game.numPlayers)
                        {
                            //doesn't need to discard update turn
                            game.numIterations++;
                            UIUtil.UpdatePlayerTurn(game);
                        }
                        game.userInput.ActivateDiscardCheck("You need to Discard " + (players[game.currentPlayerIndex].hand.Count - 12).ToString() + " Cards");
                    }

                    if (QuestState.stages[QuestState.currentStage][0].type == "Test Card")
                    {
                        QuestState.round = 0;
                        TestCard tempTestCard = (TestCard)QuestState.stages[QuestState.currentStage][0];
                        string[] minBidString = new string[1];
                        minBidString[0] = GetMinRequiredBid().ToString();
                        game.userInput.ActivateUserInputCheck("A Test is in play, the minimum bid you must make is: " + (GetMinRequiredBid()).ToString());
                    }
                    else
                    {
                        game.userInput.ActivateCardUIPanel("Play Ally, Weapon and/or Amour cards for this stage of the quest");
                    }
                }
            }
        }
    }
コード例 #8
0
    public void execute(List <Player> player, Card storyCard, Controller game)
    {
        //Ally cards on field do not matter !!!!!!! so only player rank and what he adds in
        if (TournamentState.state == "Participation" && TournamentState.tourneyRound == 1)
        {
            //do participation check code
            QueryingUtil.ParticipationCheck("Tournament", game);

            //done checking for participation
            if (game.numIterations >= game.numPlayers)
            {
                TournamentState.numberOfParticipants = GameUtil.CheckParticipation(game.players);
                if (GameUtil.CheckParticipation(game.players) > 1)
                {
                    //there are more than 1 person participating
                    TournamentState.state = "CardQuery";

                    //participants draw one card
                    for (int i = 0; i < game.players.Count; i++)
                    {
                        if (game.players[i].participating)
                        {
                            game.players[i].hand.Add(GameUtil.DrawFromDeck(game.adventureDeck, 1)[0]);
                        }
                    }
                    UIUtil.PopulatePlayerBoard(game); //just in case
                    game.numIterations = 0;           //for next part of tourney
                    game.userInput.DeactivateUI();
                    game.userInput.ActivateCardUIPanel("What AMOUR , ALLY , OR WEAPON CARDS do you want to use?");
                }
                else
                {
                    //game is done resolve the tournament no one or 1 person participating
                    //resolve tournament
                    TournamentCard myCard = (TournamentCard)storyCard;
                    for (int i = 0; i < game.players.Count; i++)
                    {
                        if (game.players[i].participating)
                        {
                            Debug.Log("number of shields" + myCard.shields);
                            game.players[i].addShields(1 + myCard.shields);
                        }
                    }

                    //reset values
                    game.isDoneStoryEvent = true;
                    TournamentState.state = "Participation";
                    TournamentState.numberOfParticipants = 0;
                    TournamentState.tourneyRound         = 1;
                    TournamentState.undiscardedCards     = null;
                    TournamentState.cardsToBeDiscarded   = new List <Card>();
                }
            }
        }
        else if (TournamentState.state == "CardQuery")
        {
            //query players for cards
            QueryingUtil.CardQuerying("Tournament", game);

            //done querying
            if (game.numIterations >= game.numPlayers)
            {
                int        maximumBP    = 0;
                int        totalPlayer  = 0;
                List <int> playerTotals = new List <int>();

                //concatonate results
                //ensuring deep copy
                List <List <Card> > temp = new List <List <Card> >(game.queriedCards);

                if (TournamentState.tourneyRound == 1)
                {
                    TournamentState.undiscardedCards = new List <Card> [game.queriedCards.Length];
                    //copy everything
                    System.Array.Copy(game.queriedCards, TournamentState.undiscardedCards, game.queriedCards.Length);
                }
                else
                {
                    //concat results
                    for (int i = 0; i < game.queriedCards.Length; i++)
                    {
                        if (game.queriedCards[i] != null)
                        {
                            for (int j = 0; j < game.queriedCards[i].Count; j++)
                            {
                                TournamentState.undiscardedCards[i].Add(game.queriedCards[i][j]);
                            }
                        }
                    }
                }

                //debugging purposes
                for (int i = 0; i < TournamentState.undiscardedCards.Length; i++)
                {
                    if (TournamentState.undiscardedCards[i] != null)
                    {
                        for (int j = 0; j < TournamentState.undiscardedCards[i].Count; j++)
                        {
                            Debug.Log(TournamentState.undiscardedCards[i][j].name);
                        }
                    }
                }

                for (int i = 0; i < TournamentState.undiscardedCards.Length; i++)
                {
                    //not participating
                    if (!(game.players[i].participating))
                    {
                        playerTotals.Add(-100); continue;
                    }
                    else
                    {
                        if (TournamentState.undiscardedCards[i] != null)
                        {
                            //sum up card battle pts
                            for (int j = 0; j < TournamentState.undiscardedCards[i].Count; j++)
                            {
                                if (TournamentState.undiscardedCards[i][j].type == "Weapon Card")
                                {
                                    WeaponCard weapon = (WeaponCard)TournamentState.undiscardedCards[i][j];
                                    totalPlayer += weapon.battlePoints;
                                }
                                else if (TournamentState.undiscardedCards[i][j].type == "Amour Card")
                                {
                                    AmourCard amour = (AmourCard)TournamentState.undiscardedCards[i][j];
                                    totalPlayer += amour.battlePoints;
                                }
                            }
                            //add player's rank BP only
                            totalPlayer += game.players[i].CalculateBP("", player);
                        }
                        else
                        {
                            //if he is participating and didn't add anything use his rank only
                            totalPlayer = game.players[i].CalculateBP("", player);
                        }
                    }

                    //add all totals to trace winner
                    playerTotals.Add(totalPlayer);
                    Debug.Log(i.ToString() + ": " + totalPlayer);

                    //check for maximum
                    if (maximumBP < totalPlayer)
                    {
                        maximumBP = totalPlayer;
                    }
                    totalPlayer = 0;
                }

                //discard weapon Cards
                for (int i = 0; i < TournamentState.undiscardedCards.Length; i++)
                {
                    if (TournamentState.undiscardedCards[i] != null)
                    {
                        for (int j = 0; j < TournamentState.undiscardedCards[i].Count; j++)
                        {
                            if (TournamentState.undiscardedCards[i][j].type == "Weapon Card")
                            {
                                //discard weapon card
                                TournamentState.cardsToBeDiscarded.Add(TournamentState.undiscardedCards[i][j]);
                                TournamentState.undiscardedCards[i].RemoveAt(j);
                                j--;
                            }
                        }
                    }
                }

                //discard weapon cards
                if (TournamentState.cardsToBeDiscarded != null && TournamentState.cardsToBeDiscarded.Count > 0)
                {
                    GameUtil.DiscardCards(game.adventureDeck, TournamentState.cardsToBeDiscarded, game.adventureDeckDiscardPileUIButton);
                }

                //discard all cards at the end of tourney
                if (TournamentState.tourneyRound == 2)
                {
                    //discard everything
                    //discard undiscarded cards
                    for (int i = 0; i < TournamentState.undiscardedCards.Length; i++)
                    {
                        if (TournamentState.undiscardedCards[i] != null && TournamentState.undiscardedCards[i].Count > 0)
                        {
                            GameUtil.DiscardCards(game.adventureDeck, TournamentState.undiscardedCards[i], game.adventureDeckDiscardPileUIButton);
                        }
                    }
                }

                Debug.Log("Deciding winners");

                List <int> winners = new List <int>();
                for (int i = 0; i < playerTotals.Count; i++)
                {
                    if (playerTotals[i] < maximumBP)
                    {
                        //ppl who got beat
                        game.players[i].participating = false;
                    }
                    else
                    {
                        //winners
                        winners.Add(i);
                    }
                }

                //check for player discard
                game.playerStillOffending = GameUtil.PlayerOffending(game.players);

                if (game.playerStillOffending)
                {
                    game.numIterations = 0;

                    //find first offending player
                    while (!game.players[game.currentPlayerIndex].handCheck() && game.numIterations < game.numPlayers)
                    {
                        //doesn't need to discard update turn
                        game.numIterations++;
                        UIUtil.UpdatePlayerTurn(game);
                    }

                    game.userInput.ActivateDiscardCheck("You need to Discard " + (game.players[game.currentPlayerIndex].hand.Count - 12).ToString() + " Cards");
                }

                //undecided another round
                if (winners.Count >= 2 && TournamentState.tourneyRound == 1)
                {
                    Debug.Log("Couldn't find winners");

                    TournamentState.tourneyRound = 2;
                    game.numIterations           = 0;
                    game.userInput.ActivateCardUIPanel("What AMOUR , ALLY , OR WEAPON CARDS do you want to use?");
                    Debug.Log("There is a draw");
                    //requery cards
                    System.Array.Clear(game.queriedCards, 0, game.queriedCards.Length);

                    // game.queriedCards.Clear();
                    TournamentState.cardsToBeDiscarded.Clear();
                }
                else
                {
                    Debug.Log("found winners");

                    //we are done we have a winner or winners
                    for (int i = 0; i < winners.Count; i++)
                    {
                        TournamentCard myCard = (TournamentCard)storyCard;
                        Debug.Log("shields: " + myCard.shields);
                        game.players[winners[i]].addShields(TournamentState.numberOfParticipants + myCard.shields);
                    }

                    //reset everything
                    game.isDoneStoryEvent = true;
                    TournamentState.state = "Participation";
                    TournamentState.numberOfParticipants = 0;
                    TournamentState.tourneyRound         = 1;
                    System.Array.Clear(game.queriedCards, 0, game.queriedCards.Length);
                    System.Array.Clear(TournamentState.undiscardedCards, 0, TournamentState.undiscardedCards.Length);
                    TournamentState.cardsToBeDiscarded.Clear();
                }
            }
        }
    }
コード例 #9
0
ファイル: UIUtil.cs プロジェクト: ahmed-alzahrani/QUEST
    //Calculate player's bp points for a quest or tournament
    public static void PopulatePlayerBPS(Controller game)
    {
        //sets up player BPS for quests tourneys etc .... and returns them back when done check current event and quest and tourney
        for (int i = 0; i < game.players.Count; i++)
        {
            //check for special ally abilities
            if (game.currentQuest != null)
            {
                game.UIBPS[i].text = "BP: " + game.players[i].CalculateBP(game.currentQuest.name, game.players);
            }
            else
            {
                game.UIBPS[i].text = "BP: " + game.players[i].CalculateBP("", game.players);
            }

            //participating in a quest tourneys don't matter really
            if (game.players[i].participating)
            {
                int totalPlayedBP = 0;

                //go through amours and foe / weapon cards

                //go through amours of quest will be empty if in tournament or anything else
                if (QuestState.amours != null)
                {
                    if (QuestState.amours[i] != null)
                    {
                        //add amour values
                        for (int j = 0; j < QuestState.amours[i].Count; j++)
                        {
                            AmourCard amour = (AmourCard)QuestState.amours[i][j];
                            totalPlayedBP += amour.battlePoints;
                        }
                    }
                }

                //go through weapons of quest
                if (game.queriedCards[i] != null && game.currentQuest != null)
                {
                    for (int k = 0; k < game.queriedCards[i].Count; k++)
                    {
                        if (game.queriedCards[i][k].type == "Weapon Card")
                        {
                            //these should be weapons
                            totalPlayedBP += ((WeaponCard)game.queriedCards[i][k]).battlePoints;
                        }
                    }
                }

                //go through weapons and amours of tournament add them up
                if (game.currentTournament != null)
                {
                    if (TournamentState.undiscardedCards != null && TournamentState.undiscardedCards[i] != null)
                    {
                        for (int k = 0; k < TournamentState.undiscardedCards[i].Count; k++)
                        {
                            //there probably is a function that does this ????
                            if (TournamentState.undiscardedCards[i][k].type == "Weapon Card")
                            {
                                totalPlayedBP += ((WeaponCard)TournamentState.undiscardedCards[i][k]).battlePoints;
                            }
                            else if (TournamentState.undiscardedCards[i][k].type == "Amour Card")
                            {
                                totalPlayedBP += ((AmourCard)TournamentState.undiscardedCards[i][k]).battlePoints;
                            }
                        }
                    }
                }

                //add up result
                game.UIBPS[i].text += " (" + totalPlayedBP.ToString() + ")";
            }
        }
    }