public void NextTurn()
 {
     if (cardsDelt)
     {
         if (opponent.isPlayersTurn())
         {
             if (Opponent.GetHand().GetNumberOfCards() > 0)
             {
                 playedCard = Opponent.GetComponent <Player_Behavior>().make_a_move();
             }
             else
             {
                 Opponent.GetPlayerState().SetPassing();
             }
         }
         else if (player.isPlayersPassing() && opponent.isPlayersPassing())
         {
             playerCounter.Counter();
             opponentCounter.Counter();
             string outcome = DetermineRoundWinner();
             if (Player.GetScore() == Num_to_Win || Opponent.GetScore() == Num_to_Win || games_played == Max_Games)
             {
                 outcome   = DetermineGameWinner();
                 cardsDelt = false;
             }
             Outcome.Display(outcome);
             Debug.Log(outcome);
             RollForInitiative();
             Invoke("ResetBoard", 2);
             if (cardsDelt == false)
             {
                 Invoke("MainMenuReturn", 2);
             }
             else if (RoundWinner != null)
             {
                 RoundWinner.GetDeck().DealCards(1, RoundWinner.GetHand().gameObject);
                 ApplyModifiers(RoundWinner);
                 if (RoundWinner == Opponent)
                 {
                     Opponent.GetHand().ShowBack();
                 }
                 else
                 {
                     player_cards = Player.GetHand().GetNumberOfCards();
                 }
             }
             return;
         }
     }
     if (playedCard != null)
     {
         ApplyCardModifiers(playedCard, CurrentPlayer, NextPlayer);
         playedCard = null;
     }
     DetermineNewStates();
     playerCounter.Counter();
     opponentCounter.Counter();
 }
    private void ChooseCard()
    {
        List <GameObject> cards = Opponent.GetHand().GetCardsInCardPile();
        int index = Random.Range(0, cards.Count - 1);

        card = cards[index];
    }
Exemple #3
0
    static public void BattleBuddiesIon(GameObject current_card, Player_Behavior combatant)
    {
        List <GameObject> playfield = combatant.GetPlayField().GetComponent <SP_CardPile>().GetCardsInCardPile();

        foreach (GameObject card in playfield)
        {
            CQBCard cardCharacteristics = card.GetComponent <CQBCard>();
            if (cardCharacteristics.GetAbility() == Modifiers.CardModifiers.BattleBuddiesAssault && !cardCharacteristics.IsBuddy())
            {
                int AssaultIndex        = card.transform.GetSiblingIndex();
                int AssaultSiblingIndex = card.transform.GetSiblingIndex() + 1;
                int IonIndex            = current_card.transform.GetSiblingIndex();

                CQBCard    currentCharacteristics = current_card.GetComponent <CQBCard>();
                GameObject IonSibling             = combatant.GetHand().gameObject.transform.GetChild(AssaultSiblingIndex).gameObject;

                currentCharacteristics.ActivatePositiveSymbol();
                currentCharacteristics.ActivatePositiveCost(currentCharacteristics.GetBasePower() + 3);
                currentCharacteristics.SetBuddy();

                cardCharacteristics.ActivatePositiveSymbol();
                cardCharacteristics.ActivatePositiveCost(cardCharacteristics.GetBasePower() + 3);
                cardCharacteristics.SetBuddy();

                if (AssaultSiblingIndex != IonIndex)
                {
                    AssaultSiblingIndex = IonIndex;
                    IonIndex            = AssaultIndex + 1;

                    IonSibling.transform.SetSiblingIndex(AssaultSiblingIndex);
                    current_card.transform.SetSiblingIndex(IonIndex);
                }
            }
        }
    }
 private void CheckCardCount(Player_Behavior participant)
 {
     if (participant.GetHand().GetNumberOfCards() == 0)
     {
         participant.GetPlayerState().SetPassing();
     }
 }
Exemple #5
0
    private void ApplyCardModifiers(GameObject card, Player_Behavior player, Player_Behavior opponent)
    {
        Modifiers.EnviroModifier enviroModifier = SelectedBoard.GetComponent <Board>().GetModifier();
        if (enviroModifier == Modifiers.EnviroModifier.NoCapital && card.GetComponent <CQBCard>().GetUnitType() == CQBCard.UnitType.CAPITAL)
        {
            card.transform.SetParent(player.GetDiscard().transform);
        }
        else
        {
            if (card.GetComponent <CardModifier>().HasAbility() && !card.GetComponent <CQBCard>().Suppressed())
            {
                Modifiers.CardModifiers ability = card.GetComponent <CardModifier>().GetModifier();
                switch (ability)
                {
                case Modifiers.CardModifiers.BattleBuddiesAssault:
                    ModifierCharacteristics.BattleBuddiesAssault(card, player);
                    break;

                case Modifiers.CardModifiers.BattleBuddiesIon:
                    ModifierCharacteristics.BattleBuddiesIon(card, player);
                    break;

                case Modifiers.CardModifiers.HunterPack:
                    ModifierCharacteristics.HunterPack(card, player);
                    break;

                case Modifiers.CardModifiers.Anti_Fighter:
                    ModifierCharacteristics.Anti_Fighter(opponent);
                    break;

                case Modifiers.CardModifiers.Anti_Frigate:
                    ModifierCharacteristics.Anti_Frigate(opponent);
                    break;

                case Modifiers.CardModifiers.Anti_Capital:
                    ModifierCharacteristics.Anti_Capital(opponent);
                    break;

                case Modifiers.CardModifiers.Quick_Deploy:
                    ModifierCharacteristics.Quick_Deploy(player);
                    break;

                case Modifiers.CardModifiers.CAP:
                    ModifierCharacteristics.CAP(card, player);
                    break;

                case Modifiers.CardModifiers.DECOY:
                    ModifierCharacteristics.Decoy(card, player);
                    break;

                case Modifiers.CardModifiers.SPY:
                    card.transform.SetParent(opponent.GetPlayField().transform);
                    player.GetDeck().DealCards(2, player.GetHand().gameObject);
                    ApplyModifiers(player);
                    break;
                }
            }
        }
    }
