mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
implement [EOE] Depressurize
This commit is contained in:
parent
a343f4a6a6
commit
bf7b232861
3 changed files with 118 additions and 0 deletions
67
Mage.Sets/src/mage/cards/d/Depressurize.java
Normal file
67
Mage.Sets/src/mage/cards/d/Depressurize.java
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
package mage.cards.d;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author Susucr
|
||||
*/
|
||||
public final class Depressurize extends CardImpl {
|
||||
|
||||
public Depressurize(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{B}");
|
||||
|
||||
// Target creature gets -3/-0 until end of turn. Then if that creature's power is 0 or less, destroy it.
|
||||
this.getSpellAbility().addEffect(new BoostTargetEffect(-3, 0, Duration.EndOfTurn));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
this.getSpellAbility().addEffect(new DepressurizeTargetEffect());
|
||||
}
|
||||
|
||||
private Depressurize(final Depressurize card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Depressurize copy() {
|
||||
return new Depressurize(this);
|
||||
}
|
||||
}
|
||||
|
||||
class DepressurizeTargetEffect extends OneShotEffect {
|
||||
|
||||
DepressurizeTargetEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "Then if that creature's power is 0 or less, destroy it";
|
||||
}
|
||||
|
||||
private DepressurizeTargetEffect(final DepressurizeTargetEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DepressurizeTargetEffect copy() {
|
||||
return new DepressurizeTargetEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (permanent == null || permanent.getPower().getValue() > 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
permanent.destroy(source, game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -88,6 +88,7 @@ public final class EdgeOfEternities extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Dawnstrike Vanguard", 10, Rarity.UNCOMMON, mage.cards.d.DawnstrikeVanguard.class));
|
||||
cards.add(new SetCardInfo("Debris Field Crusher", 131, Rarity.UNCOMMON, mage.cards.d.DebrisFieldCrusher.class));
|
||||
cards.add(new SetCardInfo("Decode Transmissions", 94, Rarity.COMMON, mage.cards.d.DecodeTransmissions.class));
|
||||
cards.add(new SetCardInfo("Depressurize", 95, Rarity.COMMON, mage.cards.d.Depressurize.class));
|
||||
cards.add(new SetCardInfo("Desculpting Blast", 54, Rarity.UNCOMMON, mage.cards.d.DesculptingBlast.class));
|
||||
cards.add(new SetCardInfo("Devastating Onslaught", 132, Rarity.MYTHIC, mage.cards.d.DevastatingOnslaught.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Devastating Onslaught", 308, Rarity.MYTHIC, mage.cards.d.DevastatingOnslaught.class, NON_FULL_USE_VARIOUS));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,50 @@
|
|||
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 DepressurizeTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* {@link mage.cards.d.Depressurize Depressurize} {1}{B}
|
||||
* Instant
|
||||
* Target creature gets -3/-0 until end of turn. Then if that creature’s power is 0 or less, destroy it.
|
||||
*/
|
||||
private static final String depressurize = "Depressurize";
|
||||
|
||||
@Test
|
||||
public void test_Destroy() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Centaur Courser");
|
||||
addCard(Zone.HAND, playerA, depressurize, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, depressurize, "Centaur Courser");
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
setStrictChooseMode(true);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerA, "Centaur Courser", 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_NoDestroy() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Alpine Grizzly");
|
||||
addCard(Zone.HAND, playerA, depressurize, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, depressurize, "Alpine Grizzly");
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
setStrictChooseMode(true);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Alpine Grizzly", 1);
|
||||
assertPowerToughness(playerA, "Alpine Grizzly", 4 - 3, 2);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue