[TDC] Implement Redoubled Stormsinger

This commit is contained in:
theelk801 2025-04-10 08:47:59 -04:00
parent 9e6987ab56
commit f3ffca26fa
3 changed files with 103 additions and 8 deletions

View file

@ -0,0 +1,101 @@
package mage.cards.r;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenCopyTargetEffect;
import mage.abilities.effects.common.SacrificeTargetEffect;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.permanent.EnteredThisTurnPredicate;
import mage.filter.predicate.permanent.TokenPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTargets;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class RedoubledStormsinger extends CardImpl {
public RedoubledStormsinger(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}");
this.subtype.add(SubType.ORC);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// First strike
this.addAbility(FirstStrikeAbility.getInstance());
// Whenever this creature attacks, for each creature token you control that entered this turn, create a tapped and attacking token that's a copy of that token. At the beginning of the next end step, sacrifice those tokens.
this.addAbility(new AttacksTriggeredAbility(new RedoubledStormsingerEffect()));
}
private RedoubledStormsinger(final RedoubledStormsinger card) {
super(card);
}
@Override
public RedoubledStormsinger copy() {
return new RedoubledStormsinger(this);
}
}
class RedoubledStormsingerEffect extends OneShotEffect {
private static final FilterPermanent filter = new FilterControlledCreaturePermanent();
static {
filter.add(TokenPredicate.TRUE);
filter.add(EnteredThisTurnPredicate.instance);
}
RedoubledStormsingerEffect() {
super(Outcome.Benefit);
staticText = "for each creature token you control that entered this turn, " +
"create a tapped and attacking token that's a copy of that token. " +
"At the beginning of the next end step, sacrifice those tokens";
}
private RedoubledStormsingerEffect(final RedoubledStormsingerEffect effect) {
super(effect);
}
@Override
public RedoubledStormsingerEffect copy() {
return new RedoubledStormsingerEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Set<Permanent> addedTokens = new HashSet<>();
for (Permanent permanent : game.getBattlefield().getActivePermanents(
filter, source.getControllerId(), source, game
)) {
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(
null, null, false,
1, true, true
).setSavedPermanent(permanent);
effect.apply(game, source);
addedTokens.addAll(effect.getAddedPermanents());
}
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(
new SacrificeTargetEffect().setTargetPointer(new FixedTargets(addedTokens, game))
), source);
return true;
}
}

View file

@ -241,6 +241,7 @@ public final class TarkirDragonstormCommander extends ExpansionSet {
cards.add(new SetCardInfo("Rapid Hybridization", 162, Rarity.UNCOMMON, mage.cards.r.RapidHybridization.class));
cards.add(new SetCardInfo("Reality Shift", 163, Rarity.UNCOMMON, mage.cards.r.RealityShift.class));
cards.add(new SetCardInfo("Reassembling Skeleton", 195, Rarity.UNCOMMON, mage.cards.r.ReassemblingSkeleton.class));
cards.add(new SetCardInfo("Redoubled Stormsinger", 37, Rarity.RARE, mage.cards.r.RedoubledStormsinger.class));
cards.add(new SetCardInfo("Reflections of Littjara", 164, Rarity.RARE, mage.cards.r.ReflectionsOfLittjara.class));
cards.add(new SetCardInfo("Release the Dogs", 127, Rarity.UNCOMMON, mage.cards.r.ReleaseTheDogs.class));
cards.add(new SetCardInfo("Reliquary Tower", 386, Rarity.UNCOMMON, mage.cards.r.ReliquaryTower.class));

View file

@ -22,14 +22,7 @@ public class FixedTargets extends TargetPointerImpl {
final ArrayList<MageObjectReference> targets = new ArrayList<>();
public FixedTargets(List<Permanent> objects, Game game) {
this(objects
.stream()
.map(o -> new MageObjectReference(o.getId(), game))
.collect(Collectors.toList()));
}
public FixedTargets(Set<Card> objects, Game game) {
public FixedTargets(Collection<? extends Card> objects, Game game) {
this(objects
.stream()
.map(o -> new MageObjectReference(o.getId(), game))