static public void ShowHand(Hand hand)
        {
            int id = 0;

            foreach (Card card in hand.Cards)
            {
                Console.WriteLine("Hand:");

                if (card.GetType().Name == nameof(CombatCard))
                {
                    // Rojo
                    Console.ForegroundColor = ConsoleColor.Red;
                    CombatCard tempCard = (CombatCard)card;
                    Console.Write($"|({id}) {tempCard.Name} ({tempCard.Type}): ({tempCard.AttackPoints})|");
                }
                else
                {
                    // Azul
                    Console.ForegroundColor = ConsoleColor.Blue;
                    Console.Write($"|({id}) {card.Name} ({card.Type})|");
                }
                id++;
                Console.ResetColor();
            }
        }
예제 #2
0
    public void CreateTooltip(string tooltipText, Transform tooltipParent, CombatCard[] displayCards)
    {
        StopAllTooltips();

        activeTooltip = Instantiate(tooltipPrefab);
        activeTooltip.DisplayValuesAndCombatCards(tooltipText, tooltipParent, displayCards);
    }
        public static void RestablecerValores(Player pl1, Player pl2)
        {
            foreach (Card card in pl1.Deck.Cards)
            {
                if (card.Type == EnumType.melee || card.Type == EnumType.range || card.Type == EnumType.longRange)
                {
                    CombatCard combatCard = (CombatCard)card;
                    if (combatCard.VistaAttackPoints != -1)
                    {
                        combatCard.AttackPoints      = combatCard.VistaAttackPoints;
                        combatCard.VistaAttackPoints = -1;
                    }
                }
            }

            foreach (Card card in pl2.Deck.Cards)
            {
                if (card.Type == EnumType.melee || card.Type == EnumType.range || card.Type == EnumType.longRange)
                {
                    CombatCard combatCard = (CombatCard)card;
                    if (combatCard.VistaAttackPoints != -1)
                    {
                        combatCard.AttackPoints      = combatCard.VistaAttackPoints;
                        combatCard.VistaAttackPoints = -1;
                    }
                }
            }
        }
 public static void ShowDecks(List <Deck> decks)
 {
     Console.WriteLine("Select one Deck:");
     for (int i = 0; i < decks.Count; i++)
     {
         Console.WriteLine($"({i}) Deck {i+1}");
         foreach (Card card in decks[i].Cards)
         {
             Console.WriteLine();
             if (card.Type == EnumType.melee || card.Type == EnumType.range || card.Type == EnumType.longRange)
             {
                 CombatCard    nuevo          = (CombatCard)card;
                 List <string> caracteristica = nuevo.GetCharacteristics();
                 foreach (string mensaje in caracteristica)
                 {
                     ShowProgramMessage(mensaje);
                 }
             }
             else
             {
                 SpecialCard   nuevoSpecial  = (SpecialCard)card;
                 List <string> caracteristic = nuevoSpecial.GetCharacteristics();
                 foreach (string mensse in caracteristic)
                 {
                     ShowProgramMessage(mensse);
                 }
             }
             Console.WriteLine();
         }
     }
 }
예제 #5
0
        // Metodos
        public static void ShowHand(Hand hand)
        {
            Console.WriteLine("Hand:");
            int count = 0;

            foreach (Card card in hand.Cards)
            {
                string aux = "| ";
                aux += "(" + Convert.ToString(count) + ")";
                string   name = card.Name;
                EnumType type = card.Type;
                // Si es combatcard
                if (type == (EnumType)Enum.Parse(typeof(EnumType), "melee") || type == (EnumType)Enum.Parse(typeof(EnumType), "range") || type == (EnumType)Enum.Parse(typeof(EnumType), "longRange"))
                {
                    CombatCard aux2 = (CombatCard)card;
                    aux += " " + name + "(" + type + "): " + Convert.ToString(aux2.AttackPoints) + " |";
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.Write(aux);
                    Console.ForegroundColor = ConsoleColor.White;
                    count++;
                }
                // Si es specialCard
                else
                {
                    aux += " " + name + "(" + type + ") |";
                    Console.ForegroundColor = ConsoleColor.Blue;
                    Console.Write(aux);
                    Console.ForegroundColor = ConsoleColor.White;
                    count++;
                }
            }
        }
 public void AssignCard(CombatCard newCard, HandDisplayer handDisplayer)
 {
     assignedCard = newCard;
     SetupButton();
     this.handDisplayer = handDisplayer;
     GetComponent<CombatCardGraphic>().AssignCard(newCard,true);
 }
예제 #7
0
 void AddCombatCard(CombatCard addedCard)
 {
     CombatCardGraphic cardGraphic = Instantiate(combatCardGraphicPrefab);
     cardGraphic.AssignCard(addedCard);
     cardGraphic.GetComponent<Image>().raycastTarget = false;
     cardGraphic.transform.SetParent(cardsDisplayGroup, false);
 }
예제 #8
0
    IEnumerator DrawCard(int amount)
    {
        for (int i = 0; i < amount; ++i)
        {
            GameObject go = deck.DrawCard();
            if (!go)
            {
                deck.ResetDeck();
                go = deck.DrawCard();
            }
            yield return(new WaitForSeconds(0.5f));

            if (handCards.Count < handSizeMax)
            {
                handSize++;
                handCards.Add(go);
                go.transform.position = handCardPos[handCards.Count - 1];
                go.SetActive(true);
                CombatCard cc = go.GetComponent <CombatCard>();
                cc.hand      = this;
                cc.handIndex = handCards.Count - 1;
            }
            else
            {
                grave.AddtoGrave(go);
            }
            yield return(new WaitForSeconds(0.1f));
        }
        yield break;
    }
예제 #9
0
 void AddNewCombatCardGraphic(CombatCard card, bool interactable)
 {
     InteractableCombatCard newCardGraphic = Instantiate(combatCardPrefab);
     newCardGraphic.AssignCard(card,this);
     newCardGraphic.transform.SetParent(mainHandGroup, false);
     newCardGraphic.GetComponent<Button>().interactable = interactable;
 }
예제 #10
0
 public static void ShowAttackPointsByCard(List <Card> Cards)
 {
     foreach (Card c in Cards)
     {
         CombatCard cc = c as CombatCard;
         Console.Write($"|{cc.AttackPoints}|");
     }
 }
        public void DecksRead( )
        {
            string path = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.FullName + @"\Files\Decks.txt";

            List <Deck> decks_txt = new List <Deck>();

            int contador = 0;

            Deck deckt = new Deck();

            using (StreamReader reader = new StreamReader(path))
            {
                while (true)
                {
                    string line = reader.ReadLine();

                    if (line == "START")
                    {
                        Deck deckt = new Deck();
                    }
                    if (line == "END")
                    {
                        decks_txt.Add(deckt);
                    }
                    if (line == null)
                    {
                        break;
                    }
                    else
                    {
                        string[] attributes = line.Split(",");

                        int tipecard = 0;

                        foreach (string attribute in attributes)
                        {
                            tipecard++;
                        }

                        if (tipecard == 3)
                        {
                            SpecialCard specialCard = new SpecialCard(attributes[1], attributes[0], attributes[2]);
                            deckt.AddCard(specialCard);
                        }
                        if (tipecard == 5)
                        {
                            CombatCard combatcard = new CombatCard(attributes[1], attributes[0], attributes[2], Int32.Parse(attributes[3]), Boolean.Parse(attributes[4]));
                            deckt.AddCard(combatcard);
                        }
                    }

                    contador++;
                }
            }

            this.decks = decks_txt;
        }
