From 51fdf21d1e83cf30f01728304b74e3e17ec0e4df Mon Sep 17 00:00:00 2001 From: Hans Mackowiak Date: Sat, 27 Jun 2020 14:53:01 +0200 Subject: [PATCH] M21: add Sanctum of All --- .../src/main/java/forge/game/card/Card.java | 3 ++- .../forge/game/trigger/TriggerHandler.java | 23 +++++++++++++++++-- .../cardsfolder/upcoming/sanctum_of_all.txt | 8 +++++++ 3 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 forge-gui/res/cardsfolder/upcoming/sanctum_of_all.txt 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 d5b8815ecf1..753b99333cf 100644 --- a/forge-game/src/main/java/forge/game/card/Card.java +++ b/forge-game/src/main/java/forge/game/card/Card.java @@ -1629,7 +1629,7 @@ public class Card extends GameEntity implements Comparable { } } if (keyword.startsWith("CantBeCounteredBy") || keyword.startsWith("Panharmonicon") - || keyword.startsWith("Dieharmonicon")) { + || keyword.startsWith("Dieharmonicon") || keyword.startsWith("Shrineharmonicon")) { final String[] p = keyword.split(":"); sbLong.append(p[2]).append("\r\n"); } else if (keyword.startsWith("etbCounter")) { @@ -4192,6 +4192,7 @@ public class Card extends GameEntity implements Comparable { public final boolean isFortification() { return getType().hasSubtype("Fortification"); } public final boolean isCurse() { return getType().hasSubtype("Curse"); } public final boolean isAura() { return getType().hasSubtype("Aura"); } + public final boolean isShrine() { return getType().hasSubtype("Shrine"); } public final boolean isAttachment() { return isAura() || isEquipment() || isFortification(); } public final boolean isHistoric() {return getType().isLegendary() || isArtifact() || getType().hasSubtype("Saga");} diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerHandler.java b/forge-game/src/main/java/forge/game/trigger/TriggerHandler.java index f5ec0661a96..b8a03d637a2 100644 --- a/forge-game/src/main/java/forge/game/trigger/TriggerHandler.java +++ b/forge-game/src/main/java/forge/game/trigger/TriggerHandler.java @@ -26,6 +26,7 @@ import forge.game.ability.AbilityKey; import forge.game.ability.effects.CharmEffect; import forge.game.card.Card; import forge.game.card.CardLists; +import forge.game.card.CardPredicates; import forge.game.card.CardUtil; import forge.game.card.CardZoneTable; import forge.game.keyword.KeywordInterface; @@ -618,10 +619,29 @@ public class TriggerHandler { private int handlePanharmonicon(final Trigger t, final Map runParams, final Player p) { Card host = t.getHostCard(); + int n = 0; + + // Sanctum of All + if (host.isShrine() && host.isInZone(ZoneType.Battlefield) && p.equals(host.getController())) { + int shrineCount = CardLists.count(p.getCardsIn(ZoneType.Battlefield), CardPredicates.isType("Shrine")); + if (shrineCount >= 6) { + for (final Card ck : p.getCardsIn(ZoneType.Battlefield)) { + for (final KeywordInterface ki : ck.getKeywords()) { + final String kw = ki.getOriginal(); + if (kw.startsWith("Shrineharmonicon")) { + final String valid = kw.split(":")[1]; + if (host.isValid(valid.split(","), p, ck, null)) { + n++; + } + } + } + } + } + } // not a changesZone trigger or changesZoneAll if (t.getMode() != TriggerType.ChangesZone && t.getMode() != TriggerType.ChangesZoneAll) { - return 0; + return n; } // leave battlefield trigger, might be dying @@ -636,7 +656,6 @@ public class TriggerHandler { return 0; } - int n = 0; if (t.getMode() == TriggerType.ChangesZone) { // iterate over all cards final List lastCards = CardLists.filterControlledBy(p.getGame().getLastStateBattlefield(), p); diff --git a/forge-gui/res/cardsfolder/upcoming/sanctum_of_all.txt b/forge-gui/res/cardsfolder/upcoming/sanctum_of_all.txt new file mode 100644 index 00000000000..8174b7f0f28 --- /dev/null +++ b/forge-gui/res/cardsfolder/upcoming/sanctum_of_all.txt @@ -0,0 +1,8 @@ +Name:Sanctum of All +ManaCost:W U B R G +Types:Legendary Enchantment Shrine +T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Battlefield | OptionalDecider$ You | Execute$ TrigSearch | TriggerDescription$ At the beginning of your upkeep, you may search your library and/or graveyard for a Shrine card and put it onto the battlefield. If you search your library this way, shuffle it. +SVar:TrigSearch:DB$ ChangeZone | Origin$ Library | OriginChoice$ True | OriginAlternative$ Graveyard | AlternativeMessage$ Would you like to search your library with this ability? If you do, your library will be shuffled. | Destination$ Battlefield | ChangeType$ Card.Shrine +K:Shrineharmonicon:Shrine.Other+YouCtrl:If an ability of another Shrine you control triggers while you control six or more Shrines, that ability triggers an additional time. +DeckHints:Type$Shrine +Oracle:At the beginning of your upkeep, you may search your library and/or graveyard for a Shrine card and put it onto the battlefield. If you search your library this way, shuffle it.\nIf an ability of another Shrine you control triggers while you control six or more Shrines, that ability triggers an additional time.