[BRO] Implement Raze to the Ground

This commit is contained in:
PurpleCrowbar 2022-11-02 02:15:33 +00:00
parent 62cc780601
commit a4b4965779
2 changed files with 83 additions and 0 deletions

View file

@ -0,0 +1,82 @@
package mage.cards.r;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CantBeCounteredSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
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.
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);
// 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

@ -87,6 +87,7 @@ public final class TheBrothersWar extends ExpansionSet {
cards.add(new SetCardInfo("Plains", 278, Rarity.LAND, mage.cards.basiclands.Plains.class, FULL_ART_BFZ_VARIOUS));
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));