예제 #12
0
 public void DisplayValuesAndCombatCards(string text, Transform tooltipParent, CombatCard[] displayCards)
 {
     cardsDisplayGroup.gameObject.SetActive(true);
     cardsDisplayGroup.GetComponent<GridLayoutGroup>().constraintCount = Mathf.Min(displayCards.Length, maxCardsPerRow);
     foreach (CombatCard card in displayCards)
     {
         AddCombatCard(card);
     }
     DisplayText(text, tooltipParent);
 }
 public Board(CombatCard meleeCards, CombatCard rangeCards, CombatCard longRangeCards, SpecialCard specialMeleeCards, SpecialCard specialRangeCards, SpecialCard specialLongRangeCards, SpecialCard captainCards, SpecialCard weatherCards)
 {
     this.meleeCards            = meleeCards;
     this.rangeCards            = rangeCards;
     this.longRangeCards        = longRangeCards;
     this.specialMeleeCards     = specialMeleeCards;
     this.specialRangeCards     = specialRangeCards;
     this.specialLongRangeCards = specialLongRangeCards;
     this.captainCards          = captainCards;
     this.weatherCards          = weatherCards;
 }
예제 #14
0
        public void Leer_archivo()
        {
            StreamReader reader = new StreamReader("Decks.txt");
            int          i      = 0;

            while (!reader.EndOfStream)
            {
                string line = reader.ReadLine();
                if (line == "START" || line == "END")
                {
                    i++;
                }
                else
                {
                    if (line.Contains("Combat"))
                    {
                        var        c = line.Split(",");
                        CombatCard carta_de_combate = new CombatCard(c[1], c[2], c[3], int.Parse(c[4]), bool.Parse(c[5]));
                        if (i == 1)
                        {
                            player1_cards.Add(carta_de_combate);
                        }
                        else
                        {
                            player2_cards.Add(carta_de_combate);
                        }

                        if (line.Contains("Special"))
                        {
                            var         x = line.Split(",");
                            SpecialCard carta_especial = new SpecialCard(x[1], x[2], x[3]);
                            if (i == 2)
                            {
                                player2_cards.Add(carta_especial);
                            }
                            else
                            {
                                player2_cards.Add(carta_especial);
                            }
                        }
                    }

                    /*
                     * decks.Add(player1_cards);
                     * decks.Add(player2_cards);
                     */
                }
                //Agrego el mazo a la lista decks

                Console.WriteLine(line);
            }

            reader.Close();
        }
예제 #15
0
    public void AssignCard(CombatCard newCard, bool showStipulationCardTooltip)
    {
        base.UpdateBasicVisuals(newCard);
        assignedCard = newCard;

        SetColor();
        SetTypeText();

        ShowCosts();
        ShowDamage();

        description.raycastTarget = showStipulationCardTooltip;
    }
        public void ShowHand(Hand hand)
        {
            Console.WriteLine("Your Hand:");
            for (int i = 0; i < hand.Cards.Count; i++)
            {
                if (hand.Cards[i].GetType().Name == nameof(CombatCard))
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    CombatCard auxCombatCard = hand.Cards[i] as CombatCard;
                    Console.Write("| (" + i + ") " + hand.Cards[i].Name + " (" + hand.Cards[i].Type + ")  AttackPoints: (" + auxCombatCard.AttackPoints + ") |");
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.Cyan;
                    Console.Write("| (" + i + ") " + hand.Cards[i].Name + " (" + hand.Cards[i].Type + ") |");
                }

                Console.ResetColor();
            }
            Console.WriteLine("");
        }
예제 #17
0
        public static void ShowHand(Hand hand)
        {
            Console.WriteLine("Hand: ");

            for (int i = 0; i < hand.Cards.Count; i++)
            {
                if (hand.Cards[i].GetType().Name == nameof(CombatCard))
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    CombatCard Combi = (CombatCard)hand.Cards[i];
                    Console.Write($"|({i}) " + hand.Cards[i].Name + $" ({hand.Cards[i].Type}) : {Combi.AttackPoints} |");
                    Console.ResetColor();
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.Blue;
                    Console.Write($"|({i}) " + hand.Cards[i].Name + $" ({hand.Cards[i].Type}) |");
                    Console.ResetColor();
                }
            }
            Console.WriteLine("");
        }
        private static void AttackPonitsOne(EnumType type, Player pj1, Player pj2)
        {
            foreach (Card card in pj1.Deck.Cards)
            {
                if (card.Type == type)
                {
                    CombatCard combatCard = (CombatCard)card;
                    combatCard.VistaAttackPoints = combatCard.AttackPoints;
                    combatCard.AttackPoints      = 1;
                }
            }

            foreach (Card card in pj2.Deck.Cards)
            {
                if (card.Type == type)
                {
                    CombatCard combatCard = (CombatCard)card;
                    combatCard.VistaAttackPoints = combatCard.AttackPoints;
                    combatCard.AttackPoints      = 1;
                }
            }
        }
        /*Este debe mostrar la mano del jugador y el id de cada carta.
         * Además las cartas de combate deben aparecer en rojo y las especiales en azul.*/
        public static void ShowHand(Hand hand)
        {
            int         cont  = 0;
            List <Card> cards = hand.Cards;

            foreach (Card card in cards)
            {
                if (0 < (int)card.Type && (int)card.Type < 4)
                {
                    CombatCard Ccard = (CombatCard)card;
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("|({0}) {1} ({2}): {3} |", cont, card.Name, card.Type, Ccard.AttackPoints);
                    Console.ResetColor();
                }
                else if ((int)card.Type != 0)
                {
                    Console.ForegroundColor = ConsoleColor.Blue;
                    Console.WriteLine("|({0}) {1} ({2}) |", cont, card.Name, card.Type);
                    Console.ResetColor();
                }
                cont++;
            }
        }
    public bool TrySelectCardToPlay(out CombatCard playedCard, CharacterGraphic character)
    {
        List<CombatCard> playableCards = SortOutPlayableEnemyCards(character);
        if (playableCards.Count > 0)
        {
            playedCard = SelectPriorityCard(playableCards, character);
            if (playedCard == null)
                throw new System.Exception("SelectPriorityCard failed to return a card!");
            if (playedCard == null)
                throw new System.Exception("character is null!");
            //print("Setting AI card user char");
            playedCard.SetUserChar(character);
            EnemyGraphic enemy = character as EnemyGraphic;
            //enemy.RemovePlayedCardFromHand(playedCard);

            return true;
        }
        else
        {
            playedCard = null;
            return false;
        }
    }
        public static void ShowHand(Hand hand)
        {
            int counter = 0;

            foreach (Card card in hand.Cards)
            {
                if (card.Type == Enums.EnumType.melee ||
                    card.Type == Enums.EnumType.range ||
                    card.Type == Enums.EnumType.longRange)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    CombatCard tempCard = card as CombatCard;
                    Console.Write($"|({counter}) {card.Name} ({card.Type}): {tempCard.AttackPoints} |");
                }   // Estoy usando Write en vez de WriteLine porque en el ejemplo lo escribe todo en la misma linea
                else
                {
                    Console.ForegroundColor = ConsoleColor.Blue;
                    Console.Write($"|({counter}) {card.Name} {card.Effect}|");
                }
                counter += 1;
            }
            Console.ForegroundColor = ConsoleColor.Gray;
        }
