forked from External/mage
refactor: added code example for rules auto-replacement in creature's ETB (related to #12791)
This commit is contained in:
parent
1774c2ec36
commit
0d0661cc92
4 changed files with 26 additions and 1 deletions
|
|
@ -343,6 +343,20 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// rules fix: workaround to add text auto-replacement for creature's ETB
|
||||
if (this.isCreature() && ability.getRule().startsWith("When {this} enters") && ability instanceof TriggeredAbility) {
|
||||
TriggeredAbility triggeredAbility = ((TriggeredAbility) ability);
|
||||
if (triggeredAbility.getTriggerPhrase() != null) {
|
||||
// TODO: delete or enable after wizards update all cards, not last sets only, see https://github.com/magefree/mage/issues/12791
|
||||
//triggeredAbility.setTriggerPhrase(triggeredAbility.getTriggerPhrase().replace("{this}", "this creature"));
|
||||
}
|
||||
}
|
||||
// verify check: all creatures with ETB must use "When this creature enters" instead "When {this} enters"
|
||||
if (this.isCreature() && ability.getRule().startsWith("When {this} enters")) {
|
||||
// see above
|
||||
//throw new IllegalArgumentException("Wrong code usage: creature's ETB ability must use text like \"When this creature enters\"");
|
||||
}
|
||||
}
|
||||
|
||||
protected void addAbility(Ability ability, Watcher watcher) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue