[DSC] Implement Convert to Slime

This commit is contained in:
theelk801 2024-09-13 10:52:30 -04:00
parent 184354c425
commit 9b308adf02
3 changed files with 87 additions and 2 deletions

View file

@ -0,0 +1,84 @@
package mage.cards.c;
import mage.abilities.Ability;
import mage.abilities.condition.common.DeliriumCondition;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.hint.common.CardTypesInGraveyardHint;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AbilityWord;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.OozeToken;
import mage.target.common.TargetArtifactPermanent;
import mage.target.common.TargetCreaturePermanent;
import mage.target.common.TargetEnchantmentPermanent;
import mage.target.targetpointer.EachTargetPointer;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class ConvertToSlime extends CardImpl {
public ConvertToSlime(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{B}{G}");
// Destroy up to one target artifact, up to one target creature, and up to one target enchantment.
// Delirium -- Then if there are four or more card types among cards in your graveyard, create an X/X green Ooze creature token, where X is the total mana value of permanents destroyed this way.
this.getSpellAbility().addEffect(new ConvertToSlimeEffect());
this.getSpellAbility().addTarget(new TargetArtifactPermanent(0, 1));
this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, 1));
this.getSpellAbility().addTarget(new TargetEnchantmentPermanent(0, 1));
this.getSpellAbility().addHint(CardTypesInGraveyardHint.YOU);
}
private ConvertToSlime(final ConvertToSlime card) {
super(card);
}
@Override
public ConvertToSlime copy() {
return new ConvertToSlime(this);
}
}
class ConvertToSlimeEffect extends OneShotEffect {
ConvertToSlimeEffect() {
super(Outcome.Benefit);
staticText = "destroy up to one target artifact, up to one target creature, " +
"and up to one target enchantment.<br>" + AbilityWord.DELIRIUM.formatWord() +
"Then if there are four or more card types among cards in your graveyard, create an X/X green " +
"Ooze creature token, where X is the total mana value of permanents destroyed this way.";
this.setTargetPointer(new EachTargetPointer());
}
private ConvertToSlimeEffect(final ConvertToSlimeEffect effect) {
super(effect);
}
@Override
public ConvertToSlimeEffect copy() {
return new ConvertToSlimeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
int total = 0;
for (UUID targetId : getTargetPointer().getTargets(game, source)) {
Permanent permanent = game.getPermanent(targetId);
if (permanent != null && permanent.destroy(source, game)) {
total += permanent.getManaValue();
}
}
game.processAction();
if (DeliriumCondition.instance.apply(game, source)) {
new OozeToken(total, total).putOntoBattlefield(1, game, source);
}
return true;
}
}

View file

@ -55,6 +55,7 @@ public final class DuskmournHouseOfHorrorCommander extends ExpansionSet {
cards.add(new SetCardInfo("Citanul Hierophants", 81, Rarity.RARE, mage.cards.c.CitanulHierophants.class));
cards.add(new SetCardInfo("Command Tower", 96, Rarity.COMMON, mage.cards.c.CommandTower.class));
cards.add(new SetCardInfo("Commander's Sphere", 244, Rarity.COMMON, mage.cards.c.CommandersSphere.class));
cards.add(new SetCardInfo("Convert to Slime", 37, Rarity.RARE, mage.cards.c.ConvertToSlime.class));
cards.add(new SetCardInfo("Counterspell", 114, Rarity.COMMON, mage.cards.c.Counterspell.class));
cards.add(new SetCardInfo("Crypt Ghast", 368, Rarity.MYTHIC, mage.cards.c.CryptGhast.class));
cards.add(new SetCardInfo("Cultivate", 174, Rarity.COMMON, mage.cards.c.Cultivate.class));

View file

@ -7,7 +7,7 @@ import mage.constants.SubType;
public final class OozeToken extends TokenImpl {
public OozeToken(int power, int toughness) {
super("Ooze Token", power + "/" + toughness + " green ooze creature token");
super("Ooze Token", power + "/" + toughness + " green Ooze creature token");
cardType.add(CardType.CREATURE);
color.setGreen(true);
subtype.add(SubType.OOZE);
@ -16,7 +16,7 @@ public final class OozeToken extends TokenImpl {
}
public OozeToken() {
super("Ooze Token", "X/X green ooze creature token");
super("Ooze Token", "X/X green Ooze creature token");
cardType.add(CardType.CREATURE);
color.setGreen(true);
subtype.add(SubType.OOZE);