[UNF] Implemented Slight Malfunction

This commit is contained in:
Evan Kranzler 2022-09-28 08:45:13 -04:00
parent 3101b247c3
commit ac13e80a6b
2 changed files with 77 additions and 0 deletions

View file

@ -0,0 +1,76 @@
package mage.cards.s;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.common.delayed.ReflexiveTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetAnyTarget;
import mage.target.common.TargetArtifactPermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class SlightMalfunction extends CardImpl {
public SlightMalfunction(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{R}");
// Choose one --
// * Destroy target artifact.
this.getSpellAbility().addEffect(new DestroyTargetEffect());
this.getSpellAbility().addTarget(new TargetArtifactPermanent());
// * Roll a six-side die. When you do, Slight Malfunction deals 1 damage to each of up to X target creatures, where X is the result.
this.getSpellAbility().addMode(new Mode(new SlightMalfunctionEffect()));
}
private SlightMalfunction(final SlightMalfunction card) {
super(card);
}
@Override
public SlightMalfunction copy() {
return new SlightMalfunction(this);
}
}
class SlightMalfunctionEffect extends OneShotEffect {
SlightMalfunctionEffect() {
super(Outcome.Benefit);
staticText = "roll a six-side die. When you do, {this} deals 1 damage " +
"to each of up to X target creatures, where X is the result";
}
private SlightMalfunctionEffect(final SlightMalfunctionEffect effect) {
super(effect);
}
@Override
public SlightMalfunctionEffect copy() {
return new SlightMalfunctionEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
int result = player.rollDice(outcome, source, game, 6);
ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(new DamageTargetEffect(1), false);
ability.addTarget(new TargetAnyTarget(0, result));
game.fireReflexiveTriggeredAbility(ability, source);
return true;
}
}

View file

@ -40,6 +40,7 @@ public final class Unfinity extends ExpansionSet {
cards.add(new SetCardInfo("Plains", 235, Rarity.LAND, mage.cards.basiclands.Plains.class, FULL_ART_BFZ_VARIOUS));
cards.add(new SetCardInfo("Sacred Foundry", 285, Rarity.RARE, mage.cards.s.SacredFoundry.class));
cards.add(new SetCardInfo("Saw in Half", 88, Rarity.RARE, mage.cards.s.SawInHalf.class));
cards.add(new SetCardInfo("Slight Malfunction", 123, Rarity.COMMON, mage.cards.s.SlightMalfunction.class));
cards.add(new SetCardInfo("Steam Vents", 283, Rarity.RARE, mage.cards.s.SteamVents.class));
cards.add(new SetCardInfo("Stomping Ground", 280, Rarity.RARE, mage.cards.s.StompingGround.class));
cards.add(new SetCardInfo("Swamp", 237, Rarity.LAND, mage.cards.basiclands.Swamp.class, FULL_ART_BFZ_VARIOUS));