예제 #22
0
        public static void ShowHand(Hand hand)
        {
            Console.WriteLine("Hand:");
            int i = 0;

            foreach (Card card in hand.Cards)
            {
                if (card.Type == Enums.EnumType.buff || card.Type == Enums.EnumType.bufflongRange || card.Type == Enums.EnumType.buffmelee || card.Type == Enums.EnumType.buffrange || card.Type == Enums.EnumType.weather || card.Type == Enums.EnumType.captain)
                {
                    Console.ForegroundColor = ConsoleColor.Cyan;
                    Console.WriteLine($"| {0} {1} ({2}) |", i, card.Name, card.Type);
                    Console.ForegroundColor = ConsoleColor.White;
                    i++;
                }
                else
                {
                    CombatCard combatCard = (CombatCard)card;
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine($"| {0} {1} ({2}) : {3}|", i, card.Name, card.Type, combatCard.AttackPoints);
                    Console.ForegroundColor = ConsoleColor.White;
                    i++;
                }
            }
        }
예제 #23
0
        public static void  ShadowHand(Hand hand)
        {
            int c = 1;

            Console.WriteLine($"Player Hand:");
            foreach (Card card in hand.Cards)
            {
                if (card.Type == EnumType.melee ||
                    card.Type == EnumType.range ||
                    card.Type == EnumType.longRange)
                {
                    CombatCard tempCard = card as CombatCard;
                    System.Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine($"||{c++}: {card.Name} ({card.Type.ToString()}): {tempCard.AttackPoints}||");
                    System.Console.ForegroundColor = ConsoleColor.White;
                }
                else
                {
                    System.Console.ForegroundColor = ConsoleColor.Blue;
                    Console.WriteLine($"{c++}: {card.Name} ({card.Type.ToString()})");
                    System.Console.ForegroundColor = ConsoleColor.White;
                }
            }
        }
예제 #24
0
 public void AssignCard(CombatCard newCard)
 {
     AssignCard(newCard,false);
 }
