/// <summary> /// Add a new Element to the GraveYard /// </summary> /// <param name="cellViewModel">The Cell that will be added to the GraveYard</param> public void AddToGraveYard(CellViewModel cellViewModel) { if (cellViewModel?.CurrentChessPiece == null) { return; } GraveYard.Add(cellViewModel.CurrentChessPiece); }
internal void SendToGraveYard(System.Object c, Zone z) { if (z == Zone.Hand) { if (Hand.Contains(c as Cards.Card)) { Hand.Remove(c as Cards.Card); MeReadOnly.NumberOfCardsInHand = MeReadOnly.NumberOfCardsInHand - 1; } } else if (z == Zone.Monster) { if (FaceDownCardsInMonsterZone.Contains(c as MonsterCard)) { FaceDownCardsInMonsterZone.Remove(c as MonsterCard); SpellAndTrapCard attachedTo = (c as MonsterCard).EquippedTo; if (attachedTo != null) { SendToGraveYard(attachedTo, Zone.SpellTrap); } MeReadOnly.NumberOfFaceDownCardsInMonsterZone = MeReadOnly.NumberOfFaceDownCardsInMonsterZone - 1; } else if (MeReadOnly.FaceUpMonsters.Contains(c as MonsterCard)) { List <MonsterCard> toRemoveFrom = MeReadOnly.FaceUpMonsters; toRemoveFrom.Remove(c as MonsterCard); SpellAndTrapCard attachedTo = (c as MonsterCard).EquippedTo; if (attachedTo != null) { SendToGraveYard(attachedTo, Zone.SpellTrap); } MeReadOnly.FaceUpMonsters = toRemoveFrom; } } else if (z == Zone.SpellTrap) { if (FaceDownTraps.Contains(c as SpellAndTrapCard)) { FaceDownTraps.Remove(c as SpellAndTrapCard); MeReadOnly.NumberOfFaceDownTraps--; } else if (MeReadOnly.FaceUpTraps.Contains(c as SpellAndTrapCard)) { List <SpellAndTrapCard> toRemoveFrom = MeReadOnly.FaceUpTraps; toRemoveFrom.Remove(c as SpellAndTrapCard); MeReadOnly.FaceUpTraps = toRemoveFrom; } } GraveYard.Add(c as Cards.Card); }