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; }
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); }
private GwentCard CopyGwentCard(GwentCard Source) { string CardXamlString = XamlWriter.Save(Source); GwentCard SplitedCard = XamlReader.Parse(CardXamlString) as GwentCard; SplitedCard.Count = 1; return(SplitedCard); }
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); }
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); }
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); } } }
private int GetInd(GwentCard Card, List <GwentCard> Cards) { foreach (GwentCard CurrCard in Cards) { if (CurrCard.CardID == Card.CardID) { return(Cards.IndexOf(CurrCard)); } } return(-1); }
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; } }
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); } } }
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); } }
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(); } }
public void AddToInHandCards(GwentCard Card) { this.InHandCards.Add(Card); InHandTrigger(); }