예제 #25
0
 public void RemovePlayedCombatCardFromHand(CombatCard playedCard)
 {
     handManager.DiscardCardFromHand(playedCard);
 }
        public static void ShowBoard(Board board, int player, int[] lifePoints, int[] attackPoints)
        {
            Console.WriteLine("Board:");

            if (player == 1)
            {
                if (!board.PlayerCards[0].ContainsKey(EnumType.longRange) && !board.PlayerCards[0].ContainsKey(EnumType.melee) && !board.PlayerCards[0].ContainsKey(EnumType.range))
                {
                    Console.WriteLine($"Oponente  -  LifePoints {lifePoints[0]}   -  AttackPoints {attackPoints[0]}");
                    Console.WriteLine($"(longRange) [" + board.GetAttackPoints(EnumType.longRange).Length + "] : " + "0");
                    Console.WriteLine($"(Range) [" + board.GetAttackPoints(EnumType.range).Length + "] : " + "0");
                    Console.WriteLine($"(melee) [" + board.GetAttackPoints(EnumType.melee).Length + "] : " + "0");
                    Console.WriteLine($"You  -  LifePoints {lifePoints[1]}   -  AttackPoints {attackPoints[1]}");
                    Console.WriteLine($"(longRange) [" + board.GetAttackPoints(EnumType.longRange).Length + "] : " + "0");
                    Console.WriteLine($"(Range) [" + board.GetAttackPoints(EnumType.range).Length + "] : " + "0");
                    Console.WriteLine($"(melee) [" + board.GetAttackPoints(EnumType.melee).Length + "] : " + "0");
                }
                else
                {
                    Console.WriteLine($"Oponente  -  LifePoints {lifePoints[0]}   -  AttackPoints {attackPoints[0]}");
                    List <Card> cards = board.PlayerCards[0][EnumType.longRange];
                    string      h     = "";
                    foreach (Card i in cards)
                    {
                        CombatCard j = (CombatCard)i;
                        h += $"|{j.AttackPoints}| ";
                    }
                    Console.WriteLine($"(longRange) [" + board.GetAttackPoints(EnumType.longRange) + "] : ", h);
                    List <Card> car = board.PlayerCards[0][EnumType.range];
                    string      ran = "";
                    foreach (Card i in car)
                    {
                        CombatCard j = (CombatCard)i;
                        ran += $"|{j.AttackPoints}| ";
                    }
                    Console.WriteLine($"(Range) [" + board.GetAttackPoints(EnumType.range) + "] : ", ran);
                    List <Card> cardss = board.PlayerCards[0][EnumType.melee];
                    string      me     = "";
                    foreach (Card i in cardss)
                    {
                        CombatCard j = (CombatCard)i;
                        me += $"|{j.AttackPoints}| ";
                    }
                    Console.WriteLine($"(melee) [" + board.GetAttackPoints(EnumType.melee) + "] : ", me);

                    List <SpecialCard> m  = board.WeatherCards;
                    string             sp = "";
                    foreach (SpecialCard specialCard in m)
                    {
                        sp += $"|{specialCard.Name}|  ";
                    }
                    Console.WriteLine(sp);

                    Console.WriteLine($"You  -  LifePoints {lifePoints[1]}   -  AttackPoints{attackPoints[1]}");
                    List <Card> cards0 = board.PlayerCards[1][EnumType.longRange];
                    string      h0     = "";
                    foreach (Card i in cards0)
                    {
                        CombatCard j = (CombatCard)i;
                        h0 += $"|{j.AttackPoints}| ";
                    }
                    Console.WriteLine($"(longRange) [" + board.GetAttackPoints(EnumType.longRange) + "] : ", h0);
                    List <Card> car0 = board.PlayerCards[1][EnumType.range];
                    string      ran0 = "";
                    foreach (Card i in car0)
                    {
                        CombatCard j = (CombatCard)i;
                        ran0 += $"|{j.AttackPoints}| ";
                    }
                    Console.WriteLine($"(Range) [" + board.GetAttackPoints(EnumType.range) + "] : ", ran0);
                    List <Card> cardss0 = board.PlayerCards[1][EnumType.melee];
                    string      me0     = "";
                    foreach (Card i in cardss0)
                    {
                        CombatCard j = (CombatCard)i;
                        me0 += $"|{j.AttackPoints}| ";
                    }
                    Console.WriteLine($"(melee) [" + board.GetAttackPoints(EnumType.melee) + "] : ", me0);
                }
            }
            else
            {
                if (!board.PlayerCards[0].ContainsKey(EnumType.longRange) && !board.PlayerCards[0].ContainsKey(EnumType.melee) && !board.PlayerCards[0].ContainsKey(EnumType.range))
                {
                    Console.WriteLine($"Oponente  -  LifePoints {lifePoints[1]}   -  AttackPoints {attackPoints[1]}");
                    Console.WriteLine($"(longRange) [" + board.GetAttackPoints(EnumType.longRange).Length + "] : " + "0");
                    Console.WriteLine($"(Range) [" + board.GetAttackPoints(EnumType.range).Length + "] : " + "0");
                    Console.WriteLine($"(melee) [" + board.GetAttackPoints(EnumType.melee).Length + "] : " + "0");
                    Console.WriteLine($"You  -  LifePoints {lifePoints[0]}   -  AttackPoints {attackPoints[0]}");
                    Console.WriteLine($"(longRange) [" + board.GetAttackPoints(EnumType.longRange).Length + "] : " + "0");
                    Console.WriteLine($"(Range) [" + board.GetAttackPoints(EnumType.range).Length + "] : " + "0");
                    Console.WriteLine($"(melee) [" + board.GetAttackPoints(EnumType.melee).Length + "] : " + "0");
                }
                else
                {
                    Console.WriteLine($"Oponente  -  LifePoints {lifePoints[1]}   -  AttackPoints {attackPoints[1]}");
                    List <Card> cards = board.PlayerCards[1][EnumType.longRange];
                    string      h     = "";
                    foreach (Card i in cards)
                    {
                        CombatCard j = (CombatCard)i;
                        h += $"|{j.AttackPoints}| ";
                    }
                    Console.WriteLine($"(longRange) [" + board.GetAttackPoints(EnumType.longRange) + "] : ", h);
                    List <Card> car = board.PlayerCards[1][EnumType.range];
                    string      ran = "";
                    foreach (Card i in car)
                    {
                        CombatCard j = (CombatCard)i;
                        ran += $"|{j.AttackPoints}| ";
                    }
                    Console.WriteLine($"(Range) [" + board.GetAttackPoints(EnumType.range) + "] : ", ran);
                    List <Card> cardss = board.PlayerCards[1][EnumType.melee];
                    string      me     = "";
                    foreach (Card i in cardss)
                    {
                        CombatCard j = (CombatCard)i;
                        me += $"|{j.AttackPoints}| ";
                    }
                    Console.WriteLine($"(melee) [" + board.GetAttackPoints(EnumType.melee) + "] : ", me);

                    List <SpecialCard> mm  = board.WeatherCards;
                    string             spe = "";
                    foreach (SpecialCard specialCard in mm)
                    {
                        spe += $"|{specialCard.Name}|  ";
                    }
                    Console.WriteLine(spe);
                    Console.WriteLine($"You  -  LifePoints {lifePoints[0]}   -  AttackPoints{attackPoints[0]}");
                    List <Card> cards0 = board.PlayerCards[0][EnumType.longRange];
                    string      h0     = "";
                    foreach (Card i in cards0)
                    {
                        CombatCard j = (CombatCard)i;
                        h0 += $"|{j.AttackPoints}| ";
                    }

                    Console.WriteLine($"(longRange) [" + board.GetAttackPoints(EnumType.longRange) + "] : ", h0);
                    List <Card> car0 = board.PlayerCards[0][EnumType.range];
                    string      ran0 = "";
                    foreach (Card i in car0)
                    {
                        CombatCard j = (CombatCard)i;
                        ran0 += $"|{j.AttackPoints}| ";
                    }
                    Console.WriteLine($"(Range) [" + board.GetAttackPoints(EnumType.range) + "] : ", ran0);
                    List <Card> cardss0 = board.PlayerCards[0][EnumType.melee];
                    string      me0     = "";
                    foreach (Card i in cardss0)
                    {
                        CombatCard j = (CombatCard)i;
                        me0 += $"|{j.AttackPoints}| ";
                    }
                    Console.WriteLine($"(melee) [" + board.GetAttackPoints(EnumType.melee) + "] : ", me0);
                }
            }
        }
예제 #27
0
 public void AddEnemysBasicCombatDeck(CombatCard[] basicDeckCards)
 {
     addedCombatCards.AddRange(basicDeckCards);
 }
예제 #28
0
    public bool CharacterMeetsCardRequirements(CombatCard card)
    {
        if (!hasTurn)
            return false;

        int staminaReq;
        if (card.useUpAllStamina)
            staminaReq = 1;
        else
            staminaReq = card.staminaCost;

        int ammoReq = card.ammoCost;

        if (card.GetType().BaseType==typeof(MeleeCard) && meleeAttacksAreFree)
            staminaReq = 0;

        if (card.GetType().BaseType == typeof(RangedCard))
        {
            if (rangedAttacksAreFree)
                ammoReq = 0;

            else
            {
                ammoReq = Mathf.Max(0,ammoReq-rangedAttacksAmmoCostReduction);
                if (rangedAttacksCostStamina)
                {
                    staminaReq += ammoReq;
                    ammoReq = 0;
                }
            }
        }

        if (GetStamina() < staminaReq)
            return false;
        if (GetAmmo() < ammoReq)
            return false;
        if (!card.SpecialPrerequisitesMet(this))
            return false;

        return true;
    }
 void TryTriggerBlock(CharacterGraphic cardPlayer, CombatCard playedCard)
 {
     if (playedCard.targetChars.Contains(appliedToCharacter) && !playedCard.ignoresBlocks)
     {
         playedCard.targetChars.Remove(appliedToCharacter);
         RemoveStipulationCard();
     }
 }
예제 #30
0
 public override int GetHashCode()
 {
     return(PrepCard.GetHashCode() ^ CombatCard.GetHashCode() ^ DashCard.GetHashCode());
 }
    public void AssignCardTargets(CombatCard playedCard, CharacterGraphic selectedCharacter)
    {
        List<CharacterGraphic> opposingGroup;
        List<CharacterGraphic> friendlyGroup;
        if (combatManager.GetTurnStatus() == CombatManager.TurnStatus.Player)
        {
            opposingGroup = characterManager.GetEnemyGraphics();
            friendlyGroup = characterManager.GetMercGraphics();
        }
        else
        {
            opposingGroup = characterManager.GetMercGraphics();
            friendlyGroup = characterManager.GetEnemyGraphics();
        }

        if (playedCard.targetType == CombatCard.TargetType.None)
        {
            return;
        }
        //The following two are usually only used by the AI (unless a melee override target is set)
        if (playedCard.targetType == CombatCard.TargetType.SelectEnemy)
        {
            playedCard.targetChars.Add(opposingGroup[Random.Range(0, opposingGroup.Count)]);
        }
        if (playedCard.targetType == CombatCard.TargetType.SelectFriendly)
        {
            playedCard.targetChars.Add(friendlyGroup[Random.Range(0, friendlyGroup.Count)]);
        }
        if (playedCard.targetType == CombatCard.TargetType.SelectFriendlyOther)
        {
            List<CharacterGraphic> friendlyOthers = new List<CharacterGraphic>(friendlyGroup);
            friendlyOthers.Remove(selectedCharacter);
            playedCard.targetChars.Add(friendlyOthers[Random.Range(0, friendlyOthers.Count)]);
        }
        if (playedCard.targetType == CombatCard.TargetType.Random)
        {
            playedCard.targetChars.Add(opposingGroup[Random.Range(0, opposingGroup.Count)]);
        }
        if (playedCard.targetType == CombatCard.TargetType.AllEnemies)
        {
            playedCard.targetChars.AddRange(opposingGroup);
        }
        if (playedCard.targetType == CombatCard.TargetType.AllFriendlies)
        {
            playedCard.targetChars.AddRange(friendlyGroup);
        }
        if (playedCard.targetType == CombatCard.TargetType.Weakest)
        {
            CharacterGraphic weakestCharGraphic = opposingGroup[0];
            foreach (CharacterGraphic charGraphic in opposingGroup)
            {
                if (charGraphic.GetEffectiveHitpoints() == weakestCharGraphic.GetEffectiveHitpoints())
                {
                    if (Random.value < 0.5f)
                        weakestCharGraphic = charGraphic;
                }
                else
                {
                    if (charGraphic.GetEffectiveHitpoints() < weakestCharGraphic.GetEffectiveHitpoints())
                        weakestCharGraphic = charGraphic;
                }
            }
            playedCard.targetChars.Add(weakestCharGraphic);
        }
        if (playedCard.targetType == CombatCard.TargetType.Strongest)
        {
            CharacterGraphic strongestCharGraphic = opposingGroup[0];
            foreach (CharacterGraphic charGraphic in opposingGroup)
            {
                if (charGraphic.GetEffectiveHitpoints() == strongestCharGraphic.GetEffectiveHitpoints())
                {
                    if (Random.value < 0.5f)
                        strongestCharGraphic = charGraphic;
                }
                else
                {
                    if (charGraphic.GetEffectiveHitpoints() > strongestCharGraphic.GetEffectiveHitpoints())
                        strongestCharGraphic = charGraphic;
                }
            }
            playedCard.targetChars.Add(strongestCharGraphic);
        }

        if (playedCard.GetType().BaseType == typeof(MeleeCard))
            TryOverrideMeleeCardTarget(playedCard);
        if (playedCard.GetType().BaseType == typeof(RangedCard))
            TryOverrideRangedCardTarget(playedCard);
    }
        public static void ApplyEffect(Card playedCard, Player activePlayer, Player opponent, Board board)
        {
            //Recomendación: Utilice switch(playedCard.CardEffect) para definir los distintos efectos.
            if (playedCard.Type == EnumType.weather)
            {
                switch (playedCard.CardEffect)
                {
                case EnumEffect.bitingFrost:
                    AttackPonitsOne(EnumType.melee, activePlayer, opponent);
                    break;

                case EnumEffect.clearWeather:
                    int idCard = 0;
                    foreach (Card card in activePlayer.Deck.Cards)
                    {
                        if (card.Type == EnumType.weather)
                        {
                            activePlayer.Deck.DestroyCard(idCard);
                        }
                        else if (card.Type == EnumType.melee || card.Type == EnumType.range || card.Type == EnumType.longRange)
                        {
                            CombatCard combatCard = (CombatCard)card;
                            if (combatCard.VistaAttackPoints != -1)
                            {
                                combatCard.AttackPoints      = combatCard.VistaAttackPoints;
                                combatCard.VistaAttackPoints = -1;
                            }
                        }
                        idCard++;
                    }
                    idCard = 0;
                    foreach (Card card1 in opponent.Deck.Cards)
                    {
                        if (card1.Type == EnumType.weather)
                        {
                            opponent.Deck.DestroyCard(idCard);
                        }
                        else if (card1.Type == EnumType.melee || card1.Type == EnumType.range || card1.Type == EnumType.longRange)
                        {
                            CombatCard combatCard = (CombatCard)card1;
                            if (combatCard.VistaAttackPoints != -1)
                            {
                                combatCard.AttackPoints      = combatCard.VistaAttackPoints;
                                combatCard.VistaAttackPoints = -1;
                            }
                        }
                        idCard++;
                    }
                    break;

                case EnumEffect.impenetrableFog:
                    AttackPonitsOne(EnumType.range, activePlayer, opponent);
                    break;

                case EnumEffect.none:
                    break;

                case EnumEffect.torrentialRain:
                    AttackPonitsOne(EnumType.longRange, activePlayer, opponent);
                    break;
                }
            }
        }
예제 #33
0
        public static void ApplyEffect(Card playedCard, Player activePlayer, Player opponent, Board board)
        {
            if (playedCard.CardEffect == EnumEffect.bitingFrost)
            {
                for (int i = 0; i < 2; i++)
                {
                    if (board.PlayerCards[i].ContainsKey(EnumType.melee))
                    {
                        foreach (CombatCard card in board.PlayerCards[i][EnumType.melee])
                        {
                            CombatCard p = new CombatCard(card.Name, card.Type, card.CardEffect, card.AttackPoints, false);
                            playedCards[i][EnumType.melee].Add(p);

                            card.AttackPoints = 1;
                        }
                    }
                }
            }
            if (playedCard.CardEffect == EnumEffect.impenetrableFog)
            {
                for (int i = 0; i < 2; i++)
                {
                    if (board.PlayerCards[i].ContainsKey(EnumType.range))
                    {
                        foreach (CombatCard card in board.PlayerCards[i][EnumType.range])
                        {
                            CombatCard p = new CombatCard(card.Name, card.Type, card.CardEffect, card.AttackPoints, false);
                            playedCards[i][EnumType.range].Add(p);

                            card.AttackPoints = 1;
                        }
                    }
                }
            }
            if (playedCard.CardEffect == EnumEffect.torrentialRain)
            {
                for (int i = 0; i < 2; i++)
                {
                    if (board.PlayerCards[i].ContainsKey(EnumType.longRange))
                    {
                        foreach (CombatCard card in board.PlayerCards[i][EnumType.longRange])
                        {
                            CombatCard p = new CombatCard(card.Name, card.Type, card.CardEffect, card.AttackPoints, false);
                            playedCards[i][EnumType.longRange].Add(p);

                            card.AttackPoints = 1;
                        }
                    }
                }
            }
            if (playedCard.CardEffect == EnumEffect.clearWeather)
            {
                int counter = 0;
                for (int i = 0; i < 2; i++)
                {
                    if (board.PlayerCards[i].ContainsKey(EnumType.longRange))
                    {
                        foreach (CombatCard card in board.PlayerCards[i][EnumType.longRange])
                        {
                            CombatCard c = playedCards[i][EnumType.longRange][counter] as CombatCard;

                            card.AttackPoints = c.AttackPoints;
                            counter          += 1;
                        }
                        counter = 0;
                    }
                    if (board.PlayerCards[i].ContainsKey(EnumType.range))
                    {
                        foreach (CombatCard card in board.PlayerCards[i][EnumType.range])
                        {
                            CombatCard c = playedCards[i][EnumType.range][counter] as CombatCard;

                            card.AttackPoints = c.AttackPoints;
                            counter          += 1;
                        }
                        counter = 0;
                    }
                    if (board.PlayerCards[i].ContainsKey(EnumType.melee))
                    {
                        foreach (CombatCard card in board.PlayerCards[i][EnumType.melee])
                        {
                            CombatCard c = playedCards[i][EnumType.melee][counter] as CombatCard;

                            card.AttackPoints = c.AttackPoints;
                            counter          += 1;
                        }
                        counter = 0;
                    }
                }
            }
        }
        public static void ShowBoard(Board board, int player, int[] lifePoints, int[] attackPoints)
        {
            int opponent;

            if (player == 0)
            {
                opponent = 0;
            }

            else
            {
                opponent = 1;
            }

            List <Card> cardList0 = board.PlayerCards[opponent][EnumType.longRange];
            string      melee0    = "";

            foreach (Card card in cardList0)
            {
                CombatCard String = (CombatCard)card;
                melee0 += $"|{String.AttackPoints}| ";
            }

            List <Card> cardList1 = board.PlayerCards[opponent][EnumType.longRange];
            string      range0    = "";

            foreach (Card card in cardList1)
            {
                CombatCard String = (CombatCard)card;
                range0 += $"|{String.AttackPoints}| ";
            }

            List <Card> cardList10 = board.PlayerCards[opponent][EnumType.longRange];
            string      lRange0    = "";

            foreach (Card card in cardList10)
            {
                CombatCard String = (CombatCard)card;
                lRange0 += $"|{String.AttackPoints}| ";
            }

            List <SpecialCard> weatherCardsList = board.WeatherCards;
            string             weatherCards     = "";

            foreach (SpecialCard specialCard in weatherCardsList)
            {
                weatherCards += $"|{specialCard.Name}|  ";
            }

            List <Card> cardList11 = board.PlayerCards[player][EnumType.longRange];
            string      melee1     = "";

            foreach (Card card in cardList11)
            {
                CombatCard String = (CombatCard)card;
                melee1 += $"|{String.AttackPoints}| ";
            }

            List <Card> cardList100 = board.PlayerCards[player][EnumType.longRange];
            string      range1      = "";

            foreach (Card card in cardList100)
            {
                CombatCard String = (CombatCard)card;
                range1 += $"|{String.AttackPoints}| ";
            }

            List <Card> cardList101 = board.PlayerCards[player][EnumType.longRange];
            string      lRange1     = "";

            foreach (Card card in cardList101)
            {
                CombatCard String = (CombatCard)card;
                lRange1 += $"|{String.AttackPoints}| ";
            }

            Console.WriteLine("Board:");
            Console.WriteLine("");
            Console.WriteLine($"Opponent - LifePoints: {lifePoints[opponent]} - AttackPoints: { attackPoints[opponent]}");
            Console.WriteLine($"(Long Range) [{board.GetAttackPoints(EnumType.longRange)[opponent]}]: {lRange0}");
            Console.WriteLine($"(Range) [{board.GetAttackPoints(EnumType.range)[opponent]}]: {range0}");
            Console.WriteLine($"(Melee) [{board.GetAttackPoints(EnumType.longRange)[opponent]}]: {melee0}");
            Console.WriteLine("");
            Console.WriteLine($"Weather Cards: {weatherCards}");
            Console.WriteLine($"Opponent - LifePoints: {lifePoints[player]} - AttackPoints: {attackPoints[player]}");
            Console.WriteLine("");
            Console.WriteLine($"(Long Range) [{board.GetAttackPoints(EnumType.longRange)[player]}]: {lRange1}");
            Console.WriteLine($"(Range) [{board.GetAttackPoints(EnumType.range)[player]}]: {range1}");
            Console.WriteLine($"(Melee) [{board.GetAttackPoints(EnumType.longRange)[player]}]: {melee1}");
            Console.WriteLine("");
            Console.WriteLine("");
        }
