From f3ecd98f8a239318f68e4725fe7a1d479c149f07 Mon Sep 17 00:00:00 2001 From: Northmoc Date: Mon, 26 Jul 2021 19:06:34 -0400 Subject: [PATCH 1/4] manor_guardian.txt --- forge-gui/res/cardsfolder/upcoming/manor_guardian.txt | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 forge-gui/res/cardsfolder/upcoming/manor_guardian.txt diff --git a/forge-gui/res/cardsfolder/upcoming/manor_guardian.txt b/forge-gui/res/cardsfolder/upcoming/manor_guardian.txt new file mode 100644 index 00000000000..551bb20251d --- /dev/null +++ b/forge-gui/res/cardsfolder/upcoming/manor_guardian.txt @@ -0,0 +1,7 @@ +Name:Manor Guardian +ManaCost:2 B +Types:Creature Demon +PT:4/3 +T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Card.Self | Execute$ TrigSeek | TriggerDescription$ When CARDNAME dies, each player seeks a nonland card with mana value 2 or less. +SVar:TrigSeek:DB$ ChangeZone | Origin$ Library | Destination$ Hand | AtRandom$ True | NoShuffle$ True | Mandatory$ True | NoLooking$ True | NoReveal$ True | ChangeType$ Card.nonLand+cmcLE2 | ChangeNum$ 1 | DefinedPlayer$ Player +Oracle:When Manor Guardian dies, each player seeks a nonland card with mana value 2 or less. From d10a1e1a78bbceaa69990db8eb18402261e4d131 Mon Sep 17 00:00:00 2001 From: Northmoc Date: Mon, 26 Jul 2021 19:41:04 -0400 Subject: [PATCH 2/4] faceless_agent.txt --- forge-gui/res/cardsfolder/upcoming/faceless_agent.txt | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 forge-gui/res/cardsfolder/upcoming/faceless_agent.txt diff --git a/forge-gui/res/cardsfolder/upcoming/faceless_agent.txt b/forge-gui/res/cardsfolder/upcoming/faceless_agent.txt new file mode 100644 index 00000000000..3bdb71b7fe1 --- /dev/null +++ b/forge-gui/res/cardsfolder/upcoming/faceless_agent.txt @@ -0,0 +1,8 @@ +Name:Faceless Agent +ManaCost:3 +Types:Creature Shapeshifter +PT:2/1 +K:Changeling +T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigSeek | TriggerDescription$ When CARDNAME enters the battlefield, seek a creature card of the most prevalent creature type in your library. +SVar:TrigSeek:DB$ ChangeZone | Origin$ Library | Destination$ Hand | AtRandom$ True | NoShuffle$ True | Mandatory$ True | NoLooking$ True | NoReveal$ True | ChangeType$ Card.Creature+MostProminentCreatureTypeInLibrary | ChangeNum$ 1 +Oracle:Changeling\nWhen Faceless Agent enters the battlefield, seek a creature card of the most prevalent creature type in your library. From 64e95df6a2e1757e840c53fddd6c451ae5021db0 Mon Sep 17 00:00:00 2001 From: Northmoc Date: Mon, 26 Jul 2021 19:42:43 -0400 Subject: [PATCH 3/4] CardProperty - add "MostProminentCreatureTypeInLibrary" --- .../src/main/java/forge/game/card/CardProperty.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/forge-game/src/main/java/forge/game/card/CardProperty.java b/forge-game/src/main/java/forge/game/card/CardProperty.java index 68d6929a1ae..e71521d81a2 100644 --- a/forge-game/src/main/java/forge/game/card/CardProperty.java +++ b/forge-game/src/main/java/forge/game/card/CardProperty.java @@ -365,7 +365,7 @@ public class CardProperty { return false; } } else if (property.equals("CanBeSacrificedBy") && spellAbility instanceof SpellAbility) { - if (!card.canBeSacrificedBy((SpellAbility)spellAbility)) { + if (!card.canBeSacrificedBy((SpellAbility) spellAbility)) { return false; } } else if (property.startsWith("AttachedBy")) { @@ -720,6 +720,16 @@ public class CardProperty { } } } + } else if (property.startsWith("MostProminentCreatureTypeInLibrary")) { + final CardCollectionView list = sourceController.getCardsIn(ZoneType.Library); + String[] type = CardFactoryUtil.getMostProminentCreatureType(list); + if (type != null); { + for (String s : type) { + if (!card.getType().hasCreatureType(s)) { + return false; + } + } + } } else if (property.startsWith("sharesCreatureTypeWith")) { if (property.equals("sharesCreatureTypeWith")) { if (!card.sharesCreatureTypeWith(source)) { From 175db96e4f82a7bc9716a317d450ea9cfc9692e5 Mon Sep 17 00:00:00 2001 From: Northmoc Date: Mon, 26 Jul 2021 19:44:19 -0400 Subject: [PATCH 4/4] CardFactoryUtil - add getMostProminentCreatureType --- .../java/forge/game/card/CardFactoryUtil.java | 45 ++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java b/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java index d8dfbfa04bb..674b7144116 100644 --- a/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java +++ b/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java @@ -421,7 +421,7 @@ public class CardFactoryUtil { /** *

- * getMostProminentCreatureType. + * getMostProminentCreatureTypeSize. *

* * @param list @@ -457,6 +457,49 @@ public class CardFactoryUtil { return max + allCreatureType; } + /** + *

+ * getMostProminentCreatureType. + *

+ * + * @param list + * a {@link forge.game.card.CardCollection} object. + * @return a string. + */ + public static String[] getMostProminentCreatureType(final CardCollectionView list) { + if (list.isEmpty()) { + return null; + } + + final Map map = Maps.newHashMap(); + for (final Card c : list) { + // Remove Duplicated types + final Set creatureTypes = c.getType().getCreatureTypes(); + for (String creatureType : creatureTypes) { + Integer count = map.get(creatureType); + map.put(creatureType, count == null ? 1 : count + 1); + } + } + + int max = 0; + for (final Entry entry : map.entrySet()) { + if (max < entry.getValue()) { + max = entry.getValue(); + } + } + if (max == 0) { + return null; + } + StringBuilder sb = new StringBuilder(); + for (final Entry entry : map.entrySet()) { + if (max == entry.getValue()) { + sb.append(entry.getKey()).append(","); + } + } + + return sb.toString().split(","); + } + /** *

* sharedKeywords.