fixes on new cards

This commit is contained in:
Susucre 2024-06-06 11:12:29 +02:00
parent 98f910a892
commit 425858e413
11 changed files with 93 additions and 65 deletions

View file

@ -51,7 +51,7 @@ public final class AmpedRaptor extends CardImpl {
ability.addEffect(new ConditionalOneShotEffect( ability.addEffect(new ConditionalOneShotEffect(
new AmpedRaptorEffect(), new AmpedRaptorEffect(),
CastFromHandSourcePermanentCondition.instance CastFromHandSourcePermanentCondition.instance
)); ).concatBy("Then"));
this.addAbility(ability, new CastFromHandWatcher()); this.addAbility(ability, new CastFromHandWatcher());
} }

View file

@ -44,10 +44,11 @@ public final class AshlingFlameDancer extends CardImpl {
Outcome.Damage, 2, Outcome.Damage, 2,
new DamagePlayersEffect(2, TargetController.OPPONENT), new DamagePlayersEffect(2, TargetController.OPPONENT),
new DamageAllEffect(2, StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE) new DamageAllEffect(2, StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE)
.setText("and each creature they control")
)); ));
ability.addEffect(new IfAbilityHasResolvedXTimesEffect( ability.addEffect(new IfAbilityHasResolvedXTimesEffect(
3, new BasicManaEffect(Mana.RedMana(4)) 3, new BasicManaEffect(Mana.RedMana(4))
)); ).setText("If it's the third time, add {R}{R}{R}{R}"));
this.addAbility(ability, new AbilityResolvedWatcher()); this.addAbility(ability, new AbilityResolvedWatcher());
} }

View file

