Gleeful demolition (#9896)

* Gleeful Demolition

* Gleeful Demolition

* Gleeful Demolition

* Gleeful Demolition

* Gleeful Demolition

* Gleeful Demolition

* Gleeful Demolition

* Gleeful Demolition

* Gleeful Demolition

* Gleeful Demolition

* Gleeful Demolition

* Changed DestroyEffect to OneShotEffect
added super constructor

* Removed super constructor and added permanent.destroy

* Removed super constructor and added permanent.destroy

* testing removal of DestroyTargetEffect

* removed redundant DestroyTargetEffect and cleaned up imports. card works as intended.

Co-authored-by: AhmadYProjects <yousufa@kean.edu>
Co-authored-by: Evan Kranzler <theelk801@gmail.com>
This commit is contained in:
AhmadYProjects 2023-01-22 10:06:32 -05:00 committed by GitHub
parent 14a93dccb7
commit d26f0f8754
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 81 additions and 0 deletions

View file

@ -0,0 +1,80 @@
package mage.cards.g;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.PhyrexianGoblinToken;
import mage.game.permanent.token.Token;
import mage.players.Player;
import mage.target.TargetPermanent;
import java.util.UUID;
/**
*
* @author AhmadYProjects
*/
public final class GleefulDemolition extends CardImpl {
public GleefulDemolition(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{R}");
// Destroy target artifact. If you controlled that artifact, creature three 1/1 red Phyrexian Goblin creature tokens.
this.getSpellAbility().addTarget(new TargetPermanent(StaticFilters.FILTER_PERMANENT_ARTIFACT));
this.getSpellAbility().addEffect(new GleefulDemolitionEffect());
}
private GleefulDemolition(final GleefulDemolition card) {
super(card);
}
@Override
public GleefulDemolition copy() {
return new GleefulDemolition(this);
}
}
class GleefulDemolitionEffect extends OneShotEffect {
GleefulDemolitionEffect(){
super(Outcome.Benefit);
staticText = "destroy target artifact. " +
"if you controlled that artifact, create three 1/1 red Phyrexian Goblin creature tokens";
}
private GleefulDemolitionEffect(final GleefulDemolitionEffect effect) {
super(effect);
}
@Override
public GleefulDemolitionEffect copy(){
return new GleefulDemolitionEffect(this);
}
@Override
public boolean apply(Game game, Ability source){
Player player = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(targetPointer.getFirst(game,source));
if (
permanent == null || player == null) {
return false;
}
boolean isMine = permanent.isControlledBy(source.getControllerId());
permanent.destroy(source, game, false);
if (isMine) {
Token token = new PhyrexianGoblinToken();
token.putOntoBattlefield(3,game,source);
}
return true;
}
}

View file

@ -47,6 +47,7 @@ public final class PhyrexiaAllWillBeOne extends ExpansionSet {
cards.add(new SetCardInfo("Ezuri, Stalker of Spheres", 201, Rarity.RARE, mage.cards.e.EzuriStalkerOfSpheres.class));
cards.add(new SetCardInfo("Feed the Infection", 93, Rarity.UNCOMMON, mage.cards.f.FeedTheInfection.class));
cards.add(new SetCardInfo("Forest", 276, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Gleeful Demolition", 134, Rarity.UNCOMMON, mage.cards.g.GleefulDemolition.class));
cards.add(new SetCardInfo("Hexgold Slash", 137, Rarity.COMMON, mage.cards.h.HexgoldSlash.class));
cards.add(new SetCardInfo("Furnace Skullbomb", 228, Rarity.COMMON, mage.cards.f.FurnaceSkullbomb.class));
cards.add(new SetCardInfo("Goliath Hatchery", 408, Rarity.RARE, mage.cards.g.GoliathHatchery.class));