Exemple #6
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            clicks += 1;
            if (clicks == 1)
            {
                Debug.Log("Set timer");
                lastTimer = Time.unscaledTime;
            }
            if (clicks >= 2)
            {
                currentTimer = Time.unscaledTime;

                float difference = currentTimer - lastTimer;

                if (difference <= 0.2f)
                {
                    clicks = 0;
                    if (!Player.GetPlayerState().isPlayersTurn())
                    {
                        return;
                    }
                    selectedCard = GetClickedCard();
                    if (selectedCard != null)
                    {
                        if (selectedCard.transform.parent.tag.Contains("Enemy Hand"))
                        {
                            return;
                        }
                        if (Player.GetHand().CardIsInPile(selectedCard))
                        {
                            playfield = Player.GetPlayField().GetComponent <SP_CardPile>();
                            AnimateCardToField(playfield);
                            Invoke("TransferCard", .8f);
                        }
                    }
                }
                else
                {
                    clicks = 0;
                }
            }
        }
        else
        {
            if (clicks < 2)
            {
                currentTimer = Time.unscaledTime;
                float difference = currentTimer - lastTimer;

                if (difference > .2f)
                {
                    clicks = 0;
                }
            }
        }
    }
    private void ApplyModifiers(Player_Behavior combatant)
    {
        List <GameObject> cards = combatant.GetHand().GetCardsInCardPile();

        foreach (GameObject card in cards)
        {
            if (!card.GetComponent <CQBCard>().Is_Modified_Enviro())
            {
                ProcessEnviroModifier(card);
            }
        }
    }
Exemple #8
0
    static public void Quick_Deploy(Player_Behavior player)
    {
        List <GameObject> cards = player.GetDeck().GetCards();
        int deployed            = 0;

        for (int i = 0; i < cards.Count && deployed < MAXQUICKDEPLOY; i++)
        {
            if (cards[i].GetComponent <CQBCard>().GetUnitType() == CQBCard.UnitType.FIGHTER)
            {
                cards[i].GetComponent <CQBCard>().ActivatePlayable();
                cards[i].transform.SetParent(player.GetPlayField().transform);
                deployed++;
            }
        }
        cards = player.GetHand().GetCardsInCardPile();
        for (int i = 0; i < cards.Count && deployed < MAXQUICKDEPLOY; i++)
        {
            if (cards[i].GetComponent <CQBCard>().GetUnitType() == CQBCard.UnitType.FIGHTER)
            {
                cards[i].transform.SetParent(player.GetPlayField().transform);
                deployed++;
            }
        }
    }
Exemple #9
0
 private void Update()
 {
     if (cardsDelt)
     {
         /*CurrentPlayer.GetPlayField().gameObject.GetComponent<SP_CardPile_Display>().UpdateDisplay();
          * NextPlayer.GetPlayField().gameObject.GetComponent<SP_CardPile_Display>().UpdateDisplay();*/
         CurrentPlayer.GetPlayField().gameObject.GetComponent <SP_CardPile_Display>().RefreshLayoutGroupsImmediateAndRecursive(CurrentPlayer.GetPlayField().gameObject);
         NextPlayer.GetPlayField().gameObject.GetComponent <SP_CardPile_Display>().RefreshLayoutGroupsImmediateAndRecursive(NextPlayer.GetPlayField().gameObject);
         if (!enemyBehavior.IsMakingMove() && opponent.isPlayersTurn())
         {
             if (Opponent.GetHand().GetNumberOfCards() > 0)
             {
                 enemyBehavior.make_a_move();
             }
             else
             {
                 Opponent.GetPlayerState().SetPassing();
             }
         }
         else if (player.isPlayersPassing() && opponent.isPlayersPassing() && !waiting)
         {
             playerCounter.Counter();
             opponentCounter.Counter();
             string outcome = DetermineRoundWinner();
             if (Player.GetScore() == Num_to_Win || Opponent.GetScore() == Num_to_Win || games_played == Max_Games)
             {
                 outcome   = DetermineGameWinner();
                 cardsDelt = false;
             }
             Outcome.Display(outcome);
             Debug.Log(outcome);
             waiting = true;
             Invoke("ResetBoard", 2);
             if (cardsDelt == false)
             {
                 Invoke("MainMenuReturn", 2);
             }
             else if (RoundWinner != null)
             {
                 RoundWinner.GetDeck().DealCards(1, RoundWinner.GetHand().gameObject);
                 ApplyModifiers(RoundWinner);
                 if (RoundWinner == Opponent)
                 {
                     Opponent.GetHand().ShowBack();
                 }
                 else
                 {
                     player_cards = Player.GetHand().GetNumberOfCards();
                 }
             }
             return;
         }
         else if (Player.GetHand().GetNumberOfCards() == 0)
         {
             Player.GetPlayerState().SetPassing();
         }
         else if (Player.GetPlayerState().isPlayersPassing() || Opponent.GetPlayerState().isPlayersPassing())
         {
             DetermineNewStates();
         }
     }
 }
Exemple #10
0
 static public void SPY(GameObject current_card, Player_Behavior player, Player_Behavior opponent)
 {
     player.GetDeck().DealCards(2, player.GetHand().gameObject);
     current_card.transform.SetParent(opponent.GetPlayField().transform);
 }