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
This commit is contained in:
xenohedron 2023-06-02 11:31:15 +03:00 committed by GitHub
parent 913d5dfee8
commit 7b9243f640
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 ");
}
}