[LTR] Implement Display of Power

This commit is contained in:
theelk801 2023-06-01 21:09:50 -04:00
parent b75d877b9b
commit 970bd300c0
5 changed files with 121 additions and 40 deletions

View file

@ -0,0 +1,74 @@
package mage.cards.d;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CantBeCopiedSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.target.TargetSpell;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class DisplayOfPower extends CardImpl {
public DisplayOfPower(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{R}{R}");
// This spell can't be copied.
this.addAbility(new SimpleStaticAbility(Zone.STACK, new CantBeCopiedSourceEffect()).setRuleAtTheTop(true));
// Copy any number of target instant and/or sorcery spells. You may choose new targets for the copies.
this.getSpellAbility().addEffect(new DisplayOfPowerEffect());
this.getSpellAbility().addTarget(new TargetSpell(
0, Integer.MAX_VALUE,
StaticFilters.FILTER_SPELL_INSTANT_OR_SORCERY
));
}
private DisplayOfPower(final DisplayOfPower card) {
super(card);
}
@Override
public DisplayOfPower copy() {
return new DisplayOfPower(this);
}
}
class DisplayOfPowerEffect extends OneShotEffect {
DisplayOfPowerEffect() {
super(Outcome.Benefit);
staticText = "copy any number of target instant and/or sorcery spells. You may choose new targets for the copies";
}
private DisplayOfPowerEffect(final DisplayOfPowerEffect effect) {
super(effect);
}
@Override
public DisplayOfPowerEffect copy() {
return new DisplayOfPowerEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
for (UUID targetId : getTargetPointer().getTargets(game, source)) {
Spell spell = game.getSpell(targetId);
if (spell != null) {
spell.createCopyOnStack(game, source, source.getControllerId(), true);
}
}
return true;
}
}

View file

@ -1,20 +1,15 @@
package mage.cards.s;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.CardsInOpponentGraveyardCondition;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.CantBeCopiedSourceEffect;
import mage.abilities.effects.common.CopyTargetSpellEffect;
import mage.abilities.effects.common.CreateTokenCopyTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.target.TargetSpell;
import mage.target.common.TargetCreaturePermanent;
@ -29,7 +24,7 @@ public final class SeeDouble extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{U}{U}");
// This spell can't be copied.
this.addAbility(new SimpleStaticAbility(Zone.STACK, new SeeDoubleEffect()).setRuleAtTheTop(true));
this.addAbility(new SimpleStaticAbility(Zone.STACK, new CantBeCopiedSourceEffect()).setRuleAtTheTop(true));
// Choose one. If an opponent has eight or more cards in their graveyard, you may choose both.
this.getSpellAbility().getModes().setChooseText(
@ -56,35 +51,3 @@ public final class SeeDouble extends CardImpl {
return new SeeDouble(this);
}
}
class SeeDoubleEffect extends ReplacementEffectImpl {
SeeDoubleEffect() {
super(Duration.WhileOnStack, Outcome.Benefit);
staticText = "this spell can't be copied";
}
private SeeDoubleEffect(final SeeDoubleEffect effect) {
super(effect);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
return true;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.COPY_STACKOBJECT;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return event.getTargetId().equals(source.getSourceId());
}
@Override
public SeeDoubleEffect copy() {
return new SeeDoubleEffect(this);
}
}

View file

@ -38,7 +38,7 @@ public final class TheBathSong extends CardImpl {
sagaAbility.addChapterEffect(
this, SagaChapter.CHAPTER_III, SagaChapter.CHAPTER_III, new Effects(
new ShuffleIntoLibraryTargetEffect(), new BasicManaEffect(Mana.BlueMana(2))
), new TargetCardInYourGraveyard()
), new TargetCardInYourGraveyard(0, Integer.MAX_VALUE)
);
this.addAbility(sagaAbility);

View file

@ -28,6 +28,7 @@ public final class TheLordOfTheRingsTalesOfMiddleEarth extends ExpansionSet {
cards.add(new SetCardInfo("Call of the Ring", 79, Rarity.RARE, mage.cards.c.CallOfTheRing.class));
cards.add(new SetCardInfo("Cast into the Fire", 118, Rarity.COMMON, mage.cards.c.CastIntoTheFire.class));
cards.add(new SetCardInfo("Council's Deliberation", 48, Rarity.UNCOMMON, mage.cards.c.CouncilsDeliberation.class));
cards.add(new SetCardInfo("Display of Power", 119, Rarity.RARE, mage.cards.d.DisplayOfPower.class));
cards.add(new SetCardInfo("Dunland Crebain", 82, Rarity.COMMON, mage.cards.d.DunlandCrebain.class));
cards.add(new SetCardInfo("Dunedain Blade", 6, Rarity.COMMON, mage.cards.d.DunedainBlade.class));
cards.add(new SetCardInfo("Easterling Vanguard", 83, Rarity.COMMON, mage.cards.e.EasterlingVanguard.class));

View file

@ -0,0 +1,43 @@
package mage.abilities.effects.common;
import mage.abilities.Ability;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.events.GameEvent;
/**
* @author TheElk801
*/
public class CantBeCopiedSourceEffect extends ReplacementEffectImpl {
public CantBeCopiedSourceEffect() {
super(Duration.WhileOnStack, Outcome.Benefit);
staticText = "this spell can't be copied";
}
private CantBeCopiedSourceEffect(final CantBeCopiedSourceEffect effect) {
super(effect);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
return true;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.COPY_STACKOBJECT;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return event.getTargetId().equals(source.getSourceId());
}
@Override
public CantBeCopiedSourceEffect copy() {
return new CantBeCopiedSourceEffect(this);
}
}