예제 #35
0
 public void DiscardCardFromHand(CombatCard card)
 {
     cardsInHand.Remove(card);
     assignedDeck.DiscardCards(card);
 }
        public void Play()
        {
            int  userInput         = 0;
            int  firstOrSecondUser = ActivePlayer.Id == 0 ? 0 : 1;
            int  winner            = -1;
            bool bothPlayersPlayed = false;
            int  contadorDeCambios = 0;


            while (turn < 4 && !CheckIfEndGame())
            {
                bool verificar = Visualization.ShowMenuCarga();
                if (verificar == false)
                {
                    bool drawCard = false;
                    //turno 0 o configuracion
                    if (turn == 0)
                    {
                        for (int _ = 0; _ < Players.Length; _++)
                        {
                            ActivePlayer = Players[firstOrSecondUser];
                            Visualization.ClearConsole();
                            //Mostrar mensaje de inicio
                            Visualization.ShowProgramMessage($"Player {ActivePlayer.Id + 1} select Deck and Captain:");
                            //Preguntar por deck
                            Visualization.ShowDecks(this.Decks);
                            userInput = Visualization.GetUserInput(this.Decks.Count - 1);
                            Deck deck = new Deck();
                            deck.Cards        = new List <Card>(Decks[userInput].Cards);
                            ActivePlayer.Deck = deck;
                            //Preguntar por capitan
                            Visualization.ShowCaptains(Captains);
                            userInput = Visualization.GetUserInput(this.Captains.Count - 1);
                            ActivePlayer.ChooseCaptainCard(new SpecialCard(Captains[userInput].Name, Captains[userInput].Type, Captains[userInput].Effect));
                            //Asignar mano
                            ActivePlayer.FirstHand();
                            //Mostrar mano
                            Visualization.ShowHand(ActivePlayer.Hand);
                            //Mostar opciones, cambiar carta o pasar
                            Visualization.ShowListOptions(new List <string>()
                            {
                                "Change Card", "Pass"
                            }, "Change 3 cards or ready to play:");
                            userInput = Visualization.GetUserInput(1);
                            if (userInput == 0)
                            {
                                if (contadorDeCambios < 3)
                                {
                                    Visualization.ClearConsole();
                                    Visualization.ShowProgramMessage($"Player {ActivePlayer.Id + 1} change cards:");
                                    Visualization.ShowHand(ActivePlayer.Hand);
                                    for (int i = 0; i < DEFAULT_CHANGE_CARDS_NUMBER; i++)
                                    {
                                        Visualization.ShowProgramMessage($"Input the numbers of the cards to change (max {DEFAULT_CHANGE_CARDS_NUMBER}). To stop enter -1");
                                        userInput = Visualization.GetUserInput(ActivePlayer.Hand.Cards.Count, true);
                                        if (userInput == -1)
                                        {
                                            break;
                                        }
                                        ActivePlayer.ChangeCard(userInput);
                                        Visualization.ShowHand(ActivePlayer.Hand);
                                    }
                                }
                                else
                                {
                                    Visualization.ShowProgramMessage("Ya no puedes hacer mas cambios");
                                    Visualization.ShowProgramMessage("Presiona una tecla para continuar");
                                    Console.ReadKey();
                                    Visualization.ClearConsole();
                                }
                            }
                            else if (userInput == 1)
                            {
                                Visualization.ClearConsole();
                                Visualization.ShowHand(activePlayer.Hand);
                                Visualization.ShowProgramMessage("Ingrese el id de la carta para ver la informacion de esta");
                                userInput = Visualization.GetUserInput(activePlayer.Hand.Cards.Count, true);
                                if (userInput != -1)
                                {
                                    if (activePlayer.Hand.Cards[userInput] is CombatCard)
                                    {
                                        CombatCard    card       = activePlayer.Hand.Cards[userInput] as CombatCard;
                                        List <string> componente = new List <string>()
                                        {
                                            "Name: ", "Type: ", "Effect: ", "Attack Points: ", "Hero: "
                                        };
                                        int i = 0;
                                        foreach (string com in componente)
                                        {
                                            Visualization.ShowProgramMessage(com + card.GetCharacteristics()[i]);
                                            i++;
                                        }
                                    }
                                    else
                                    {
                                        SpecialCard   card       = activePlayer.Hand.Cards[userInput] as SpecialCard;
                                        List <string> componente = new List <string>()
                                        {
                                            "Name: ", "Type: ", "Effect: ", "Buff: "
                                        };
                                        int i = 0;
                                        foreach (string co in componente)
                                        {
                                            Visualization.ShowProgramMessage(co + card.GetCharacteristics()[i]);
                                            i++;
                                        }
                                    }
                                }
                            }
                            else if (userInput == 2)
                            {
                                firstOrSecondUser = ActivePlayer.Id == 0 ? 1 : 0;
                            }
                            contadorDeCambios = 0;
                        }
                        turn += 1;
                        Save();
                    }


                    //turnos siguientes
                    else
                    {
                        while (true)
                        {
                            ActivePlayer = Players[firstOrSecondUser];
                            //Obtener lifePoints
                            int[] lifePoints = new int[2] {
                                Players[0].LifePoints, Players[1].LifePoints
                            };
                            //Obtener total de ataque:
                            int[] attackPoints = new int[2] {
                                Players[0].GetAttackPoints()[0], Players[1].GetAttackPoints()[0]
                            };
                            //Mostrar tablero, mano y solicitar jugada
                            Visualization.ClearConsole();
                            Visualization.ShowBoard(boardGame, ActivePlayer.Id, lifePoints, attackPoints);
                            //Robar carta
                            if (!drawCard)
                            {
                                ActivePlayer.DrawCard();
                                drawCard = true;
                            }
                            Visualization.ShowHand(ActivePlayer.Hand);
                            Visualization.ShowListOptions(new List <string> {
                                "Play Card", "Pass"
                            }, $"Make your move player {ActivePlayer.Id + 1}:");
                            userInput = Visualization.GetUserInput(1);
                            if (userInput == 0)
                            {
                                //Si la carta es un buff solicitar a la fila que va.
                                Visualization.ShowProgramMessage($"Input the number of the card to play. To cancel enter -1");
                                userInput = Visualization.GetUserInput(ActivePlayer.Hand.Cards.Count, true);
                                if (userInput != -1)
                                {
                                    if (ActivePlayer.Hand.Cards[userInput].Type == EnumType.buff)
                                    {
                                        Visualization.ShowListOptions(new List <string> {
                                            "Melee", "Range", "LongRange"
                                        }, $"Choose row to buff {ActivePlayer.Id}:");
                                        int cardId = userInput;
                                        userInput = Visualization.GetUserInput(2);
                                        if (userInput == 0)
                                        {
                                            ActivePlayer.PlayCard(cardId, EnumType.buffmelee);
                                        }
                                        else if (userInput == 1)
                                        {
                                            ActivePlayer.PlayCard(cardId, EnumType.buffrange);
                                        }
                                        else
                                        {
                                            ActivePlayer.PlayCard(cardId, EnumType.bufflongRange);
                                        }
                                    }
                                    else
                                    {
                                        ActivePlayer.PlayCard(userInput);
                                    }
                                }
                                //Revisar si le quedan cartas, si no le quedan obligar a pasar.
                                if (ActivePlayer.Hand.Cards.Count == 0)
                                {
                                    firstOrSecondUser = ActivePlayer.Id == 0 ? 1 : 0;
                                    Save();
                                    break;
                                }
                            }
                            else if (userInput == 1)
                            {
                                Visualization.ClearConsole();
                                Visualization.ShowHand(activePlayer.Hand);
                                Visualization.ShowProgramMessage("Ingrese el id de la carta para ver la informacion de esta");
                                userInput = Visualization.GetUserInput(activePlayer.Hand.Cards.Count, true);
                                if (userInput != -1)
                                {
                                    if (activePlayer.Hand.Cards[userInput] is CombatCard)
                                    {
                                        CombatCard    card       = activePlayer.Hand.Cards[userInput] as CombatCard;
                                        List <string> componente = new List <string>()
                                        {
                                            "Name: ", "Type: ", "Effect: ", "Attack Points: ", "Hero: "
                                        };
                                        int i = 0;
                                        foreach (string com in componente)
                                        {
                                            Visualization.ShowProgramMessage(com + card.GetCharacteristics()[i]);
                                            i++;
                                        }
                                    }
                                    else
                                    {
                                        SpecialCard   card       = activePlayer.Hand.Cards[userInput] as SpecialCard;
                                        List <string> componente = new List <string>()
                                        {
                                            "Name: ", "Type: ", "Effect: ", "Buff: "
                                        };
                                        int i = 0;
                                        foreach (string co in componente)
                                        {
                                            Visualization.ShowProgramMessage(co + card.GetCharacteristics()[i]);
                                            i++;
                                        }
                                    }
                                }
                            }
                            else if (userInput == 2)
                            {
                                firstOrSecondUser = ActivePlayer.Id == 0 ? 1 : 0;
                                Save();
                                break;
                            }
                        }
                    }
                    //Cambiar al oponente si no ha jugado
                    if (!bothPlayersPlayed)
                    {
                        bothPlayersPlayed = true;
                        drawCard          = false;
                    }
                    //Si ambos jugaron obtener el ganador de la ronda, reiniciar el tablero y pasar de turno.
                    else
                    {
                        winner = GetRoundWinner();
                        if (winner == 0)
                        {
                            Players[1].LifePoints -= 1;
                        }
                        else if (winner == 1)
                        {
                            Players[0].LifePoints -= 1;
                        }
                        else
                        {
                            Players[0].LifePoints -= 1;
                            Players[1].LifePoints -= 1;
                        }
                        bothPlayersPlayed = false;
                        turn += 1;
                        //Destruir Cartas
                        BoardGame.DestroyCards();
                    }
                }
            }
            //Definir cual es el ganador.
            winner = GetWinner();
            if (winner == 0)
            {
                Visualization.ShowProgramMessage($"Player 1 is the winner!");
            }
            else if (winner == 1)
            {
                Visualization.ShowProgramMessage($"Player 2 is the winner!");
            }
            else
            {
                Visualization.ShowProgramMessage($"Draw!");
            }
            Save();
        }
 void TryOverrideRangedCardTarget(CombatCard playedRangedCard)
 {
     if (playedRangedCard.targetType == CombatCard.TargetType.SelectEnemy
         || playedRangedCard.targetType == CombatCard.TargetType.Random
         || playedRangedCard.targetType == CombatCard.TargetType.Strongest
         || playedRangedCard.targetType == CombatCard.TargetType.Weakest)
     {
         if (combatManager.GetTurnStatus() == CombatManager.TurnStatus.Enemy)
         {
             if (rangedCardTargetOverrideMerc != null)
             {
                 playedRangedCard.targetChars.Clear();
                 playedRangedCard.targetChars.Add(rangedCardTargetOverrideMerc);
             }
         }
         if (combatManager.GetTurnStatus() == CombatManager.TurnStatus.Player)
         {
             if (rangedCardTargetOverrideEnemy != null)
             {
                 playedRangedCard.targetChars.Clear();
                 playedRangedCard.targetChars.Add(rangedCardTargetOverrideEnemy);
             }
         }
     }
 }
