mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
[NEO] Implemented Invoke Justice
This commit is contained in:
parent
82ff5665ee
commit
442859497b
3 changed files with 106 additions and 7 deletions
96
Mage.Sets/src/mage/cards/i/InvokeJustice.java
Normal file
96
Mage.Sets/src/mage/cards/i/InvokeJustice.java
Normal file
|
@ -0,0 +1,96 @@
|
|||
package mage.cards.i;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterPermanentCard;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetAmount;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
import mage.target.common.TargetPermanentAmount;
|
||||
import mage.target.targetpointer.SecondTargetPointer;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class InvokeJustice extends CardImpl {
|
||||
|
||||
private static final FilterCard filter = new FilterPermanentCard("permanent card from your graveyard");
|
||||
|
||||
public InvokeJustice(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{W}{W}{W}{W}");
|
||||
|
||||
// Return target permanent card from your graveyard to the battlefield, then distribute four +1/+1 counters among any number of creatures and/or Vehicles target player controls.
|
||||
this.getSpellAbility().addEffect(new ReturnFromGraveyardToBattlefieldTargetEffect());
|
||||
this.getSpellAbility().addEffect(new InvokeJusticeEffect());
|
||||
this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(filter));
|
||||
this.getSpellAbility().addTarget(new TargetPlayer());
|
||||
}
|
||||
|
||||
private InvokeJustice(final InvokeJustice card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InvokeJustice copy() {
|
||||
return new InvokeJustice(this);
|
||||
}
|
||||
}
|
||||
|
||||
class InvokeJusticeEffect extends OneShotEffect {
|
||||
|
||||
InvokeJusticeEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = ", then distribute four +1/+1 counters among " +
|
||||
"any number of creatures and/or Vehicles target player controls";
|
||||
this.setTargetPointer(new SecondTargetPointer());
|
||||
}
|
||||
|
||||
private InvokeJusticeEffect(final InvokeJusticeEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InvokeJusticeEffect copy() {
|
||||
return new InvokeJusticeEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
if (controller == null || player == null) {
|
||||
return false;
|
||||
}
|
||||
FilterPermanent filter = new FilterPermanent(
|
||||
"creatures and/or Vehicles controlled by " + player.getName()
|
||||
);
|
||||
filter.add(new ControllerIdPredicate(player.getId()));
|
||||
if (!game.getBattlefield().contains(filter, source, game, 1)) {
|
||||
return false;
|
||||
}
|
||||
TargetAmount target = new TargetPermanentAmount(4, filter);
|
||||
target.setNotTarget(true);
|
||||
controller.choose(outcome, target, source.getSourceId(), game);
|
||||
for (UUID targetId : target.getTargets()) {
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
if (permanent != null) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(target.getTargetAmount(targetId)), source, game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -134,6 +134,7 @@ public final class KamigawaNeonDynasty extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Inventive Iteration", 57, Rarity.RARE, mage.cards.i.InventiveIteration.class));
|
||||
cards.add(new SetCardInfo("Invigorating Hot Spring", 223, Rarity.UNCOMMON, mage.cards.i.InvigoratingHotSpring.class));
|
||||
cards.add(new SetCardInfo("Invoke Despair", 101, Rarity.RARE, mage.cards.i.InvokeDespair.class));
|
||||
cards.add(new SetCardInfo("Invoke Justice", 21, Rarity.RARE, mage.cards.i.InvokeJustice.class));
|
||||
cards.add(new SetCardInfo("Invoke the Ancients", 193, Rarity.RARE, mage.cards.i.InvokeTheAncients.class));
|
||||
cards.add(new SetCardInfo("Invoke the Winds", 58, Rarity.RARE, mage.cards.i.InvokeTheWinds.class));
|
||||
cards.add(new SetCardInfo("Iron Apprentice", 248, Rarity.COMMON, mage.cards.i.IronApprentice.class));
|
||||
|
|
|
@ -19,11 +19,11 @@ import java.util.stream.Collectors;
|
|||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public abstract class TargetPermanentAmount extends TargetAmount {
|
||||
public class TargetPermanentAmount extends TargetAmount {
|
||||
|
||||
protected final FilterPermanent filter;
|
||||
|
||||
TargetPermanentAmount(int amount, FilterPermanent filter) {
|
||||
public TargetPermanentAmount(int amount, FilterPermanent filter) {
|
||||
// 107.1c If a rule or ability instructs a player to choose “any number,” that player may choose
|
||||
// any positive number or zero, unless something (such as damage or counters) is being divided
|
||||
// or distributed among “any number” of players and/or objects. In that case, a nonzero number
|
||||
|
@ -31,18 +31,23 @@ public abstract class TargetPermanentAmount extends TargetAmount {
|
|||
this(StaticValue.get(amount), filter);
|
||||
}
|
||||
|
||||
TargetPermanentAmount(DynamicValue amount, FilterPermanent filter) {
|
||||
public TargetPermanentAmount(DynamicValue amount, FilterPermanent filter) {
|
||||
super(amount);
|
||||
this.zone = Zone.ALL;
|
||||
this.filter = filter;
|
||||
this.targetName = filter.getMessage();
|
||||
}
|
||||
|
||||
TargetPermanentAmount(final TargetPermanentAmount target) {
|
||||
protected TargetPermanentAmount(final TargetPermanentAmount target) {
|
||||
super(target);
|
||||
this.filter = target.filter.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TargetPermanentAmount copy() {
|
||||
return new TargetPermanentAmount(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Filter getFilter() {
|
||||
return this.filter;
|
||||
|
@ -132,7 +137,4 @@ public abstract class TargetPermanentAmount extends TargetAmount {
|
|||
});
|
||||
return sb.toString().trim();
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract TargetPermanentAmount copy();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue