diff --git a/forge-core/src/main/java/forge/card/CardType.java b/forge-core/src/main/java/forge/card/CardType.java index df1b3e8fcc1..e79fe81e62a 100644 --- a/forge-core/src/main/java/forge/card/CardType.java +++ b/forge-core/src/main/java/forge/card/CardType.java @@ -371,6 +371,14 @@ public final class CardType implements Comparable { return (!CardType.isASuperType(cardType) && !CardType.isACardType(cardType)); } + public static boolean isAPermanentType(final String cardType) { + return cardType.equals(CardType.CoreType.Artifact.toString()) + || cardType.equals(CardType.CoreType.Creature.toString()) + || cardType.equals(CardType.CoreType.Enchantment.toString()) + || cardType.equals(CardType.CoreType.Land.toString()) + || cardType.equals(CardType.CoreType.Planeswalker.toString()); + } + public static boolean isACreatureType(final String cardType) { return (Constant.CREATURE_TYPES.contains(cardType)); } diff --git a/forge-game/src/main/java/forge/game/card/Card.java b/forge-game/src/main/java/forge/game/card/Card.java index fd68016b37f..3491634dcc7 100644 --- a/forge-game/src/main/java/forge/game/card/Card.java +++ b/forge-game/src/main/java/forge/game/card/Card.java @@ -5919,7 +5919,11 @@ public class Card extends GameEntity implements Comparable { return false; } } - } else if (property.startsWith("sharesNameWith")) { + } else if (property.equals("sharesPermanentTypeWith")) { + if (!this.sharesPermanentTypeWith(source)) { + return false; + } + }else if (property.startsWith("sharesNameWith")) { if (property.equals("sharesNameWith")) { if (!this.getName().equals(source.getName())) { return false; @@ -6773,6 +6777,29 @@ public class Card extends GameEntity implements Comparable { return false; } + /** + *

+ * sharesPermanentTypeWith. + *

+ * + * @param c1 + * a {@link forge.game.card.Card} object. + * @return a boolean. + */ + public final boolean sharesPermanentTypeWith(final Card c1) { + + if (c1 == null) { + return false; + } + + for (final String type : this.getType()) { + if (forge.card.CardType.isAPermanentType(type) && c1.isType(type)) { + return true; + } + } + return false; + } + /** *

* sharesTypeWith. diff --git a/forge-gui/res/cardsfolder/c/cloudstone_curio.txt b/forge-gui/res/cardsfolder/c/cloudstone_curio.txt index bb566825290..04dbf22c671 100644 --- a/forge-gui/res/cardsfolder/c/cloudstone_curio.txt +++ b/forge-gui/res/cardsfolder/c/cloudstone_curio.txt @@ -1,8 +1,8 @@ Name:Cloudstone Curio ManaCost:3 Types:Artifact -T:Mode$ ChangesZone | ValidCard$ Permanent.YouCtrl+nonArtifact | Origin$ Any | Destination$ Battlefield | TriggerZones$ Battlefield | Execute$ TrigBounce | TriggerDescription$ Whenever a nonartifact permanent enters the battlefield under your control, you may return another permanent you control that shares a card type with it to its owner's hand. -SVar:TrigBounce:AB$ ChangeZone | Cost$ 0 | DefinedPlayer$ TriggeredCardController | ChangeType$ Triggered.Other+sharesCardTypeWith | ChangeNum$ 1 | Origin$ Battlefield | Destination$ Hand | Hidden$ True | Optional$ You +T:Mode$ ChangesZone | ValidCard$ Permanent.YouCtrl+nonArtifact | Origin$ Any | Destination$ Battlefield | TriggerZones$ Battlefield | Execute$ TrigBounce | TriggerDescription$ Whenever a nonartifact permanent enters the battlefield under your control, you may return another permanent you control that shares a permanent type with it to its owner's hand. +SVar:TrigBounce:AB$ ChangeZone | Cost$ 0 | DefinedPlayer$ TriggeredCardController | ChangeType$ Triggered.Other+sharesPermanentTypeWith | ChangeNum$ 1 | Origin$ Battlefield | Destination$ Hand | Hidden$ True | Optional$ You SVar:RemRandomDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/cloudstone_curio.jpg -Oracle:Whenever a nonartifact permanent enters the battlefield under your control, you may return another permanent you control that shares a card type with it to its owner's hand. \ No newline at end of file +Oracle:Whenever a nonartifact permanent enters the battlefield under your control, you may return another permanent you control that shares a permanent type with it to its owner's hand. \ No newline at end of file