[DMU] Implement Zur, Eternal Schemer (#9406)

This commit is contained in:
PurpleCrowbar 2022-09-05 03:27:51 +01:00 committed by GitHub
parent e5e76f91f4
commit 58364784fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 198 additions and 1 deletions

View file

@ -0,0 +1,128 @@
package mage.cards.z;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.CompoundAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.keyword.DeathtouchAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.HexproofAbility;
import mage.abilities.keyword.LifelinkAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.common.FilterEnchantmentPermanent;
import mage.filter.predicate.Predicates;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import java.util.UUID;
/**
* @author PurpleCrowbar
*/
public final class ZurEternalSchemer extends CardImpl {
private static final FilterCreaturePermanent filter
= new FilterCreaturePermanent("Enchantment creatures");
private static final FilterEnchantmentPermanent filter2
= new FilterEnchantmentPermanent("non-Aura enchantment you control");
static {
filter.add(CardType.ENCHANTMENT.getPredicate());
filter2.add(Predicates.not(SubType.AURA.getPredicate()));
filter2.add(TargetController.YOU.getControllerPredicate());
}
public ZurEternalSchemer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}{U}{B}");
addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(1);
this.toughness = new MageInt(4);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Enchantment creatures you control have deathtouch, lifelink, and hexproof.
CompoundAbility compoundAbilities = new CompoundAbility(DeathtouchAbility.getInstance(), LifelinkAbility.getInstance(), HexproofAbility.getInstance());
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(compoundAbilities, Duration.WhileOnBattlefield, filter)));
// {1}{W}: Target non-Aura enchantment you control becomes a creature in addition to its other types and has base power and toughness each equal to its mana value.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ZurEternalSchemerEffect(), new ManaCostsImpl<>("{1}{W}"));
ability.addTarget(new TargetPermanent(filter2));
this.addAbility(ability);
}
private ZurEternalSchemer(final ZurEternalSchemer card) {
super (card);
}
@Override
public ZurEternalSchemer copy() {
return new ZurEternalSchemer(this);
}
}
class ZurEternalSchemerEffect extends ContinuousEffectImpl {
public ZurEternalSchemerEffect() {
super(Duration.EndOfGame, Outcome.BecomeCreature);
staticText = "Target non-Aura enchantment you control becomes a creature in addition to its other types " +
"and has base power and base toughness each equal to its mana value.";
}
public ZurEternalSchemerEffect(final ZurEternalSchemerEffect effect) {
super(effect);
}
@Override
public ZurEternalSchemerEffect copy() {
return new ZurEternalSchemerEffect(this);
}
@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
Permanent enchantment = game.getPermanent(this.getTargetPointer().getFirst(game, source));
if (enchantment == null) {
return false;
}
switch (layer) {
case TypeChangingEffects_4:
if (sublayer == SubLayer.NA) {
if (!enchantment.isCreature(game)) {
enchantment.addCardType(game, CardType.CREATURE);
}
}
break;
case PTChangingEffects_7:
if (sublayer == SubLayer.SetPT_7b) {
int cmc = enchantment.getManaValue();
enchantment.getPower().setModifiedBaseValue(cmc);
enchantment.getToughness().setModifiedBaseValue(cmc);
}
}
return true;
}
@Override
public boolean apply(Game game, Ability source) {
return false;
}
@Override
public boolean hasLayer(Layer layer) {
return layer == Layer.PTChangingEffects_7
|| layer == Layer.TypeChangingEffects_4;
}
}

View file

@ -269,6 +269,8 @@ public final class DominariaUnited extends ExpansionSet {
cards.add(new SetCardInfo("Yavimaya Steelcrusher", 152, Rarity.COMMON, mage.cards.y.YavimayaSteelcrusher.class)); cards.add(new SetCardInfo("Yavimaya Steelcrusher", 152, Rarity.COMMON, mage.cards.y.YavimayaSteelcrusher.class));
cards.add(new SetCardInfo("Yotia Declares War", 153, Rarity.UNCOMMON, mage.cards.y.YotiaDeclaresWar.class)); cards.add(new SetCardInfo("Yotia Declares War", 153, Rarity.UNCOMMON, mage.cards.y.YotiaDeclaresWar.class));
cards.add(new SetCardInfo("Zar Ojanen, Scion of Efrava", 227, Rarity.UNCOMMON, mage.cards.z.ZarOjanenScionOfEfrava.class)); cards.add(new SetCardInfo("Zar Ojanen, Scion of Efrava", 227, Rarity.UNCOMMON, mage.cards.z.ZarOjanenScionOfEfrava.class));
cards.add(new SetCardInfo("Zur, Eternal Schemer", 228, Rarity.MYTHIC, mage.cards.z.ZurEternalSchemer.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Zur, Eternal Schemer", 327, Rarity.MYTHIC, mage.cards.z.ZurEternalSchemer.class, NON_FULL_USE_VARIOUS));
} }
// @Override // @Override

View file

@ -0,0 +1,67 @@
package org.mage.test.cards.single.uds;
import mage.constants.CardType;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author PurpleCrowbar
*/
public class OpalescenceTest extends CardTestPlayerBase {
/**
* Test that Opalescence is applying its effect
*/
@Test
public void testOpalescenceApplies() {
// 1 CMC 1/2 enchantment creature
addCard(Zone.BATTLEFIELD, playerA, "Dockside Chef", 1);
// 1 CMC non-creature enchantment
addCard(Zone.BATTLEFIELD, playerA, "Alms", 1);
// Each other non-Aura enchantment is a creature in addition to its other types and has base power and base toughness each equal to its mana value.
addCard(Zone.BATTLEFIELD, playerA, "Opalescence", 1);
// 2 CMC non-creature enchantment
addCard(Zone.BATTLEFIELD, playerB, "Amok", 1);
setStopAt(1, PhaseStep.PRECOMBAT_MAIN);
execute();
assertPowerToughness(playerA, "Dockside Chef", 1, 1);
assertType("Alms", CardType.CREATURE, true);
assertPowerToughness(playerA, "Alms", 1, 1);
assertType("Amok", CardType.CREATURE, true);
assertPowerToughness(playerB, "Amok", 2, 2);
}
/**
* Test that Opalescence's effect ends when it leaves the battlefield
*/
@Test
public void testOpalescenceEffectEnds() {
// 1 CMC 1/2 enchantment creature
addCard(Zone.BATTLEFIELD, playerA, "Dockside Chef", 1);
// 1 CMC non-creature enchantment
addCard(Zone.BATTLEFIELD, playerA, "Alms", 1);
// Each other non-Aura enchantment is a creature in addition to its other types and has base power and base toughness each equal to its mana value.
addCard(Zone.HAND, playerA, "Opalescence", 1);
addCard(Zone.HAND, playerA, "Vindicate", 1);
addCard(Zone.BATTLEFIELD, playerA, "Scrubland", 7);
// 2 CMC non-creature enchantment
addCard(Zone.BATTLEFIELD, playerB, "Amok", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Opalescence");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Vindicate", "Opalescence");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertType("Dockside Chef", CardType.CREATURE, true);
assertPowerToughness(playerA, "Dockside Chef", 1, 2);
assertType("Alms", CardType.CREATURE, false);
assertType("Amok", CardType.CREATURE, false);
}
}

View file

@ -1,5 +1,5 @@
package org.mage.test.cards.single.usd; package org.mage.test.cards.single.uds;
import mage.constants.PhaseStep; import mage.constants.PhaseStep;
import mage.constants.Zone; import mage.constants.Zone;