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;