private void TransferCard()
 {
     Opponent.GetPlayField().GetComponent <SP_CardPile>().TransferCardToCardPile(card);
     GameMaster.SetPlayedCard(card);
     Making_Move = false;
     GameMaster.Continue();
 }
Example #2
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);
                }
            }
        }
    }
Example #3
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;
                }
            }
        }
    }
Example #4
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;
                }
            }
        }
    }
Example #5
0
    static public void Anti_Capital(Player_Behavior opponent)
    {
        List <GameObject> opponentPlayfield = opponent.GetPlayField().GetComponent <SP_CardPile>().GetCardsInCardPile();

        foreach (GameObject card in opponentPlayfield)
        {
            CQBCard cardCharacteristics = card.GetComponent <CQBCard>();
            if (cardCharacteristics.GetUnitType() == CQBCard.UnitType.CAPITAL)
            {
                cardCharacteristics.SetPower(cardCharacteristics.GetCurrentPower() / 3);
                return;
            }
        }
    }
Example #6
0
    static public void Bomber(Player_Behavior opponent)
    {
        List <GameObject> opponentPlayfield = opponent.GetPlayField().GetComponent <SP_CardPile>().GetCardsInCardPile();

        foreach (GameObject card in opponentPlayfield)
        {
            CQBCard cardCharacteristics = card.GetComponent <CQBCard>();
            if (cardCharacteristics.GetUnitType() == CQBCard.UnitType.FRIGATE && !cardCharacteristics.GetDebuff())
            {
                cardCharacteristics.SetPower(cardCharacteristics.GetCurrentPower() / 2);
                cardCharacteristics.SetDebuff();
                return;
            }
        }
    }
Example #7
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++;
            }
        }
    }
Example #8
0
    static public void HunterPack(GameObject current_card, Player_Behavior combatant)
    {
        List <GameObject> playfield = combatant.GetPlayField().GetComponent <SP_CardPile>().GetCardsInCardPile();
        int siblingIndex            = 0;
        int new_power;
        int index;
        List <GameObject> pack = new List <GameObject>();

        foreach (GameObject card in playfield)
        {
            if (current_card != card && current_card.GetComponent <CardModifier>().GetModifier() == card.GetComponent <CardModifier>().GetModifier())
            {
                pack.Add(card);
            }
        }

        if (pack.Count > 0)
        {
            new_power = pack[0].GetComponent <CQBCard>().GetCurrentPower() + current_card.GetComponent <CQBCard>().GetCurrentPower();
            current_card.GetComponent <CQBCard>().ActivatePositiveCost(new_power);
            foreach (GameObject pack_mate in pack)
            {
                pack_mate.GetComponent <CQBCard>().ActivatePositiveCost(new_power);
                siblingIndex++;
            }

            siblingIndex = pack[pack.Count - 1].transform.GetSiblingIndex();
            index        = current_card.transform.GetSiblingIndex() - 1;
            if (siblingIndex != index)
            {
                GameObject tempSibling = pack[pack.Count - 1].transform.parent.gameObject.transform.GetChild(siblingIndex).gameObject;
                tempSibling.transform.SetSiblingIndex(index);
                current_card.transform.SetSiblingIndex(siblingIndex);
            }
        }
    }
Example #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();
         }
     }
 }
Example #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);
 }