From 7b9243f6408b15bb41584d7227798a7877d48b4d Mon Sep 17 00:00:00 2001 From: xenohedron Date: Fri, 2 Jun 2023 11:31:15 +0300 Subject: [PATCH] Add string rule logic to TriggeredAbilityImpl (#10370) * Add string rule logic to TriggeredAbilityImpl * Fix string logic in TriggeredAbilityImpl * Revert adjustment that fixes some problems but causes others --- .../mage/abilities/TriggeredAbilityImpl.java | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Mage/src/main/java/mage/abilities/TriggeredAbilityImpl.java b/Mage/src/main/java/mage/abilities/TriggeredAbilityImpl.java index 34527c86c7..dc65b6b7c0 100644 --- a/Mage/src/main/java/mage/abilities/TriggeredAbilityImpl.java +++ b/Mage/src/main/java/mage/abilities/TriggeredAbilityImpl.java @@ -201,8 +201,10 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge newRule.insert(4, "may "); superRule = newRule.toString(); } - } else if (this.getTargets().isEmpty() + } else if (!ruleLow.startsWith("{this}") + && (this.getTargets().isEmpty() || ruleLow.startsWith("attach") + || ruleLow.startsWith("change") || ruleLow.startsWith("counter") || ruleLow.startsWith("destroy") || ruleLow.startsWith("sacrifice") @@ -210,15 +212,29 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge || ruleLow.startsWith("exile") || ruleLow.startsWith("gain") || ruleLow.startsWith("goad") + || ruleLow.startsWith("have") + || ruleLow.startsWith("move") || ruleLow.startsWith("prevent") || ruleLow.startsWith("put") || ruleLow.startsWith("remove") || ruleLow.startsWith("return") + || ruleLow.startsWith("shuffle") + || ruleLow.startsWith("turn") || ruleLow.startsWith("tap") - || ruleLow.startsWith("untap")) { + || ruleLow.startsWith("untap"))) { sb.append("you may "); } else if (!ruleLow.startsWith("its controller may")) { sb.append("you may have "); + superRule = superRule + .replaceAll(" becomes ", " become ") + .replaceAll(" blocks ", " block ") + .replaceAll(" deals ", " deal ") + .replaceAll(" discards ", " discard ") + .replaceAll(" gains ", " gain ") + .replaceAll(" gets ", " get ") + .replaceAll(" loses ", " lose ") + .replaceAll(" mills ", " mill ") + .replaceAll(" sacrifices ", " sacrifice "); } }