예제 #38
0
    public bool IsCardBlocked(CombatCard card)
    {
        if (card.GetType() == typeof(MeleeCard) && meleeBlockActive)
            return true;
        if (card.GetType() == typeof(RangedCard) && rangedBlockActive)
            return true;

        return false;
    }
예제 #39
0
    public bool EligibleCombatCardType(CombatCard card)
    {
        if (card.cardType == CombatCard.CardType.Ranged_Attack && rangedAttacksAllowed)
            return true;
        if (card.cardType != CombatCard.CardType.Ranged_Attack)
            return true;

        return false;
    }
        //Nuevo metodo

        public void ReadAddCard()
        {
            //esta es la direccion de donde esta nuestro archivo
            string path = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.FullName + @"\Files\Decks.txt";
            //leer el archivo
            StreamReader reader = new StreamReader("path");
            string       line   = reader.ReadLine();
            List <Card>  mazo   = new List <Card>();

            while (true)
            {
                line = reader.ReadLine();
                if (line == "END")
                {
                    break;
                }
                string[] aux = line.Split(",");
                if (aux[0] == "CombatCard")
                {
                    CombatCard newlist = new CombatCard(aux[1], (EnumType)Enum.Parse(typeof(EnumType), aux[2]), aux[3], int.Parse(aux[4]), bool.Parse(aux[5]));
                    mazo.Add(newlist);
                }
                else
                {
                    SpecialCard newcarta = new SpecialCard(aux[1], (EnumType)Enum.Parse(typeof(EnumType), aux[2]), aux[3]);
                    mazo.Add(newcarta);
                }
            }
            //subir las cartas del jugador 1 al deck
            this.decks[0].Cards = mazo;


            line = "";
            List <Card> mazo2 = new List <Card>();

            line = reader.ReadLine();
            while (true)
            {
                line = reader.ReadLine();
                if (line == "END")
                {
                    break;
                }
                string[] separar = line.Split(",");
                if (separar[0] == "CombatCard")
                {
                    CombatCard newlist = new CombatCard(separar[1], (EnumType)Enum.Parse(typeof(EnumType), separar[2]), separar[3], int.Parse(separar[4]), bool.Parse(separar[5]));
                    mazo2.Add(newlist);
                }
                else
                {
                    SpecialCard newcarta = new SpecialCard(separar[1], (EnumType)Enum.Parse(typeof(EnumType), separar[2]), separar[3]);
                    mazo2.Add(newcarta);
                }
            }
            //añadir las cartas del juggador 2 al deck
            this.decks[1].Cards = mazo2;

            //cerrar el archivo txt
            reader.Close();
        }
예제 #41
0
 public CombatCardGraphic InstantiateCombatCardGraphic(CombatCard card)
 {
     CombatCardGraphic newGraphic = Instantiate(visualCombatCardPrefab);
     newGraphic.AssignCard(card);
     return newGraphic;
 }
        public void leer()
        {
            StreamReader reader  = new StreamReader("Decks.txt");
            StreamReader reader2 = new StreamReader("Captains.txt");
            int          i       = 0;

            while (!reader.EndOfStream)
            {
                string line = reader.ReadLine();

                if (line == "START" || line == "END")
                {
                    if (line == "START")
                    {
                        i++;
                    }
                }
                else
                {
                    if (line.Contains("Combat"))
                    {
                        var a = line.Split(',');


                        EnumType enumTipo = (EnumType)Enum.Parse(typeof(EnumType), a[2]);

                        CombatCard carta = new CombatCard(a[1], enumTipo, a[3], int.Parse(a[4]), bool.Parse(a[5]));
                        if (i == 1)
                        {
                            mazo1.Add(carta);
                        }
                        else
                        {
                            mazo2.Add(carta);
                        }
                    }
                    else if (line.Contains("Special"))
                    {
                        var         a        = line.Split(',');
                        EnumType    enumTipo = (EnumType)Enum.Parse(typeof(EnumType), a[2]);
                        SpecialCard carta    = new SpecialCard(a[1], enumTipo, a[3]);
                        if (i == 1)
                        {
                            mazo1.Add(carta);
                        }
                        else
                        {
                            mazo2.Add(carta);
                        }
                    }
                }
            }

            decks[0].Cards = mazo1;
            decks[1].Cards = mazo2;



            while (!reader2.EndOfStream)
            {
                string line = reader2.ReadLine();
                var    a    = line.Split(',');
                if (line.Contains("Special"))
                {
                    EnumType    enumTipo = (EnumType)Enum.Parse(typeof(EnumType), a[2]);
                    SpecialCard carta    = new SpecialCard(a[1], enumTipo, a[3]);
                    capitanes.Add(carta);
                }
            }


            //agregar los mazos al deck



            reader.Close();
        }
예제 #43
0
 public static CombatCard[] GetMultipleCards(System.Type cardType, int cardCount)
 {
     CombatCard[] cards = new CombatCard[cardCount];
     for (int i = 0; i < cardCount; i++) cards[i] = (CombatCard)System.Activator.CreateInstance(cardType);
     return cards;
 }