From 33a3aab75f099aaefb5dd3e5e4792b94e24fe54f Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sun, 17 Apr 2022 20:42:47 -0400 Subject: [PATCH] [SNC] Implemented Sizzling Soloist --- .../src/mage/cards/s/SizzlingSoloist.java | 90 +++++++++++++++++++ .../src/mage/sets/StreetsOfNewCapenna.java | 1 + .../IfAbilityHasResolvedXTimesEffect.java | 14 ++- 3 files changed, 102 insertions(+), 3 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/s/SizzlingSoloist.java diff --git a/Mage.Sets/src/mage/cards/s/SizzlingSoloist.java b/Mage.Sets/src/mage/cards/s/SizzlingSoloist.java new file mode 100644 index 0000000000..806846152e --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SizzlingSoloist.java @@ -0,0 +1,90 @@ +package mage.cards.s; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.AllianceAbility; +import mage.abilities.effects.RequirementEffect; +import mage.abilities.effects.common.IfAbilityHasResolvedXTimesEffect; +import mage.abilities.effects.common.combat.CantBlockTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetOpponentsCreaturePermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class SizzlingSoloist extends CardImpl { + + public SizzlingSoloist(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.CITIZEN); + this.power = new MageInt(3); + this.toughness = new MageInt(2); + + // Alliance — Whenever another creature enters the battlefield under your control, target creature an opponent controls can't block this turn. If this is the second time this ability has resolved this turn, that creature attacks during its controller's next combat phase if able. + Ability ability = new AllianceAbility(new CantBlockTargetEffect(Duration.EndOfTurn)); + ability.addEffect(new IfAbilityHasResolvedXTimesEffect( + Outcome.Benefit, 2, new SizzlingSoloistEffect() + )); + ability.addTarget(new TargetOpponentsCreaturePermanent()); + this.addAbility(ability); + } + + private SizzlingSoloist(final SizzlingSoloist card) { + super(card); + } + + @Override + public SizzlingSoloist copy() { + return new SizzlingSoloist(this); + } +} + +class SizzlingSoloistEffect extends RequirementEffect { + + public SizzlingSoloistEffect() { + super(Duration.Custom); + staticText = "that creature attacks during its controller's next combat phase if able"; + } + + public SizzlingSoloistEffect(final SizzlingSoloistEffect effect) { + super(effect); + } + + @Override + public SizzlingSoloistEffect copy() { + return new SizzlingSoloistEffect(this); + } + + @Override + public boolean applies(Permanent permanent, Ability source, Game game) { + return getTargetPointer().getFirst(game, source).equals(permanent.getId()); + } + + @Override + public boolean isInactive(Ability source, Game game) { + if (game.getPermanent(getTargetPointer().getFirst(game, source)) == null) { + return true; + } + return game.isActivePlayer(game.getControllerId(getTargetPointer().getFirst(game, source))) + && game.getPhase().getType() == TurnPhase.COMBAT + && game.getStep().getType() == PhaseStep.END_COMBAT; + } + + @Override + public boolean mustAttack(Game game) { + return true; + } + + @Override + public boolean mustBlock(Game game) { + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java b/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java index 29a244fb10..a9a7ba86da 100644 --- a/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java +++ b/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java @@ -214,6 +214,7 @@ public final class StreetsOfNewCapenna extends ExpansionSet { cards.add(new SetCardInfo("Sewer Crocodile", 60, Rarity.COMMON, mage.cards.s.SewerCrocodile.class)); cards.add(new SetCardInfo("Shadow of Mortality", 94, Rarity.RARE, mage.cards.s.ShadowOfMortality.class)); cards.add(new SetCardInfo("Shakedown Heavy", 95, Rarity.RARE, mage.cards.s.ShakedownHeavy.class)); + cards.add(new SetCardInfo("Sizzling Soloist", 123, Rarity.UNCOMMON, mage.cards.s.SizzlingSoloist.class)); cards.add(new SetCardInfo("Sky Crier", 31, Rarity.COMMON, mage.cards.s.SkyCrier.class)); cards.add(new SetCardInfo("Skybridge Towers", 256, Rarity.COMMON, mage.cards.s.SkybridgeTowers.class)); cards.add(new SetCardInfo("Sleep with the Fishes", 61, Rarity.UNCOMMON, mage.cards.s.SleepWithTheFishes.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/IfAbilityHasResolvedXTimesEffect.java b/Mage/src/main/java/mage/abilities/effects/common/IfAbilityHasResolvedXTimesEffect.java index b4dca380e0..cab6eee4c4 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/IfAbilityHasResolvedXTimesEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/IfAbilityHasResolvedXTimesEffect.java @@ -1,6 +1,7 @@ package mage.abilities.effects.common; import mage.abilities.Ability; +import mage.abilities.Mode; import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; @@ -21,8 +22,6 @@ public class IfAbilityHasResolvedXTimesEffect extends OneShotEffect { super(outcome); this.resolutionNumber = resolutionNumber; this.effect = effect; - this.staticText = "If this is the " + CardUtil.numberToOrdinalText(resolutionNumber) + " time this ability has resolved this turn, " + - effect.getText(null); } private IfAbilityHasResolvedXTimesEffect(final IfAbilityHasResolvedXTimesEffect effect) { @@ -39,7 +38,7 @@ public class IfAbilityHasResolvedXTimesEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { if (AbilityResolvedWatcher.getResolutionCount(game, source) != resolutionNumber) { - return true; + return false; } if (effect instanceof OneShotEffect) { return effect.apply(game, source); @@ -47,4 +46,13 @@ public class IfAbilityHasResolvedXTimesEffect extends OneShotEffect { game.addEffect((ContinuousEffect) effect, source); return true; } + + @Override + public String getText(Mode mode) { + if (staticText != null && !staticText.isEmpty()) { + return staticText; + } + return "If this is the " + CardUtil.numberToOrdinalText(resolutionNumber) + + " time this ability has resolved this turn, " + effect.getText(mode); + } }