[MID] Implemented Play with Fire

This commit is contained in:
Evan Kranzler 2021-08-05 21:40:09 -04:00
parent 01acb84776
commit 78b97dc800
2 changed files with 72 additions and 0 deletions

View file

@ -0,0 +1,71 @@
package mage.cards.p;
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.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetAnyTarget;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class PlayWithFire extends CardImpl {
public PlayWithFire(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{R}");
// Play with Fire deals 2 damage to any target. If a player is dealt damage this way, scry 1.
this.getSpellAbility().addEffect(new PlayWithFireEffect());
this.getSpellAbility().addTarget(new TargetAnyTarget());
}
private PlayWithFire(final PlayWithFire card) {
super(card);
}
@Override
public PlayWithFire copy() {
return new PlayWithFire(this);
}
}
class PlayWithFireEffect extends OneShotEffect {
PlayWithFireEffect() {
super(Outcome.Benefit);
staticText = "{this} deals 2 damage to any target. If a player is dealt damage this way, scry 1";
}
private PlayWithFireEffect(final PlayWithFireEffect effect) {
super(effect);
}
@Override
public PlayWithFireEffect copy() {
return new PlayWithFireEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
return permanent.damage(2, source.getSourceId(), source, game) > 0;
}
Player player = game.getPlayer(source.getFirstTarget());
if (player == null || player.damage(2, source.getSourceId(), source, game) < 1) {
return false;
}
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
controller.scry(1, source, game);
}
return true;
}
}

View file

@ -34,6 +34,7 @@ public final class InnistradMidnightHunt extends ExpansionSet {
cards.add(new SetCardInfo("Join the Dance", 229, Rarity.UNCOMMON, mage.cards.j.JoinTheDance.class)); cards.add(new SetCardInfo("Join the Dance", 229, Rarity.UNCOMMON, mage.cards.j.JoinTheDance.class));
cards.add(new SetCardInfo("Mountain", 274, Rarity.LAND, mage.cards.basiclands.Mountain.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Mountain", 274, Rarity.LAND, mage.cards.basiclands.Mountain.class, FULL_ART_BFZ_VARIOUS));
cards.add(new SetCardInfo("Plains", 268, Rarity.LAND, mage.cards.basiclands.Plains.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Plains", 268, Rarity.LAND, mage.cards.basiclands.Plains.class, FULL_ART_BFZ_VARIOUS));
cards.add(new SetCardInfo("Play with Fire", 154, Rarity.UNCOMMON, mage.cards.p.PlayWithFire.class));
cards.add(new SetCardInfo("Swamp", 272, Rarity.LAND, mage.cards.basiclands.Swamp.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Swamp", 272, Rarity.LAND, mage.cards.basiclands.Swamp.class, FULL_ART_BFZ_VARIOUS));
} }
} }