@ -3,6 +3,8 @@ package mage.cards.i;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CounterTargetEffect; import mage.abilities.effects.common.CounterTargetEffect;
import mage.abilities.effects.common.FlipCoinEffect;
import mage.abilities.effects.common.InfoEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
@ -24,7 +26,12 @@ public final class InvertPolarity extends CardImpl {
// Choose target spell, then flip a coin. If you win the flip, gain control of that spell and you may choose new targets for it. If you lose the flip, counter that spell. // Choose target spell, then flip a coin. If you win the flip, gain control of that spell and you may choose new targets for it. If you lose the flip, counter that spell.
this.getSpellAbility().addTarget(new TargetSpell()); this.getSpellAbility().addTarget(new TargetSpell());
this.getSpellAbility().addEffect(new InvertPolarityTargetEffect()); this.getSpellAbility().addEffect(new InfoEffect("Choose target spell"));
this.getSpellAbility().addEffect(new FlipCoinEffect(
new InvertPolarityGainControlTargetEffect(),
new CounterTargetEffect().setText("counter that spell"),
Outcome.Detriment
).concatBy(", then"));
} }
private InvertPolarity(final InvertPolarity card) { private InvertPolarity(final InvertPolarity card) {
@ -37,46 +44,11 @@ public final class InvertPolarity extends CardImpl {
} }
} }
class InvertPolarityTargetEffect extends OneShotEffect {
InvertPolarityTargetEffect() {
super(Outcome.Detriment);
staticText = "choose target spell, then flip a coin. If you win the flip, gain control of that spell "
+ "and you may choose new targets for it. If you lose the flip, counter that spell";
}
private InvertPolarityTargetEffect(final InvertPolarityTargetEffect effect) {
super(effect);
}
@Override
public InvertPolarityTargetEffect copy() {
return new InvertPolarityTargetEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
if (player.flipCoin(source, game, true)) {
new InvertPolarityGainControlTargetEffect()
.setTargetPointer(getTargetPointer().copy())
.apply(game, source);
} else {
new CounterTargetEffect()
.setTargetPointer(getTargetPointer().copy())
.apply(game, source);
}
return true;
}
}
class InvertPolarityGainControlTargetEffect extends OneShotEffect { class InvertPolarityGainControlTargetEffect extends OneShotEffect {
InvertPolarityGainControlTargetEffect() { InvertPolarityGainControlTargetEffect() {
super(Outcome.GainControl); super(Outcome.GainControl);
staticText = "gain control of that spell and you may choose new targets for it";
} }
private InvertPolarityGainControlTargetEffect(final InvertPolarityGainControlTargetEffect effect) { private InvertPolarityGainControlTargetEffect(final InvertPolarityGainControlTargetEffect effect) {

View file

@ -1,7 +1,5 @@
package mage.cards.l; package mage.cards.l;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.costs.Cost; import mage.abilities.costs.Cost;
import mage.abilities.costs.common.PayEnergyCost; import mage.abilities.costs.common.PayEnergyCost;
@ -23,14 +21,15 @@ import mage.filter.predicate.mageobject.PowerPredicate;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import java.util.UUID;
/** /**
*
* @author grimreap124 * @author grimreap124
*/ */
public final class LocalizedDestruction extends CardImpl { public final class LocalizedDestruction extends CardImpl {
public LocalizedDestruction(UUID ownerId, CardSetInfo setInfo) { public LocalizedDestruction(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[] { CardType.SORCERY }, "{3}{W}{W}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{W}{W}");
// You get {E}, then you may pay one or more {E}. If you do, each creature you control with power equal to the amount of paid this way gains indestructible until end of turn. // You get {E}, then you may pay one or more {E}. If you do, each creature you control with power equal to the amount of paid this way gains indestructible until end of turn.
@ -58,7 +57,7 @@ class LocalizedDestructionEffect extends OneShotEffect {
LocalizedDestructionEffect() { LocalizedDestructionEffect() {
super(Outcome.AddAbility); super(Outcome.AddAbility);
this.staticText = ", then you may pay one or more {E}. If you do, each creature you control with power equal to the amount of paid this way gains indestructible until end of turn"; this.staticText = ", then you may pay one or more {E}. If you do, each creature you control with power equal to the amount of {E} paid this way gains indestructible until end of turn";
} }
private LocalizedDestructionEffect(final LocalizedDestructionEffect effect) { private LocalizedDestructionEffect(final LocalizedDestructionEffect effect) {

View file

@ -16,6 +16,8 @@ import mage.constants.*;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent; import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentToken;
import mage.players.Player; import mage.players.Player;
import java.util.UUID; import java.util.UUID;
@ -130,6 +132,13 @@ class NecrodominanceReplacementEffect extends ReplacementEffectImpl {
return false; return false;
} }
Card card = game.getCard(event.getTargetId()); Card card = game.getCard(event.getTargetId());
return card != null && card.isOwnedBy(source.getControllerId()); if (card != null && card.isOwnedBy(source.getControllerId())) {
return true;
}
Permanent token = game.getPermanent(event.getTargetId());
if (token != null && token instanceof PermanentToken && token.isOwnedBy(source.getControllerId())) {
return true;
}
return false;
} }
} }

View file

@ -43,7 +43,7 @@ public final class PearlEarImperialAdvisor extends CardImpl {
); );
private static final FilterPermanent filterModified = new FilterControlledPermanent(); private static final FilterPermanent filterModified = new FilterControlledPermanent();
private static final FilterSpell filterAura = new FilterSpell("Aura spell that targets a modified permanent you control"); private static final FilterSpell filterAura = new FilterSpell("an Aura spell that targets a modified permanent you control");
static { static {
filterModified.add(ModifiedPredicate.instance); filterModified.add(ModifiedPredicate.instance);

View file

@ -1,9 +1,5 @@
package mage.cards.t; package mage.cards.t;
import java.util.UUID;
import mage.constants.SubType;
import mage.game.permanent.token.TarmogoyfToken;
import mage.target.common.TargetLandPermanent;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
@ -13,22 +9,23 @@ import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
import mage.constants.Outcome;
import mage.target.TargetPermanent;
import mage.abilities.keyword.EnchantAbility; import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.AttachmentType; import mage.constants.*;
import mage.constants.CardType; import mage.game.permanent.token.TarmogoyfToken;
import mage.target.TargetPermanent;
import mage.target.common.TargetLandPermanent;
import java.util.UUID;
/** /**
*
* @author grimreap124 * @author grimreap124
*/ */
public final class TarmogoyfNest extends CardImpl { public final class TarmogoyfNest extends CardImpl {
public TarmogoyfNest(UUID ownerId, CardSetInfo setInfo) { public TarmogoyfNest(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[] { CardType.TRIBAL, CardType.ENCHANTMENT }, "{2}{G}"); super(ownerId, setInfo, new CardType[]{CardType.TRIBAL, CardType.ENCHANTMENT}, "{2}{G}");
this.subtype.add(SubType.LHURGOYF); this.subtype.add(SubType.LHURGOYF);
this.subtype.add(SubType.AURA); this.subtype.add(SubType.AURA);
@ -43,7 +40,7 @@ public final class TarmogoyfNest extends CardImpl {
Ability gainedAbility = new SimpleActivatedAbility(new CreateTokenEffect(new TarmogoyfToken()), Ability gainedAbility = new SimpleActivatedAbility(new CreateTokenEffect(new TarmogoyfToken()),
new TapSourceCost()); new TapSourceCost());
gainedAbility.addCost(new ManaCostsImpl<>("{1}{G}")); gainedAbility.addCost(new ManaCostsImpl<>("{1}{G}"));
Effect effect = new GainAbilityAttachedEffect(gainedAbility, AttachmentType.AURA); Effect effect = new GainAbilityAttachedEffect(gainedAbility, AttachmentType.AURA, Duration.WhileOnBattlefield, null, "land");
this.addAbility(new SimpleStaticAbility(effect)); this.addAbility(new SimpleStaticAbility(effect));
} }

View file

@ -91,7 +91,7 @@ class WheelOfPotentialEffect extends OneShotEffect {
player.drawCards(numberPaid, source, game); player.drawCards(numberPaid, source, game);
} }
if (numberPaid >= 7) { if (numberPaid >= 7) {
game.getState().applyEffects(game); game.getState().processAction(game);
cardsExiled.removeIf(cardId -> { cardsExiled.removeIf(cardId -> {
Card card = game.getCard(cardId); Card card = game.getCard(cardId);
return card == null || !card.getOwnerId().equals(controller.getId()); return card == null || !card.getOwnerId().equals(controller.getId());

View file

@ -0,0 +1,51 @@
package org.mage.test.cards.single.mh3;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author Susucr
*/
public class NecrodominanceTest extends CardTestPlayerBase {
/**
* {@link mage.cards.n.Necrodominance Necrodominance} {B}{B}{B}
* Legendary Enchantment
* Skip your draw step.
* At the beginning of your end step, you may pay any amount of life. If you do, draw that many cards.
* Your maximum hand size is five.
* If a card or token would be put into your graveyard from anywhere, exile it instead.
*/
private static final String necro = "Necrodominance";
@Test
public void test_ReplacementEffect() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, necro);
// Whenever a creature you control dies, each opponent loses 1 life.
// Whenever a creature an opponent controls dies, you gain 1 life.
addCard(Zone.BATTLEFIELD, playerA, "The Meathook Massacre");
addCard(Zone.BATTLEFIELD, playerB, "Grizzly Bears", 1);
addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears", 2);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 8);
addCard(Zone.HAND, playerA, "Gisa's Bidding"); // Create 2 2/2 black zombie creature tokens
addCard(Zone.HAND, playerA, "Damnation");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Gisa's Bidding", true);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Damnation");
// A single trigger from playerB's Bears
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 20 + 1);
assertLife(playerB, 20);
assertPermanentCount(playerA, 10); // 8 lands, 2 enchantments
assertGraveyardCount(playerA, 0);
assertGraveyardCount(playerB, 1);
assertExileCount(playerA, 4);
}
}

View file

@ -160,7 +160,6 @@ public class VerifyCardDataTest {
// rarity // rarity
// skipListAddName(SKIP_LIST_RARITY, set, cardName); // skipListAddName(SKIP_LIST_RARITY, set, cardName);
skipListAddName(SKIP_LIST_RARITY, "CMR", "The Prismatic Piper"); // Collation is not yet set up for CMR https://www.lethe.xyz/mtg/collation/cmr.html skipListAddName(SKIP_LIST_RARITY, "CMR", "The Prismatic Piper"); // Collation is not yet set up for CMR https://www.lethe.xyz/mtg/collation/cmr.html
skipListAddName(SKIP_LIST_RARITY, "SPG", "Thought-Knot Seer"); // temporary
// missing abilities // missing abilities
// skipListAddName(SKIP_LIST_MISSING_ABILITIES, set, cardName); // skipListAddName(SKIP_LIST_MISSING_ABILITIES, set, cardName);

View file

@ -23,10 +23,10 @@ public class IfAbilityHasResolvedXTimesEffect extends OneShotEffect {
this(effect.getOutcome(), resolutionNumber, effect); this(effect.getOutcome(), resolutionNumber, effect);
} }
public IfAbilityHasResolvedXTimesEffect(Outcome outcome, int resolutionNumber, Effect... effect) { public IfAbilityHasResolvedXTimesEffect(Outcome outcome, int resolutionNumber, Effect... effects) {
super(outcome); super(outcome);
this.resolutionNumber = resolutionNumber; this.resolutionNumber = resolutionNumber;
this.effects = new Effects(effect); this.effects = new Effects(effects);
} }
private IfAbilityHasResolvedXTimesEffect(final IfAbilityHasResolvedXTimesEffect effect) { private IfAbilityHasResolvedXTimesEffect(final IfAbilityHasResolvedXTimesEffect effect) {