Replace Overriden getTriggerPhrase() with setTriggerPhrase() usage (#9343)

This commit is contained in:
Alex Vasile 2022-08-08 23:28:46 -04:00 committed by GitHub
parent 188e6dd8c1
commit ebdb6b53a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
406 changed files with 918 additions and 2665 deletions

View file

@ -26,7 +26,7 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge
private boolean triggersOnce = false;
private boolean doOnlyOnce = false;
private GameEvent triggerEvent = null;
private String triggerPhrase = null;
private String triggerPhrase = null; // TODO: This should be change to final and all constructers to set a value
public TriggeredAbilityImpl(Zone zone, Effect effect) {
this(zone, effect, false);
@ -175,8 +175,20 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge
@Override
public String getRule() {
String superRule = super.getRule(true);
StringBuilder sb = new StringBuilder();
String prefix;
if (abilityWord != null) {
prefix = abilityWord.formatWord();
} else if (flavorWord != null) {
prefix = CardUtil.italicizeWithEmDash(flavorWord);
} else {
prefix = "";
}
sb.append(prefix);
sb.append(triggerPhrase == null ? getTriggerPhrase() : triggerPhrase);
String superRule = super.getRule(true);
if (!superRule.isEmpty()) {
String ruleLow = superRule.toLowerCase(Locale.ENGLISH);
if (isOptional()) {
@ -213,19 +225,12 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge
sb.append(" Do this only once each turn.");
}
}
String prefix;
if (abilityWord != null) {
prefix = abilityWord.formatWord();
} else if (flavorWord != null) {
prefix = CardUtil.italicizeWithEmDash(flavorWord);
} else {
prefix = "";
}
return prefix + (triggerPhrase == null ? getTriggerPhrase() : triggerPhrase) + sb;
return sb.toString();
}
@Override
@Deprecated
public String getTriggerPhrase() {
return "";
}