From 4495f038bd316601c4f95b11d89054804bbdeb39 Mon Sep 17 00:00:00 2001 From: Sloth Date: Tue, 8 Nov 2011 13:00:28 +0000 Subject: [PATCH] - Added some more options to the property "SharesColorWith" (for example "SharesColorWith TopOfLibary"). --- src/main/java/forge/Card.java | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/main/java/forge/Card.java b/src/main/java/forge/Card.java index dff90ca1fb7..5c9112421cd 100644 --- a/src/main/java/forge/Card.java +++ b/src/main/java/forge/Card.java @@ -6548,8 +6548,28 @@ public class Card extends GameEntity implements Comparable { return false; } } else if (property.startsWith("SharesColorWith")) { - if (!sharesColorWith(source)) { - return false; + if (property.equals("SharesColorWith")) { + if(!sharesColorWith(source)) { + return false; + } + } else { + String restriction = property.split("SharesColorWith ")[1]; + if (restriction.equals("TopCardOfLibrary")) { + CardList list = this.getOwner().getCardsIn(Zone.Library); + if (list.isEmpty() || !sharesColorWith(list.get(0))) { + return false; + } + } else { + boolean shares = false; + for (Card card : sourceController.getCardsIn(Constant.Zone.Battlefield)) { + if (card.isValid(restriction, sourceController, source) && sharesColorWith(card)) { + shares = true; + } + } + if(!shares) { + return false; + } + } } } else if (property.startsWith("withFlashback")) { boolean fb = false;