mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 03:51:58 -08:00
implement [EOE] Cryoshatter
This commit is contained in:
parent
7ca32d5bc3
commit
1a7d8ce397
4 changed files with 131 additions and 1 deletions
53
Mage.Sets/src/mage/cards/c/Cryoshatter.java
Normal file
53
Mage.Sets/src/mage/cards/c/Cryoshatter.java
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
|
||||||
|
package mage.cards.c;
|
||||||
|
|
||||||
|
import mage.abilities.common.BecomesTappedAttachedTriggeredAbility;
|
||||||
|
import mage.abilities.common.DealtDamageAttachedTriggeredAbility;
|
||||||
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
import mage.abilities.effects.common.AttachEffect;
|
||||||
|
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||||
|
import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
|
||||||
|
import mage.abilities.keyword.EnchantAbility;
|
||||||
|
import mage.abilities.meta.OrTriggeredAbility;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.*;
|
||||||
|
import mage.target.TargetPermanent;
|
||||||
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Cryoshatter
|
||||||
|
*/
|
||||||
|
public final class Cryoshatter extends CardImpl {
|
||||||
|
|
||||||
|
public Cryoshatter(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{U}");
|
||||||
|
this.subtype.add(SubType.AURA);
|
||||||
|
|
||||||
|
// Enchant creature
|
||||||
|
TargetPermanent auraTarget = new TargetCreaturePermanent();
|
||||||
|
this.getSpellAbility().addTarget(auraTarget);
|
||||||
|
this.getSpellAbility().addEffect(new AttachEffect(Outcome.UnboostCreature));
|
||||||
|
this.addAbility(new EnchantAbility(auraTarget));
|
||||||
|
|
||||||
|
// Enchanted creature gets -5/-0.
|
||||||
|
this.addAbility(new SimpleStaticAbility(new BoostEnchantedEffect(-5, 0)));
|
||||||
|
|
||||||
|
// When enchanted creature becomes tapped or is dealt damage, destroy it.
|
||||||
|
this.addAbility(new OrTriggeredAbility(Zone.BATTLEFIELD, new DestroyTargetEffect().setText("destroy it"), false,
|
||||||
|
"When enchanted creature becomes tapped or is dealt damage, ",
|
||||||
|
new BecomesTappedAttachedTriggeredAbility(null, "enchanted creature", false, SetTargetPointer.PERMANENT),
|
||||||
|
new DealtDamageAttachedTriggeredAbility(Zone.BATTLEFIELD, null, false, SetTargetPointer.PERMANENT)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private Cryoshatter(final Cryoshatter card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Cryoshatter copy() {
|
||||||
|
return new Cryoshatter(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -73,6 +73,7 @@ public final class EdgeOfEternities extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Cosmogrand Zenith", 304, Rarity.MYTHIC, mage.cards.c.CosmograndZenith.class, NON_FULL_USE_VARIOUS));
|
cards.add(new SetCardInfo("Cosmogrand Zenith", 304, Rarity.MYTHIC, mage.cards.c.CosmograndZenith.class, NON_FULL_USE_VARIOUS));
|
||||||
cards.add(new SetCardInfo("Cosmogrand Zenith", 9, Rarity.MYTHIC, mage.cards.c.CosmograndZenith.class, NON_FULL_USE_VARIOUS));
|
cards.add(new SetCardInfo("Cosmogrand Zenith", 9, Rarity.MYTHIC, mage.cards.c.CosmograndZenith.class, NON_FULL_USE_VARIOUS));
|
||||||
cards.add(new SetCardInfo("Cryogen Relic", 52, Rarity.COMMON, mage.cards.c.CryogenRelic.class));
|
cards.add(new SetCardInfo("Cryogen Relic", 52, Rarity.COMMON, mage.cards.c.CryogenRelic.class));
|
||||||
|
cards.add(new SetCardInfo("Cryoshatter", 53, Rarity.COMMON, mage.cards.c.Cryoshatter.class));
|
||||||
cards.add(new SetCardInfo("Cut Propulsion", 130, Rarity.UNCOMMON, mage.cards.c.CutPropulsion.class));
|
cards.add(new SetCardInfo("Cut Propulsion", 130, Rarity.UNCOMMON, mage.cards.c.CutPropulsion.class));
|
||||||
cards.add(new SetCardInfo("Dauntless Scrapbot", 237, Rarity.UNCOMMON, mage.cards.d.DauntlessScrapbot.class));
|
cards.add(new SetCardInfo("Dauntless Scrapbot", 237, Rarity.UNCOMMON, mage.cards.d.DauntlessScrapbot.class));
|
||||||
cards.add(new SetCardInfo("Dawnsire, Sunstar Dreadnought", 238, Rarity.MYTHIC, mage.cards.d.DawnsireSunstarDreadnought.class, NON_FULL_USE_VARIOUS));
|
cards.add(new SetCardInfo("Dawnsire, Sunstar Dreadnought", 238, Rarity.MYTHIC, mage.cards.d.DawnsireSunstarDreadnought.class, NON_FULL_USE_VARIOUS));
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
package org.mage.test.cards.single.eoe;
|
||||||
|
|
||||||
|
import mage.constants.PhaseStep;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Susucr
|
||||||
|
*/
|
||||||
|
public class CryoshatterTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link mage.cards.c.Cryoshatter Cryoshatter} {U}
|
||||||
|
* Enchant creature
|
||||||
|
* Enchanted creature gets -5/-0.
|
||||||
|
* When enchanted creature becomes tapped or is dealt damage, destroy it.
|
||||||
|
*/
|
||||||
|
private static final String shatter = "Cryoshatter";
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_tapped() {
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears");
|
||||||
|
addCard(Zone.HAND, playerA, shatter);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Island", 1);
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, shatter, "Grizzly Bears");
|
||||||
|
attack(1, playerA, "Grizzly Bears", playerB);
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertGraveyardCount(playerA, "Grizzly Bears", 1);
|
||||||
|
assertLife(playerB, 20);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_damage() {
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Centaur Courser");
|
||||||
|
addCard(Zone.HAND, playerA, shatter);
|
||||||
|
addCard(Zone.HAND, playerA, "Shock");
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Volcanic Island", 2);
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, shatter, "Centaur Courser");
|
||||||
|
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN, playerA);
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Shock", "Centaur Courser");
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertGraveyardCount(playerA, "Centaur Courser", 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,29 +1,39 @@
|
||||||
|
|
||||||
package mage.abilities.common;
|
package mage.abilities.common;
|
||||||
|
|
||||||
|
import mage.constants.SetTargetPointer;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author LoneFox
|
* @author LoneFox
|
||||||
*/
|
*/
|
||||||
public class BecomesTappedAttachedTriggeredAbility extends TriggeredAbilityImpl {
|
public class BecomesTappedAttachedTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
|
private final SetTargetPointer setTargetPointer;
|
||||||
|
|
||||||
public BecomesTappedAttachedTriggeredAbility(Effect effect, String description) {
|
public BecomesTappedAttachedTriggeredAbility(Effect effect, String description) {
|
||||||
this(effect, description, false);
|
this(effect, description, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BecomesTappedAttachedTriggeredAbility(Effect effect, String description, boolean isOptional) {
|
public BecomesTappedAttachedTriggeredAbility(Effect effect, String description, boolean isOptional) {
|
||||||
|
this(effect, description, isOptional, SetTargetPointer.NONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BecomesTappedAttachedTriggeredAbility(Effect effect, String description, boolean isOptional, SetTargetPointer setTargetPointer) {
|
||||||
super(Zone.BATTLEFIELD, effect, isOptional);
|
super(Zone.BATTLEFIELD, effect, isOptional);
|
||||||
setTriggerPhrase(getWhen() + description + " becomes tapped, ");
|
setTriggerPhrase(getWhen() + description + " becomes tapped, ");
|
||||||
|
this.setTargetPointer = setTargetPointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BecomesTappedAttachedTriggeredAbility(final BecomesTappedAttachedTriggeredAbility ability) {
|
protected BecomesTappedAttachedTriggeredAbility(final BecomesTappedAttachedTriggeredAbility ability) {
|
||||||
super(ability);
|
super(ability);
|
||||||
|
this.setTargetPointer = ability.setTargetPointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -43,6 +53,17 @@ public class BecomesTappedAttachedTriggeredAbility extends TriggeredAbilityImpl
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Permanent enchanted = game.getPermanent(enchantment.getAttachedTo());
|
Permanent enchanted = game.getPermanent(enchantment.getAttachedTo());
|
||||||
return enchanted != null && event.getTargetId().equals(enchanted.getId());
|
if (enchanted == null || !event.getTargetId().equals(enchanted.getId())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
switch (setTargetPointer) {
|
||||||
|
case PERMANENT:
|
||||||
|
getEffects().setTargetPointer(new FixedTarget(enchanted, game));
|
||||||
|
case NONE:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("Unsupported SetTargetPointer in BecomesTappedAttachedTriggeredAbility");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue