Exemplo n.º 1
0
 public void PlaceFindedCard(GwentCard Card, ISimple SimpleCard)
 {
     if (Card is IPlaceable)
     {
         Card.CardLine = (SimpleCard.CardLine + 3);
         if (Card.CardLine > 6)
         {
             Card.CardLine = Card.CardLine % 6;
         }
         if (!SimpleCard.IsRemoved)
         {
             (Card as IPlaceable).PlaceCard(this);
         }
         else
         {
             RemoveFromLine(Card.CardLine, Card, SimpleCard.IsToUsed);
         }
     }
     else
     {
         AddWeatherCard(Card);
     }
     this.SelectedCardID = -1;
     this.AffectedCardID = -1;
 }
Exemplo n.º 2
0
        public void RemoveFromLine(int Line, GwentCard Card, bool IsToUsed)
        {
            int Ind = GetInd(Card, Lines[Line - 1]);

            Lines[Line - 1].RemoveAt(Ind);
            if (IsUserTurn)
            {
                Net.SendSimpleCommand(this.AffectedCardID, Line, Card.CardID,
                                      Card.IsSpecialAbilitiPerformed, true, IsToUsed);
            }
            if (this.IsUserTurn)
            {
                if (IsToUsed)
                {
                    UsedCards.Add(Card);
                    UsedCardsChanged();
                }
            }
            else
            {
                if (IsToUsed)
                {
                    OponentUsedCards.Add(Card);
                    OponentUsedCardsChanged();
                }
            }
            LineCardsChanged(Line);
        }
Exemplo n.º 3
0
        private GwentCard CopyGwentCard(GwentCard Source)
        {
            string    CardXamlString = XamlWriter.Save(Source);
            GwentCard SplitedCard    = XamlReader.Parse(CardXamlString) as GwentCard;

            SplitedCard.Count = 1;
            return(SplitedCard);
        }
Exemplo n.º 4
0
        public void CardArived(ISimple SimpleCard)
        {
            this.AffectedCardID = SimpleCard.AffectedCardPos;
            GwentCard FindedCard = GetCardByID(SimpleCard.CardID);
            GwentCard Card       = CopyGwentCard(FindedCard);

            Card.IsSpecialAbilitiPerformed = Card.WhenSendIsPerformed;
            PlaceFindedCard(Card, SimpleCard);
        }
Exemplo n.º 5
0
 public void InsertToLine(int Line, int Ind, GwentCard Card)
 {
     Lines[Line - 1].Insert(Ind, Card);
     if (IsUserTurn)
     {
         Net.SendSimpleCommand(this.AffectedCardID, Line, Card.CardID, Card.IsSpecialAbilitiPerformed, false, false);
     }
     LineCardsChanged(Line);
 }
Exemplo n.º 6
0
 private void PlaceCallCard(GwentCard Card, Battleground Battleground, List <PlaceableCard> Cards)
 {
     if (Card is IPlaceable)
     {
         PlaceableCard PlCard = Card as PlaceableCard;
         if (PlCard.CardID == this.CardID)
         {
             Cards.Add(PlCard);
         }
     }
 }
Exemplo n.º 7
0
 private int GetInd(GwentCard Card, List <GwentCard> Cards)
 {
     foreach (GwentCard CurrCard in Cards)
     {
         if (CurrCard.CardID == Card.CardID)
         {
             return(Cards.IndexOf(CurrCard));
         }
     }
     return(-1);
 }
Exemplo n.º 8
0
 public override void PerformSpecialAbility(Battleground Battleground)
 {
     if (!IsSpecialAbilitiPerformed)
     {
         Random rnd = new Random();
         for (int i = 0; i < 2; i++)
         {
             if (Battleground.InStackCards.Count >= 1)
             {
                 int       RandomNumber = rnd.Next(Battleground.InStackCards.Count);
                 GwentCard Card         = Battleground.InStackCards[RandomNumber];
                 Battleground.InStackCards.Remove(Card);
                 Battleground.AddToInHandCards(Card);
             }
         }
         IsSpecialAbilitiPerformed = true;
     }
 }
Exemplo n.º 9
0
        public void SplitUserCards(List <GwentCard> UserCards)
        {
            this.InStackCards = new List <GwentCard>();

            foreach (GwentCard card in UserCards)
            {
                if (card.Count > 1)
                {
                    for (int i = 0; i < card.Count; i++)
                    {
                        GwentCard SplitedCard = CopyGwentCard(card);
                        this.InStackCards.Add(SplitedCard);
                    }
                }
                else
                {
                    this.InStackCards.Add(card);
                }
            }
        }
Exemplo n.º 10
0
 public bool Impact(Battleground Battlegrnd, int CardLine, int CardPos)
 {
     if (CardPos != -1)
     {
         GwentCard Card = Battlegrnd.Lines[CardLine][CardPos];
         if (Card.CardLine > 3 || Card.Invinsible)
         {
             return(false);
         }
         else
         {
             Battlegrnd.RemoveFromLine(Card.CardLine, Card, false);
             Battlegrnd.AddToInHandCards(Card);
             return(true);
         }
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 11
0
        public void AddWeatherCard(GwentCard AddingCard)
        {
            bool IsAlreadyIn = false;

            if (this.IsUserTurn)
            {
                Net.SendSimpleCommand(this.AffectedCardID, AddingCard.CardLine,
                                      AddingCard.CardID, AddingCard.IsSpecialAbilitiPerformed, false, false);
            }

            foreach (GwentCard Card in CurrWeatherCard)
            {
                if (AddingCard.CardID == Card.CardID)
                {
                    IsAlreadyIn = true;
                }
            }
            if (!IsAlreadyIn)
            {
                CurrWeatherCard.Add(AddingCard);
                ChangedWeatherTrigger();
            }
        }
Exemplo n.º 12
0
 public void AddToInHandCards(GwentCard Card)
 {
     this.InHandCards.Add(Card);
     InHandTrigger();
 }