diff --git a/Mage.Sets/src/mage/cards/b/BalefulBeholder.java b/Mage.Sets/src/mage/cards/b/BalefulBeholder.java index 6dafe38796..ce6ec7866c 100644 --- a/Mage.Sets/src/mage/cards/b/BalefulBeholder.java +++ b/Mage.Sets/src/mage/cards/b/BalefulBeholder.java @@ -31,11 +31,12 @@ public final class BalefulBeholder extends CardImpl { // When Baleful Beholder enters the battlefield, choose one — // • Antimagic Cone — Each opponent sacrifices an enchantment. Ability ability = new EntersBattlefieldTriggeredAbility(new SacrificeOpponentsEffect(StaticFilters.FILTER_ENCHANTMENT_PERMANENT)); - ability.getEffects().setFlavorWord("Antimagic Cone"); + ability.withFlavorWord("Antimagic Cone"); // • Fear Ray — Creatures you control gain menace until end of turn. ability.addMode(new Mode(new GainAbilityControlledEffect( - new MenaceAbility(), Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURES)).setFlavorWord("Fear Ray")); + new MenaceAbility(), Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURES)) + .withFlavorWord("Fear Ray")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/d/DawnbringerCleric.java b/Mage.Sets/src/mage/cards/d/DawnbringerCleric.java index 3c58854522..847dd3a70d 100644 --- a/Mage.Sets/src/mage/cards/d/DawnbringerCleric.java +++ b/Mage.Sets/src/mage/cards/d/DawnbringerCleric.java @@ -32,17 +32,17 @@ public final class DawnbringerCleric extends CardImpl { // When Dawnbringer Cleric enters the battlefield, choose one — // • Cure Wounds — You gain 2 life. Ability ability = new EntersBattlefieldTriggeredAbility(new GainLifeEffect(1)); - ability.getEffects().setFlavorWord("Cure Wounds"); + ability.withFlavorWord("Cure Wounds"); // • Dispel Magic — Destroy target enchantment. Mode mode = new Mode(new DestroyTargetEffect()); mode.addTarget(new TargetEnchantmentPermanent()); - ability.addMode(mode.setFlavorWord("Dispel Magic")); + ability.addMode(mode.withFlavorWord("Dispel Magic")); // • Gentle Repose — Exile target card from a graveyard. mode = new Mode(new ExileTargetEffect()); mode.addTarget(new TargetCardInGraveyard()); - ability.addMode(mode.setFlavorWord("Gentle Repose")); + ability.addMode(mode.withFlavorWord("Gentle Repose")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/g/GuildThief.java b/Mage.Sets/src/mage/cards/g/GuildThief.java index a4e7a7aca0..a3c073ec48 100644 --- a/Mage.Sets/src/mage/cards/g/GuildThief.java +++ b/Mage.Sets/src/mage/cards/g/GuildThief.java @@ -36,7 +36,7 @@ public final class GuildThief extends CardImpl { // Cunning Action — {3}{U}: Guild Thief can't be blocked this turn. this.addAbility(new SimpleActivatedAbility( new CantBeBlockedSourceEffect(Duration.EndOfTurn), new ManaCostsImpl<>("{3}{U}") - ).setFlavorWord("Cunning Action")); + ).withFlavorWord("Cunning Action")); } private GuildThief(final GuildThief card) { diff --git a/Mage.Sets/src/mage/cards/i/InspiringBard.java b/Mage.Sets/src/mage/cards/i/InspiringBard.java index ab82a8cbf0..3d793f0a46 100644 --- a/Mage.Sets/src/mage/cards/i/InspiringBard.java +++ b/Mage.Sets/src/mage/cards/i/InspiringBard.java @@ -31,10 +31,12 @@ public final class InspiringBard extends CardImpl { // • Bardic Inspiration — Target creature gets +2/+2 until end of turn. Ability ability = new EntersBattlefieldTriggeredAbility(new BoostTargetEffect(2, 2)); ability.addTarget(new TargetCreaturePermanent()); - ability.getEffects().setFlavorWord("Bardic Inspiration"); + ability.withFlavorWord("Bardic Inspiration"); // • Song of Rest — You gain 3 life. - ability.addMode(new Mode(new GainLifeEffect(3)).setFlavorWord("Song of Rest")); + ability.addMode(new Mode( + new GainLifeEffect(3) + ).withFlavorWord("Song of Rest")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/p/PlunderingBarbarian.java b/Mage.Sets/src/mage/cards/p/PlunderingBarbarian.java index 4fae63376a..b1ec7211a8 100644 --- a/Mage.Sets/src/mage/cards/p/PlunderingBarbarian.java +++ b/Mage.Sets/src/mage/cards/p/PlunderingBarbarian.java @@ -32,10 +32,12 @@ public final class PlunderingBarbarian extends CardImpl { // • Smash the Chest — Destroy target artifact. Ability ability = new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect()); ability.addTarget(new TargetArtifactPermanent()); - ability.getEffects().setFlavorWord("Smash the Chest"); + ability.withFlavorWord("Smash the Chest"); // • Pry It Open — Creature a Treasure token. - ability.addMode(new Mode(new CreateTokenEffect(new TreasureToken())).setFlavorWord("Pry It Open")); + ability.addMode(new Mode( + new CreateTokenEffect(new TreasureToken()) + ).withFlavorWord("Pry It Open")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/y/YouFindTheVillainsLair.java b/Mage.Sets/src/mage/cards/y/YouFindTheVillainsLair.java index a2cc83949d..b195e50066 100644 --- a/Mage.Sets/src/mage/cards/y/YouFindTheVillainsLair.java +++ b/Mage.Sets/src/mage/cards/y/YouFindTheVillainsLair.java @@ -22,12 +22,12 @@ public final class YouFindTheVillainsLair extends CardImpl { // • Foil Their Scheme — Counter target spell. this.getSpellAbility().addEffect(new CounterTargetEffect()); this.getSpellAbility().addTarget(new TargetSpell()); - this.getSpellAbility().getEffects().setFlavorWord("Foil Their Scheme"); + this.getSpellAbility().withFlavorWord("Foil Their Scheme"); // • Learn Their Secrets — Draw two cards, then discard two cards. this.getSpellAbility().addMode(new Mode( new DrawDiscardControllerEffect(2, 2) - ).setFlavorWord("Learn Their Secrts")); + ).withFlavorWord("Learn Their Secrts")); } private YouFindTheVillainsLair(final YouFindTheVillainsLair card) { diff --git a/Mage.Sets/src/mage/cards/y/YouSeeAGuardApproach.java b/Mage.Sets/src/mage/cards/y/YouSeeAGuardApproach.java index c920e0e731..389060c782 100644 --- a/Mage.Sets/src/mage/cards/y/YouSeeAGuardApproach.java +++ b/Mage.Sets/src/mage/cards/y/YouSeeAGuardApproach.java @@ -25,12 +25,12 @@ public final class YouSeeAGuardApproach extends CardImpl { // • Distract the Guard — Tap target creature. this.getSpellAbility().addEffect(new TapTargetEffect()); this.getSpellAbility().addTarget(new TargetCreaturePermanent()); - this.getSpellAbility().getEffects().setFlavorWord("Distract the Guard"); + this.getSpellAbility().withFlavorWord("Distract the Guard"); // • Hide — Target creature you control gains hexproof until end of turn. Mode mode = new Mode(new GainAbilityTargetEffect(HexproofAbility.getInstance(), Duration.EndOfTurn)); mode.addTarget(new TargetControlledCreaturePermanent()); - this.getSpellAbility().addMode(mode.setFlavorWord("Hide")); + this.getSpellAbility().addMode(mode.withFlavorWord("Hide")); } private YouSeeAGuardApproach(final YouSeeAGuardApproach card) { diff --git a/Mage.Sets/src/mage/cards/y/YouSeeAPairOfGoblins.java b/Mage.Sets/src/mage/cards/y/YouSeeAPairOfGoblins.java index e9a4ebe4f8..2bec28a415 100644 --- a/Mage.Sets/src/mage/cards/y/YouSeeAPairOfGoblins.java +++ b/Mage.Sets/src/mage/cards/y/YouSeeAPairOfGoblins.java @@ -22,12 +22,12 @@ public final class YouSeeAPairOfGoblins extends CardImpl { // Choose one — // • Charge Them — Creatures you control get +2/+0 until end of turn. this.getSpellAbility().addEffect(new BoostControlledEffect(2, 0, Duration.EndOfTurn)); - this.getSpellAbility().getEffects().setFlavorWord("Charge Them"); + this.getSpellAbility().withFlavorWord("Charge Them"); // • Befriend Them — Create two 1/1 red Goblin creature tokens. this.getSpellAbility().addMode(new Mode( new CreateTokenEffect(new GoblinToken(), 2) - ).setFlavorWord("Befriend Them")); + ).withFlavorWord("Befriend Them")); } private YouSeeAPairOfGoblins(final YouSeeAPairOfGoblins card) { diff --git a/Mage/src/main/java/mage/abilities/Ability.java b/Mage/src/main/java/mage/abilities/Ability.java index 127744885c..0bbedb5ddc 100644 --- a/Mage/src/main/java/mage/abilities/Ability.java +++ b/Mage/src/main/java/mage/abilities/Ability.java @@ -466,7 +466,13 @@ public interface Ability extends Controllable, Serializable { */ Ability setAbilityWord(AbilityWord abilityWord); - Ability setFlavorWord(String flavorWord); + /** + * Set Flavor word for current mode + * + * @param flavorWord + * @return + */ + Ability withFlavorWord(String flavorWord); /** * Creates the message about the ability casting/triggering/activating to diff --git a/Mage/src/main/java/mage/abilities/AbilityImpl.java b/Mage/src/main/java/mage/abilities/AbilityImpl.java index b79218bf33..8adcf667e8 100644 --- a/Mage/src/main/java/mage/abilities/AbilityImpl.java +++ b/Mage/src/main/java/mage/abilities/AbilityImpl.java @@ -60,7 +60,6 @@ public abstract class AbilityImpl implements Ability { protected Zone zone; protected String name; protected AbilityWord abilityWord; - protected String flavorWord; protected boolean usesStack = true; protected boolean ruleAtTheTop = false; protected boolean ruleVisible = true; @@ -118,7 +117,6 @@ public abstract class AbilityImpl implements Ability { this.ruleAdditionalCostsVisible = ability.ruleAdditionalCostsVisible; this.worksFaceDown = ability.worksFaceDown; this.abilityWord = ability.abilityWord; - this.flavorWord = ability.flavorWord; this.sourceObjectZoneChangeCounter = ability.sourceObjectZoneChangeCounter; this.canFizzle = ability.canFizzle; this.targetAdjuster = ability.targetAdjuster; @@ -805,8 +803,6 @@ public abstract class AbilityImpl implements Ability { String prefix; if (abilityWord != null) { prefix = abilityWord.formatWord(); - } else if (flavorWord != null) { - prefix = "" + flavorWord + " — "; } else { prefix = null; } @@ -1072,8 +1068,9 @@ public abstract class AbilityImpl implements Ability { return this; } - public Ability setFlavorWord(String flavorWord) { - this.flavorWord = flavorWord; + @Override + public Ability withFlavorWord(String flavorWord) { + this.getModes().getMode().withFlavorWord(flavorWord); return this; } diff --git a/Mage/src/main/java/mage/abilities/Mode.java b/Mage/src/main/java/mage/abilities/Mode.java index c4c588862b..f69dbc5f00 100644 --- a/Mage/src/main/java/mage/abilities/Mode.java +++ b/Mage/src/main/java/mage/abilities/Mode.java @@ -16,6 +16,7 @@ public class Mode implements Serializable { protected UUID id; protected final Targets targets; protected final Effects effects; + protected String flavorWord; public Mode() { this((Effect) null); @@ -34,6 +35,7 @@ public class Mode implements Serializable { this.id = mode.id; this.targets = mode.targets.copy(); this.effects = mode.effects.copy(); + this.flavorWord = mode.flavorWord; } public UUID setRandomId() { @@ -71,8 +73,18 @@ public class Mode implements Serializable { effects.add(effect); } - public Mode setFlavorWord(String flavorWord) { - effects.setFlavorWord(flavorWord); + public String getFlavorWord() { + return flavorWord; + } + + /** + * Set Flavor word to the mode (same as ability/ancher words, but uses for lore/info and represents a possible choices) + * + * @param flavorWord + * @return + */ + public Mode withFlavorWord(String flavorWord) { + this.flavorWord = flavorWord; return this; } } diff --git a/Mage/src/main/java/mage/abilities/effects/Effects.java b/Mage/src/main/java/mage/abilities/effects/Effects.java index 3075790ae4..e873e40a45 100644 --- a/Mage/src/main/java/mage/abilities/effects/Effects.java +++ b/Mage/src/main/java/mage/abilities/effects/Effects.java @@ -14,14 +14,11 @@ import java.util.Arrays; */ public class Effects extends ArrayList { - private String flavorWord = null; - public Effects(Effect... effects) { this.addAll(Arrays.asList(effects)); } public Effects(final Effects effects) { - this.flavorWord = effects.flavorWord; for (Effect effect : effects) { this.add(effect.copy()); } @@ -64,7 +61,6 @@ public class Effects extends ArrayList { } } - //check if nextRule is a new sentence or not. if (nextRule.startsWith("and ") || nextRule.startsWith("with ") || nextRule.startsWith("then ")) { endString = " "; @@ -100,10 +96,9 @@ public class Effects extends ArrayList { sbText.append(currentRule); lastRule = nextRule; - } - //add punctuation to very last rule. + // add punctuation to very last rule. if (lastRule != null && lastRule.length() > 3 && !lastRule.endsWith(".") && !lastRule.endsWith("\"") @@ -113,11 +108,12 @@ public class Effects extends ArrayList { sbText.append('.'); } - if (flavorWord != null) { - return "" + flavorWord + " — " + CardUtil.getTextWithFirstCharUpperCase(sbText.toString()); - } - return sbText.toString(); + // flavor word + if (mode.getFlavorWord() != null) { + return "" + mode.getFlavorWord() + " — " + CardUtil.getTextWithFirstCharUpperCase(sbText.toString()); + }; + return sbText.toString(); } public boolean hasOutcome(Ability source, Outcome outcome) { @@ -195,8 +191,4 @@ public class Effects extends ArrayList { effect.setValue(key, value); } } - - public void setFlavorWord(String flavorWord) { - this.flavorWord = flavorWord; - } } diff --git a/Mage/src/main/java/mage/game/stack/StackAbility.java b/Mage/src/main/java/mage/game/stack/StackAbility.java index e0b3b8777f..1a4601ed93 100644 --- a/Mage/src/main/java/mage/game/stack/StackAbility.java +++ b/Mage/src/main/java/mage/game/stack/StackAbility.java @@ -497,7 +497,7 @@ public class StackAbility extends StackObjectImpl implements Ability { } @Override - public Ability setFlavorWord(String flavorWord) { + public Ability withFlavorWord(String flavorWord) { throw new UnsupportedOperationException("Not supported."); }