Reworking triggered ability text generation to allow for ability words and flavor words to be added more easily (#8010)

* refactor all instances of getRule in triggered abilities using new getTriggerPrefix method

* updated triggered ability rules generation

* renamed method

* fixed a test failure

* some more refactoring

* simplified some instances of ability word usage
This commit is contained in:
Evan Kranzler 2021-07-15 07:46:38 -04:00 committed by GitHub
parent 0a31110164
commit ca80806400
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
398 changed files with 946 additions and 989 deletions

View file

@ -2,15 +2,16 @@
package mage.abilities.keyword;
import mage.constants.Zone;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.constants.AbilityWord;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
/**
* FAQ 2013/01/11
*
* <p>
* Battalion is an ability word that appears in italics at the beginning of abilities
* that trigger whenever you attack with that creature and at least two other
* creatures. (An ability word has no rules meaning.)
@ -23,6 +24,7 @@ public class BattalionAbility extends TriggeredAbilityImpl {
public BattalionAbility(Effect effect) {
super(Zone.BATTLEFIELD, effect);
this.setAbilityWord(AbilityWord.BATTALION);
}
public BattalionAbility(final BattalionAbility ability) {
@ -45,8 +47,8 @@ public class BattalionAbility extends TriggeredAbilityImpl {
}
@Override
public String getRule() {
return new StringBuilder("<i>Battalion</i> &mdash; Whenever {this} and at least two other creatures attack, ").append(super.getRule()).toString() ;
public String getTriggerPhrase() {
return "Whenever {this} and at least two other creatures attack, ";
}
}