[SNC] Implemented Incriminate

This commit is contained in:
Evan Kranzler 2022-04-09 10:08:23 -04:00
parent 7e4c438c51
commit 20a577fc5a
6 changed files with 114 additions and 14 deletions

View file

@ -7,7 +7,6 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
@ -30,9 +29,7 @@ public final class BarrinsSpite extends CardImpl {
// Choose two target creatures controlled by the same player. Their controller chooses and sacrifices one of them. Return the other to its owner's hand. // Choose two target creatures controlled by the same player. Their controller chooses and sacrifices one of them. Return the other to its owner's hand.
this.getSpellAbility().addEffect(new BarrinsSpiteEffect()); this.getSpellAbility().addEffect(new BarrinsSpiteEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanentSameController( this.getSpellAbility().addTarget(new TargetCreaturePermanentSameController(2));
2, 2, StaticFilters.FILTER_PERMANENT_CREATURE, false
));
} }
private BarrinsSpite(final BarrinsSpite card) { private BarrinsSpite(final BarrinsSpite card) {

View file

@ -8,7 +8,6 @@ import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Zone; import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.StaticFilters;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
@ -29,9 +28,7 @@ public final class Cannibalize extends CardImpl {
// Choose two target creatures controlled by the same player. Exile one of the creatures and put two +1/+1 counters on the other. // Choose two target creatures controlled by the same player. Exile one of the creatures and put two +1/+1 counters on the other.
this.getSpellAbility().addEffect(new CannibalizeEffect()); this.getSpellAbility().addEffect(new CannibalizeEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanentSameController( this.getSpellAbility().addTarget(new TargetCreaturePermanentSameController(2));
2, 2, StaticFilters.FILTER_PERMANENT_CREATURE, false
));
} }
private Cannibalize(final Cannibalize card) { private Cannibalize(final Cannibalize card) {

View file

@ -0,0 +1,101 @@
package mage.cards.i;
import mage.MageItem;
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.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanentSameController;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import java.util.stream.Collectors;
/**
* @author TheElk801
*/
public final class Incriminate extends CardImpl {
public Incriminate(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{B}");
// Choose two target creatures controlled by the same player. That player sacrifices one of them.
this.getSpellAbility().addEffect(new IncriminateEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanentSameController(2));
}
private Incriminate(final Incriminate card) {
super(card);
}
@Override
public Incriminate copy() {
return new Incriminate(this);
}
}
class IncriminateEffect extends OneShotEffect {
IncriminateEffect() {
super(Outcome.Benefit);
staticText = "choose two target creatures controlled by the same player. That player sacrifices one of them";
}
private IncriminateEffect(final IncriminateEffect effect) {
super(effect);
}
@Override
public IncriminateEffect copy() {
return new IncriminateEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
List<Permanent> permanents = this
.getTargetPointer()
.getTargets(game, source)
.stream()
.map(game::getPermanent)
.filter(Objects::nonNull)
.collect(Collectors.toList());
Permanent permanent;
switch (permanents.size()) {
case 0:
return false;
case 1:
permanent = permanents.get(0);
break;
case 2:
Player player = game.getPlayer(permanents.get(0).getControllerId());
if (player == null) {
return false;
}
FilterPermanent filter = new FilterPermanent("creature to sacrifice");
filter.add(Predicates.or(
permanents
.stream()
.map(MageItem::getId)
.map(ControllerIdPredicate::new)
.collect(Collectors.toList())
));
TargetPermanent target = new TargetPermanent(filter);
target.setNotTarget(true);
player.choose(Outcome.Sacrifice, target, source, game);
permanent = game.getPermanent(target.getFirstTarget());
default:
throw new UnsupportedOperationException("This shouldn't have happened");
}
return permanent != null && permanent.sacrifice(source, game);
}
}

View file

@ -44,7 +44,7 @@ public final class SorrowsPath extends CardImpl {
// {T}: Choose two target blocking creatures an opponent controls. If each of those creatures could block all creatures that the other is blocking, remove both of them from combat. Each one then blocks all creatures the other was blocking. // {T}: Choose two target blocking creatures an opponent controls. If each of those creatures could block all creatures that the other is blocking, remove both of them from combat. Each one then blocks all creatures the other was blocking.
Ability ability = new SimpleActivatedAbility(new SorrowsPathSwitchBlockersEffect(), new TapSourceCost()); Ability ability = new SimpleActivatedAbility(new SorrowsPathSwitchBlockersEffect(), new TapSourceCost());
ability.addTarget(new TargetCreaturePermanentSameController(2, 2, filter, false)); ability.addTarget(new TargetCreaturePermanentSameController(2, filter));
this.addAbility(ability); this.addAbility(ability);
// Whenever Sorrow's Path becomes tapped, it deals 2 damage to you and each creature you control. // Whenever Sorrow's Path becomes tapped, it deals 2 damage to you and each creature you control.

View file

@ -45,6 +45,7 @@ public final class StreetsOfNewCapenna extends ExpansionSet {
cards.add(new SetCardInfo("Gala Greeters", 148, Rarity.RARE, mage.cards.g.GalaGreeters.class)); cards.add(new SetCardInfo("Gala Greeters", 148, Rarity.RARE, mage.cards.g.GalaGreeters.class));
cards.add(new SetCardInfo("Getaway Car", 237, Rarity.RARE, mage.cards.g.GetawayCar.class)); cards.add(new SetCardInfo("Getaway Car", 237, Rarity.RARE, mage.cards.g.GetawayCar.class));
cards.add(new SetCardInfo("Halo Fountain", 15, Rarity.MYTHIC, mage.cards.h.HaloFountain.class)); cards.add(new SetCardInfo("Halo Fountain", 15, Rarity.MYTHIC, mage.cards.h.HaloFountain.class));
cards.add(new SetCardInfo("Incriminate", 84, Rarity.COMMON, mage.cards.i.Incriminate.class));
cards.add(new SetCardInfo("Island", 264, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Island", 264, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Jetmir's Garden", 250, Rarity.RARE, mage.cards.j.JetmirsGarden.class)); cards.add(new SetCardInfo("Jetmir's Garden", 250, Rarity.RARE, mage.cards.j.JetmirsGarden.class));
cards.add(new SetCardInfo("Jetmir, Nexus of Revels", 193, Rarity.MYTHIC, mage.cards.j.JetmirNexusOfRevels.class)); cards.add(new SetCardInfo("Jetmir, Nexus of Revels", 193, Rarity.MYTHIC, mage.cards.j.JetmirNexusOfRevels.class));

View file

@ -1,20 +1,24 @@
package mage.target.common; package mage.target.common;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public class TargetCreaturePermanentSameController extends TargetCreaturePermanent { public class TargetCreaturePermanentSameController extends TargetCreaturePermanent {
public TargetCreaturePermanentSameController(int minNumTargets, int maxNumTargets, FilterCreaturePermanent filter, boolean notTarget) { public TargetCreaturePermanentSameController(int numTargets) {
super(minNumTargets, maxNumTargets, filter, notTarget); this(numTargets, StaticFilters.FILTER_PERMANENT_CREATURE);
}
public TargetCreaturePermanentSameController(int numTargets, FilterCreaturePermanent filter) {
super(numTargets, numTargets, filter, false);
} }
public TargetCreaturePermanentSameController(final TargetCreaturePermanentSameController target) { public TargetCreaturePermanentSameController(final TargetCreaturePermanentSameController target) {