Refactor: fixed flavor word for ability (related to comments from 6dafb3ad81);

This commit is contained in:
Oleg Agafonov 2021-06-30 16:30:39 +04:00
parent 6dafb3ad81
commit a1de8cc85a
10 changed files with 14 additions and 10 deletions

View file

@ -31,7 +31,7 @@ public final class BalefulBeholder extends CardImpl {
// When Baleful Beholder enters the battlefield, choose one // When Baleful Beholder enters the battlefield, choose one
// Antimagic Cone Each opponent sacrifices an enchantment. // Antimagic Cone Each opponent sacrifices an enchantment.
Ability ability = new EntersBattlefieldTriggeredAbility(new SacrificeOpponentsEffect(StaticFilters.FILTER_ENCHANTMENT_PERMANENT)); Ability ability = new EntersBattlefieldTriggeredAbility(new SacrificeOpponentsEffect(StaticFilters.FILTER_ENCHANTMENT_PERMANENT));
ability.withFlavorWord("Antimagic Cone"); ability.getModes().getMode().withFlavorWord("Antimagic Cone");
// Fear Ray Creatures you control gain menace until end of turn. // Fear Ray Creatures you control gain menace until end of turn.
ability.addMode(new Mode(new GainAbilityControlledEffect( ability.addMode(new Mode(new GainAbilityControlledEffect(

View file

@ -32,7 +32,7 @@ public final class DawnbringerCleric extends CardImpl {
// When Dawnbringer Cleric enters the battlefield, choose one // When Dawnbringer Cleric enters the battlefield, choose one
// Cure Wounds You gain 2 life. // Cure Wounds You gain 2 life.
Ability ability = new EntersBattlefieldTriggeredAbility(new GainLifeEffect(1)); Ability ability = new EntersBattlefieldTriggeredAbility(new GainLifeEffect(1));
ability.withFlavorWord("Cure Wounds"); ability.getModes().getMode().withFlavorWord("Cure Wounds");
// Dispel Magic Destroy target enchantment. // Dispel Magic Destroy target enchantment.
Mode mode = new Mode(new DestroyTargetEffect()); Mode mode = new Mode(new DestroyTargetEffect());

View file

@ -31,7 +31,7 @@ public final class InspiringBard extends CardImpl {
// Bardic Inspiration Target creature gets +2/+2 until end of turn. // Bardic Inspiration Target creature gets +2/+2 until end of turn.
Ability ability = new EntersBattlefieldTriggeredAbility(new BoostTargetEffect(2, 2)); Ability ability = new EntersBattlefieldTriggeredAbility(new BoostTargetEffect(2, 2));
ability.addTarget(new TargetCreaturePermanent()); ability.addTarget(new TargetCreaturePermanent());
ability.withFlavorWord("Bardic Inspiration"); ability.getModes().getMode().withFlavorWord("Bardic Inspiration");
// Song of Rest You gain 3 life. // Song of Rest You gain 3 life.
ability.addMode(new Mode( ability.addMode(new Mode(

View file

@ -32,7 +32,7 @@ public final class PlunderingBarbarian extends CardImpl {
// Smash the Chest Destroy target artifact. // Smash the Chest Destroy target artifact.
Ability ability = new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect()); Ability ability = new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect());
ability.addTarget(new TargetArtifactPermanent()); ability.addTarget(new TargetArtifactPermanent());
ability.withFlavorWord("Smash the Chest"); ability.getModes().getMode().withFlavorWord("Smash the Chest");
// Pry It Open Creature a Treasure token. // Pry It Open Creature a Treasure token.
ability.addMode(new Mode( ability.addMode(new Mode(

View file

@ -22,7 +22,7 @@ public final class YouFindTheVillainsLair extends CardImpl {
// Foil Their Scheme Counter target spell. // Foil Their Scheme Counter target spell.
this.getSpellAbility().addEffect(new CounterTargetEffect()); this.getSpellAbility().addEffect(new CounterTargetEffect());
this.getSpellAbility().addTarget(new TargetSpell()); this.getSpellAbility().addTarget(new TargetSpell());
this.getSpellAbility().withFlavorWord("Foil Their Scheme"); this.getSpellAbility().getModes().getMode().withFlavorWord("Foil Their Scheme");
// Learn Their Secrets Draw two cards, then discard two cards. // Learn Their Secrets Draw two cards, then discard two cards.
this.getSpellAbility().addMode(new Mode( this.getSpellAbility().addMode(new Mode(

View file

@ -25,7 +25,7 @@ public final class YouSeeAGuardApproach extends CardImpl {
// Distract the Guard Tap target creature. // Distract the Guard Tap target creature.
this.getSpellAbility().addEffect(new TapTargetEffect()); this.getSpellAbility().addEffect(new TapTargetEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.getSpellAbility().withFlavorWord("Distract the Guard"); this.getSpellAbility().getModes().getMode().withFlavorWord("Distract the Guard");
// Hide Target creature you control gains hexproof until end of turn. // Hide Target creature you control gains hexproof until end of turn.
Mode mode = new Mode(new GainAbilityTargetEffect(HexproofAbility.getInstance(), Duration.EndOfTurn)); Mode mode = new Mode(new GainAbilityTargetEffect(HexproofAbility.getInstance(), Duration.EndOfTurn));

View file

@ -22,7 +22,7 @@ public final class YouSeeAPairOfGoblins extends CardImpl {
// Choose one // Choose one
// Charge Them Creatures you control get +2/+0 until end of turn. // Charge Them Creatures you control get +2/+0 until end of turn.
this.getSpellAbility().addEffect(new BoostControlledEffect(2, 0, Duration.EndOfTurn)); this.getSpellAbility().addEffect(new BoostControlledEffect(2, 0, Duration.EndOfTurn));
this.getSpellAbility().withFlavorWord("Charge Them"); this.getSpellAbility().getModes().getMode().withFlavorWord("Charge Them");
// Befriend Them Create two 1/1 red Goblin creature tokens. // Befriend Them Create two 1/1 red Goblin creature tokens.
this.getSpellAbility().addMode(new Mode( this.getSpellAbility().addMode(new Mode(

View file

@ -467,7 +467,7 @@ public interface Ability extends Controllable, Serializable {
Ability setAbilityWord(AbilityWord abilityWord); Ability setAbilityWord(AbilityWord abilityWord);
/** /**
* Set Flavor word for current mode * Set flavor word for whole ability (if you need flavor word for choices then call it from mode)
* *
* @param flavorWord * @param flavorWord
* @return * @return

View file

@ -60,6 +60,7 @@ public abstract class AbilityImpl implements Ability {
protected Zone zone; protected Zone zone;
protected String name; protected String name;
protected AbilityWord abilityWord; protected AbilityWord abilityWord;
protected String flavorWord;
protected boolean usesStack = true; protected boolean usesStack = true;
protected boolean ruleAtTheTop = false; protected boolean ruleAtTheTop = false;
protected boolean ruleVisible = true; protected boolean ruleVisible = true;
@ -117,6 +118,7 @@ public abstract class AbilityImpl implements Ability {
this.ruleAdditionalCostsVisible = ability.ruleAdditionalCostsVisible; this.ruleAdditionalCostsVisible = ability.ruleAdditionalCostsVisible;
this.worksFaceDown = ability.worksFaceDown; this.worksFaceDown = ability.worksFaceDown;
this.abilityWord = ability.abilityWord; this.abilityWord = ability.abilityWord;
this.flavorWord = ability.flavorWord;
this.sourceObjectZoneChangeCounter = ability.sourceObjectZoneChangeCounter; this.sourceObjectZoneChangeCounter = ability.sourceObjectZoneChangeCounter;
this.canFizzle = ability.canFizzle; this.canFizzle = ability.canFizzle;
this.targetAdjuster = ability.targetAdjuster; this.targetAdjuster = ability.targetAdjuster;
@ -803,6 +805,8 @@ public abstract class AbilityImpl implements Ability {
String prefix; String prefix;
if (abilityWord != null) { if (abilityWord != null) {
prefix = abilityWord.formatWord(); prefix = abilityWord.formatWord();
} else if (flavorWord != null) {
prefix = "<i>" + flavorWord + "</i> &mdash; ";
} else { } else {
prefix = null; prefix = null;
} }
@ -1070,7 +1074,7 @@ public abstract class AbilityImpl implements Ability {
@Override @Override
public Ability withFlavorWord(String flavorWord) { public Ability withFlavorWord(String flavorWord) {
this.getModes().getMode().withFlavorWord(flavorWord); this.flavorWord = flavorWord;
return this; return this;
} }

View file

@ -78,7 +78,7 @@ public class Mode implements Serializable {
} }
/** /**
* Set Flavor word to the mode (same as ability/ancher words, but uses for lore/info and represents a possible choices) * Set Flavor word for choice in the mode (same as ability/ancher words, but uses for lore/info and represents a possible choices)
* *
* @param flavorWord * @param flavorWord
* @return * @return