mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
[SNC] Implemented Incriminate
This commit is contained in:
parent
7e4c438c51
commit
20a577fc5a
6 changed files with 114 additions and 14 deletions
|
@ -7,7 +7,6 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
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.
|
||||
this.getSpellAbility().addEffect(new BarrinsSpiteEffect());
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanentSameController(
|
||||
2, 2, StaticFilters.FILTER_PERMANENT_CREATURE, false
|
||||
));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanentSameController(2));
|
||||
}
|
||||
|
||||
private BarrinsSpite(final BarrinsSpite card) {
|
||||
|
|
|
@ -8,7 +8,6 @@ import mage.constants.CardType;
|
|||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
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.
|
||||
this.getSpellAbility().addEffect(new CannibalizeEffect());
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanentSameController(
|
||||
2, 2, StaticFilters.FILTER_PERMANENT_CREATURE, false
|
||||
));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanentSameController(2));
|
||||
}
|
||||
|
||||
private Cannibalize(final Cannibalize card) {
|
||||
|
|
101
Mage.Sets/src/mage/cards/i/Incriminate.java
Normal file
101
Mage.Sets/src/mage/cards/i/Incriminate.java
Normal 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);
|
||||
}
|
||||
}
|
|
@ -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.
|
||||
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);
|
||||
|
||||
// Whenever Sorrow's Path becomes tapped, it deals 2 damage to you and each creature you control.
|
||||
|
|
|
@ -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("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("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("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));
|
||||
|
|
|
@ -1,20 +1,24 @@
|
|||
|
||||
package mage.target.common;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class TargetCreaturePermanentSameController extends TargetCreaturePermanent {
|
||||
|
||||
public TargetCreaturePermanentSameController(int minNumTargets, int maxNumTargets, FilterCreaturePermanent filter, boolean notTarget) {
|
||||
super(minNumTargets, maxNumTargets, filter, notTarget);
|
||||
public TargetCreaturePermanentSameController(int numTargets) {
|
||||
this(numTargets, StaticFilters.FILTER_PERMANENT_CREATURE);
|
||||
}
|
||||
|
||||
public TargetCreaturePermanentSameController(int numTargets, FilterCreaturePermanent filter) {
|
||||
super(numTargets, numTargets, filter, false);
|
||||
}
|
||||
|
||||
public TargetCreaturePermanentSameController(final TargetCreaturePermanentSameController target) {
|
||||
|
|
Loading…
Reference in a new issue