Merge pull request #9721 from PurpleCrowbar/raze-to-the-ground

[BRO] Implement Raze to the Ground
This commit is contained in:
Daniel Bomar 2022-11-03 15:17:48 -05:00 committed by GitHub
commit 43878a2a80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 91 additions and 54 deletions

View file

@ -2,16 +2,12 @@
package mage.cards.a;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CantBeCounteredSourceEffect;
import mage.abilities.common.CantBeCounteredSourceAbility;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.constants.Zone;
import mage.filter.common.FilterNonlandPermanent;
import mage.filter.predicate.mageobject.ManaValuePredicate;
import mage.target.common.TargetNonlandPermanent;
@ -31,12 +27,8 @@ public final class AbruptDecay extends CardImpl {
public AbruptDecay(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{B}{G}");
// Abrupt Decay can't be countered.
Effect effect = new CantBeCounteredSourceEffect();
effect.setText("this spell can't be countered");
Ability ability = new SimpleStaticAbility(Zone.STACK, effect);
ability.setRuleAtTheTop(true);
this.addAbility(ability);
// This spell can't be countered.
this.addAbility(new CantBeCounteredSourceAbility().setRuleAtTheTop(true));
// Destroy target nonland permanent with converted mana cost 3 or less.
this.getSpellAbility().addEffect(new DestroyTargetEffect());

View file

@ -2,16 +2,12 @@
package mage.cards.o;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CantBeCounteredSourceEffect;
import mage.abilities.common.CantBeCounteredSourceAbility;
import mage.abilities.effects.common.CounterTargetEffect;
import mage.abilities.keyword.SurgeAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.target.TargetSpell;
/**
@ -23,12 +19,8 @@ public final class OverwhelmingDenial extends CardImpl {
public OverwhelmingDenial(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{U}{U}");
// Overwhelming Denial can't be countered by spell or abilities.
Effect effect = new CantBeCounteredSourceEffect();
effect.setText("this spell can't be countered");
Ability ability = new SimpleStaticAbility(Zone.STACK, effect);
ability.setRuleAtTheTop(true);
this.addAbility(ability);
// This spell can't be countered.
this.addAbility(new CantBeCounteredSourceAbility());
// Counter target spell.
this.getSpellAbility().addTarget(new TargetSpell());

View file

@ -0,0 +1,75 @@
package mage.cards.r;
import mage.abilities.Ability;
import mage.abilities.common.CantBeCounteredSourceAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetArtifactPermanent;
import java.util.UUID;
/**
* @author PurpleCrowbar
*/
public final class RazeToTheGround extends CardImpl {
public RazeToTheGround(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{R}");
// This spell can't be countered.
this.addAbility(new CantBeCounteredSourceAbility().setRuleAtTheTop(true));
// Destroy target artifact. If its mana value was 1 or less, draw a card.
this.getSpellAbility().addEffect(new RazeToTheGroundEffect());
this.getSpellAbility().addTarget(new TargetArtifactPermanent());
}
private RazeToTheGround(final RazeToTheGround card) {
super(card);
}
@Override
public RazeToTheGround copy() {
return new RazeToTheGround(this);
}
}
class RazeToTheGroundEffect extends OneShotEffect {
public RazeToTheGroundEffect() {
super(Outcome.DestroyPermanent);
this.staticText = "Destroy target artifact. If its mana value was 1 or less, draw a card.";
}
private RazeToTheGroundEffect(final RazeToTheGroundEffect effect) {
super(effect);
}
@Override
public RazeToTheGroundEffect copy() {
return new RazeToTheGroundEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent == null) {
return false;
}
int manaValue = permanent.getManaValue();
permanent.destroy(source, game);
if (manaValue <= 1) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
controller.drawCards(1, source, game);
}
}
return true;
}
}

View file

@ -1,15 +1,12 @@
package mage.cards.s;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CantBeCounteredSourceEffect;
import mage.abilities.common.CantBeCounteredSourceAbility;
import mage.abilities.effects.common.ChooseACardNameEffect;
import mage.abilities.effects.common.search.SearchTargetGraveyardHandLibraryForCardNameAndExileEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.game.Game;
import mage.target.common.TargetOpponent;
@ -23,12 +20,8 @@ public final class SlaughterGames extends CardImpl {
public SlaughterGames(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{B}{R}");
// Slaughter Games can't be countered.
Effect effect = new CantBeCounteredSourceEffect();
effect.setText("this spell can't be countered");
Ability ability = new SimpleStaticAbility(Zone.STACK, effect);
ability.setRuleAtTheTop(true);
this.addAbility(ability);
// This spell can't be countered.
this.addAbility(new CantBeCounteredSourceAbility().setRuleAtTheTop(true));
// Name a nonland card. Search target opponent's graveyard, hand, and library for any number of cards with that name and exile them. Then that player shuffles their library.
this.getSpellAbility().addEffect(new ChooseACardNameEffect(ChooseACardNameEffect.TypeOfName.NON_LAND_NAME));

View file

@ -2,16 +2,12 @@
package mage.cards.t;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CantBeCounteredSourceEffect;
import mage.abilities.common.CantBeCounteredSourceAbility;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.target.common.TargetCreaturePermanent;
@ -31,12 +27,8 @@ public final class TearsOfValakut extends CardImpl {
public TearsOfValakut(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{R}");
// Tears of Valakut can't be countered.
Effect effect = new CantBeCounteredSourceEffect();
effect.setText("this spell can't be countered");
Ability ability = new SimpleStaticAbility(Zone.STACK, effect);
ability.setRuleAtTheTop(true);
this.addAbility(ability);
// This spell can't be countered.
this.addAbility(new CantBeCounteredSourceAbility().setRuleAtTheTop(true));
// Tears of Valakut deals 5 damage to target creature with flying.
this.getSpellAbility().addEffect(new DamageTargetEffect(5));

View file

@ -1,17 +1,13 @@
package mage.cards.u;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.CantBeCounteredSourceAbility;
import mage.abilities.condition.common.KickedCondition;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CantBeCounteredSourceEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.keyword.KickerAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.target.common.TargetAnyTarget;
import java.util.UUID;
@ -27,12 +23,8 @@ public final class UrzasRage extends CardImpl {
// Kicker {8}{R}
this.addAbility(new KickerAbility("{8}{R}"));
// Urza's Rage can't be countered.
Effect effect = new CantBeCounteredSourceEffect();
effect.setText("this spell can't be countered");
Ability ability = new SimpleStaticAbility(Zone.STACK, effect);
ability.setRuleAtTheTop(true);
this.addAbility(ability);
// This spell can't be countered.
this.addAbility(new CantBeCounteredSourceAbility().setRuleAtTheTop(true));
// Urza's Rage deals 3 damage to any target. If Urza's Rage was kicked, instead it deals 10 damage to that creature or player and the damage can't be prevented.
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(

View file

@ -116,6 +116,7 @@ public final class TheBrothersWar extends ExpansionSet {
cards.add(new SetCardInfo("Powerstone Engineer", 20, Rarity.COMMON, mage.cards.p.PowerstoneEngineer.class));
cards.add(new SetCardInfo("Powerstone Fracture", 112, Rarity.COMMON, mage.cards.p.PowerstoneFracture.class));
cards.add(new SetCardInfo("Queen Kayla bin-Kroog", 218, Rarity.RARE, mage.cards.q.QueenKaylaBinKroog.class));
cards.add(new SetCardInfo("Raze to the Ground", 149, Rarity.COMMON, mage.cards.r.RazeToTheGround.class));
cards.add(new SetCardInfo("Reconstructed Thopter", 242, Rarity.UNCOMMON, mage.cards.r.ReconstructedThopter.class));
cards.add(new SetCardInfo("Recruitment Officer", 23, Rarity.UNCOMMON, mage.cards.r.RecruitmentOfficer.class));
cards.add(new SetCardInfo("Rust Goliath", 204, Rarity.COMMON, mage.cards.r.RustGoliath.class));