From 7be16bdaac35ad52410e612bea15133ebea311fa Mon Sep 17 00:00:00 2001 From: xenohedron Date: Sun, 21 Jan 2024 01:42:34 -0500 Subject: [PATCH] refactor text gen for PutCardIntoPlayWithHasteAndSacrificeEffect --- Mage.Sets/src/mage/cards/a/ArmsRace.java | 9 +++++---- .../src/mage/cards/i/IncandescentSoulstoke.java | 4 +--- Mage.Sets/src/mage/cards/s/SneakAttack.java | 8 ++++---- Mage.Sets/src/mage/cards/t/ThroughTheBreach.java | 5 ++++- .../PutCardIntoPlayWithHasteAndSacrificeEffect.java | 13 +++++-------- 5 files changed, 19 insertions(+), 20 deletions(-) diff --git a/Mage.Sets/src/mage/cards/a/ArmsRace.java b/Mage.Sets/src/mage/cards/a/ArmsRace.java index 4a179fe3f93..06a203e9cdb 100644 --- a/Mage.Sets/src/mage/cards/a/ArmsRace.java +++ b/Mage.Sets/src/mage/cards/a/ArmsRace.java @@ -6,6 +6,7 @@ import mage.abilities.effects.common.PutCardIntoPlayWithHasteAndSacrificeEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.Duration; import mage.filter.StaticFilters; import java.util.UUID; @@ -18,10 +19,10 @@ public final class ArmsRace extends CardImpl { public ArmsRace(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{R}"); - // {3}{R}: You may put an artifact card from your hand onto the battlefield. It gains haste. Sacrifice it at the beginning of the next end step. - this.addAbility(new SimpleActivatedAbility( - new PutCardIntoPlayWithHasteAndSacrificeEffect(StaticFilters.FILTER_CARD_ARTIFACT), new ManaCostsImpl<>("{3}{R}") - )); + // {3}{R}: You may put an artifact card from your hand onto the battlefield. That artifact gains haste. Sacrifice it at the beginning of the next end step. + this.addAbility(new SimpleActivatedAbility(new PutCardIntoPlayWithHasteAndSacrificeEffect( + StaticFilters.FILTER_CARD_ARTIFACT, Duration.Custom, "That artifact", "it" + ), new ManaCostsImpl<>("{3}{R}"))); } private ArmsRace(final ArmsRace card) { diff --git a/Mage.Sets/src/mage/cards/i/IncandescentSoulstoke.java b/Mage.Sets/src/mage/cards/i/IncandescentSoulstoke.java index 268aa3fa991..e68393ce0e2 100644 --- a/Mage.Sets/src/mage/cards/i/IncandescentSoulstoke.java +++ b/Mage.Sets/src/mage/cards/i/IncandescentSoulstoke.java @@ -46,9 +46,7 @@ public final class IncandescentSoulstoke extends CardImpl { // {1}{R}, {T}: You may put an Elemental creature card from your hand onto the battlefield. That creature gains haste until end of turn. Sacrifice it at the beginning of the next end step. Ability ability = new SimpleActivatedAbility( - new PutCardIntoPlayWithHasteAndSacrificeEffect(filter2, Duration.EndOfTurn) - .setText("You may put an Elemental creature card from your hand onto the battlefield. " + - "That creature gains haste until end of turn. Sacrifice it at the beginning of the next end step."), + new PutCardIntoPlayWithHasteAndSacrificeEffect(filter2, Duration.EndOfTurn, "That creature", "it"), new ManaCostsImpl<>("{1}{R}") ); ability.addCost(new TapSourceCost()); diff --git a/Mage.Sets/src/mage/cards/s/SneakAttack.java b/Mage.Sets/src/mage/cards/s/SneakAttack.java index 99b43db759c..66d330b84b1 100644 --- a/Mage.Sets/src/mage/cards/s/SneakAttack.java +++ b/Mage.Sets/src/mage/cards/s/SneakAttack.java @@ -6,6 +6,7 @@ import mage.abilities.effects.common.PutCardIntoPlayWithHasteAndSacrificeEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.Duration; import mage.filter.StaticFilters; import java.util.UUID; @@ -19,9 +20,9 @@ public final class SneakAttack extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{R}"); // {R}: You may put a creature card from your hand onto the battlefield. That creature gains haste. Sacrifice the creature at the beginning of the next end step. - this.addAbility(new SimpleActivatedAbility( - new PutCardIntoPlayWithHasteAndSacrificeEffect(StaticFilters.FILTER_CARD_CREATURE), new ManaCostsImpl<>("{R}") - )); + this.addAbility(new SimpleActivatedAbility(new PutCardIntoPlayWithHasteAndSacrificeEffect( + StaticFilters.FILTER_CARD_CREATURE, Duration.Custom, "That creature", "the creature" + ), new ManaCostsImpl<>("{R}"))); } private SneakAttack(final SneakAttack card) { @@ -33,4 +34,3 @@ public final class SneakAttack extends CardImpl { return new SneakAttack(this); } } - diff --git a/Mage.Sets/src/mage/cards/t/ThroughTheBreach.java b/Mage.Sets/src/mage/cards/t/ThroughTheBreach.java index 32fa7514f4a..9b141d2c3ae 100644 --- a/Mage.Sets/src/mage/cards/t/ThroughTheBreach.java +++ b/Mage.Sets/src/mage/cards/t/ThroughTheBreach.java @@ -6,6 +6,7 @@ import mage.abilities.keyword.SpliceAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.Duration; import mage.constants.SubType; import mage.filter.StaticFilters; @@ -21,7 +22,9 @@ public final class ThroughTheBreach extends CardImpl { this.subtype.add(SubType.ARCANE); // You may put a creature card from your hand onto the battlefield. That creature gains haste. Sacrifice that creature at the beginning of the next end step. - this.getSpellAbility().addEffect(new PutCardIntoPlayWithHasteAndSacrificeEffect(StaticFilters.FILTER_CARD_CREATURE)); + this.getSpellAbility().addEffect(new PutCardIntoPlayWithHasteAndSacrificeEffect( + StaticFilters.FILTER_CARD_CREATURE, Duration.Custom, "That creature", "that creature" + )); // Splice onto Arcane {2}{R}{R} this.addAbility(new SpliceAbility(SpliceAbility.ARCANE, new ManaCostsImpl<>("{2}{R}{R}"))); diff --git a/Mage/src/main/java/mage/abilities/effects/common/PutCardIntoPlayWithHasteAndSacrificeEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PutCardIntoPlayWithHasteAndSacrificeEffect.java index a07b7e2394e..760200024ab 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PutCardIntoPlayWithHasteAndSacrificeEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PutCardIntoPlayWithHasteAndSacrificeEffect.java @@ -26,17 +26,14 @@ public class PutCardIntoPlayWithHasteAndSacrificeEffect extends OneShotEffect { private final FilterCard filter; private final Duration duration; - public PutCardIntoPlayWithHasteAndSacrificeEffect(FilterCard filter) { - this(filter, Duration.Custom); - } - - public PutCardIntoPlayWithHasteAndSacrificeEffect(FilterCard filter, Duration duration) { - super(Outcome.Benefit); + public PutCardIntoPlayWithHasteAndSacrificeEffect(FilterCard filter, Duration duration, String objectName, String objectName2) { + super(Outcome.PutCreatureInPlay); this.filter = filter; this.duration = duration; this.staticText = "you may put " + CardUtil.addArticle(filter.getMessage()) + - (" from your hand onto the battlefield. It gains haste " + duration).trim() + - ". Sacrifice that " + filter.getMessage() + " at the beginning of the next end step"; + " from your hand onto the battlefield. " + objectName + + " gains haste" + (duration.toString().isEmpty() ? "" : ' ' + duration.toString()) + + ". Sacrifice " + objectName2 + " at the beginning of the next end step"; } private PutCardIntoPlayWithHasteAndSacrificeEffect(final PutCardIntoPlayWithHasteAndSacrificeEffect effect) {