mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
Merge branch 'targetAdjustment' into master
This commit is contained in:
commit
3483b3a181
154 changed files with 3062 additions and 2964 deletions
|
@ -1,26 +1,26 @@
|
|||
|
||||
package mage.cards.a;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.CostAdjuster;
|
||||
import mage.abilities.costs.common.DiscardTargetCost;
|
||||
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.InfoEffect;
|
||||
import mage.abilities.effects.common.discard.DiscardCardYouChooseTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.target.common.TargetCardInHand;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fireshoes
|
||||
*/
|
||||
public final class AbandonHope extends CardImpl {
|
||||
|
@ -29,7 +29,7 @@ public final class AbandonHope extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{1}{B}");
|
||||
|
||||
// As an additional cost to cast Abandon Hope, discard X cards.
|
||||
Ability ability = new SimpleStaticAbility(Zone.ALL, new AbandonHopeRuleEffect());
|
||||
Ability ability = new SimpleStaticAbility(Zone.ALL, new InfoEffect("As an additional cost to cast this spell, discard X cards"));
|
||||
ability.setRuleAtTheTop(true);
|
||||
this.addAbility(ability);
|
||||
|
||||
|
@ -37,44 +37,27 @@ public final class AbandonHope extends CardImpl {
|
|||
ManacostVariableValue manaX = new ManacostVariableValue();
|
||||
this.getSpellAbility().addEffect(new DiscardCardYouChooseTargetEffect(manaX, TargetController.ANY));
|
||||
this.getSpellAbility().addTarget(new TargetPlayer());
|
||||
this.getSpellAbility().setCostAdjuster(AbandonHopeAdjuster.instance);
|
||||
}
|
||||
|
||||
public AbandonHope(final AbandonHope card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
if (xValue > 0) {
|
||||
ability.addCost(new DiscardTargetCost(new TargetCardInHand(xValue, xValue, new FilterCard("cards"))));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbandonHope copy() {
|
||||
return new AbandonHope(this);
|
||||
}
|
||||
}
|
||||
|
||||
class AbandonHopeRuleEffect extends OneShotEffect {
|
||||
|
||||
public AbandonHopeRuleEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "As an additional cost to cast this spell, discard X cards";
|
||||
}
|
||||
|
||||
public AbandonHopeRuleEffect(final AbandonHopeRuleEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
enum AbandonHopeAdjuster implements CostAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public AbandonHopeRuleEffect copy() {
|
||||
return new AbandonHopeRuleEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
if (xValue > 0) {
|
||||
ability.addCost(new DiscardTargetCost(new TargetCardInHand(xValue, xValue, StaticFilters.FILTER_CARD_CARDS)));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -13,29 +13,42 @@ import mage.game.Game;
|
|||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import static mage.filter.StaticFilters.FILTER_PERMANENT_CREATURES;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author magenoxx_at_gmail.com
|
||||
*/
|
||||
public final class AetherBurst extends CardImpl {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("cards named Aether Burst");
|
||||
|
||||
static {
|
||||
filter.add(new NamePredicate("Aether Burst"));
|
||||
}
|
||||
|
||||
public AetherBurst(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}");
|
||||
|
||||
// Return up to X target creatures to their owners' hands, where X is one plus the number of cards named Aether Burst in all graveyards as you cast Aether Burst.
|
||||
this.getSpellAbility().addEffect(new DynamicReturnToHandTargetEffect());
|
||||
this.getSpellAbility().addTarget(new DynamicTargetCreaturePermanent());
|
||||
this.getSpellAbility().setTargetAdjuster(AetherBurstAdjuster.instance);
|
||||
}
|
||||
|
||||
|
||||
public AetherBurst(final AetherBurst card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AetherBurst copy() {
|
||||
return new AetherBurst(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum AetherBurstAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
private static final FilterCard filter = new FilterCard("cards named Aether Burst");
|
||||
|
||||
static {
|
||||
filter.add(new NamePredicate("Aether Burst"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -55,15 +68,6 @@ public final class AetherBurst extends CardImpl {
|
|||
target.setMaxNumberOfTargets(amount + 1);
|
||||
}
|
||||
}
|
||||
|
||||
public AetherBurst(final AetherBurst card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AetherBurst copy() {
|
||||
return new AetherBurst(this);
|
||||
}
|
||||
}
|
||||
|
||||
class DynamicTargetCreaturePermanent extends TargetPermanent {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.a;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksTriggeredAbility;
|
||||
|
@ -21,17 +20,17 @@ import mage.filter.common.FilterCreaturePermanent;
|
|||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class AetherstormRoc extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
|
||||
public AetherstormRoc(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{W}{W}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}{W}");
|
||||
this.subtype.add(SubType.BIRD);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(3);
|
||||
|
@ -47,30 +46,32 @@ public final class AetherstormRoc extends CardImpl {
|
|||
Ability ability = new AttacksTriggeredAbility(doIfCostPaidEffect, false,
|
||||
"Whenever {this} attacks you may pay {E}{E}. If you do, put a +1/+1 counter on it and tap up to one target creature defending player controls.");
|
||||
ability.addTarget(new TargetCreaturePermanent(0, 1, new FilterCreaturePermanent("creature defending player controls"), false));
|
||||
originalId = ability.getOriginalId();
|
||||
ability.setTargetAdjuster(AetherstormRocAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
|
||||
}
|
||||
|
||||
public AetherstormRoc(final AetherstormRoc card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
ability.getTargets().clear();
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls");
|
||||
UUID defenderId = game.getCombat().getDefenderId(ability.getSourceId());
|
||||
filter.add(new ControllerIdPredicate(defenderId));
|
||||
TargetCreaturePermanent target = new TargetCreaturePermanent(0, 1, filter, false);
|
||||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AetherstormRoc copy() {
|
||||
return new AetherstormRoc(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum AetherstormRocAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls");
|
||||
UUID defenderId = game.getCombat().getDefenderId(ability.getSourceId());
|
||||
filter.add(new ControllerIdPredicate(defenderId));
|
||||
TargetCreaturePermanent target = new TargetCreaturePermanent(0, 1, filter, false);
|
||||
ability.addTarget(target);
|
||||
}
|
||||
}
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
package mage.cards.a;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -18,9 +16,11 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Quercitron
|
||||
*/
|
||||
public final class AphettoDredging extends CardImpl {
|
||||
|
@ -32,20 +32,7 @@ public final class AphettoDredging extends CardImpl {
|
|||
Effect effect = new ReturnFromGraveyardToHandTargetEffect();
|
||||
effect.setText("Return up to three target creature cards of the creature type of your choice from your graveyard to your hand");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
Player controller = game.getPlayer(ability.getControllerId());
|
||||
Choice typeChoice = new ChoiceCreatureType(game.getObject(ability.getSourceId()));
|
||||
if (controller != null && controller.choose(Outcome.PutCreatureInPlay, typeChoice, game)) {
|
||||
String chosenType = typeChoice.getChoice();
|
||||
FilterCreatureCard filter = new FilterCreatureCard(chosenType + " cards");
|
||||
filter.add(new SubtypePredicate(SubType.byDescription(chosenType)));
|
||||
ability.addTarget(new TargetCardInYourGraveyard(0, 3, filter));
|
||||
}
|
||||
}
|
||||
this.getSpellAbility().setTargetAdjuster(AphettoDredgingAdjuster.instance);
|
||||
}
|
||||
|
||||
public AphettoDredging(final AphettoDredging card) {
|
||||
|
@ -57,3 +44,19 @@ public final class AphettoDredging extends CardImpl {
|
|||
return new AphettoDredging(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum AphettoDredgingAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
Player controller = game.getPlayer(ability.getControllerId());
|
||||
Choice typeChoice = new ChoiceCreatureType(game.getObject(ability.getSourceId()));
|
||||
if (controller != null && controller.choose(Outcome.PutCreatureInPlay, typeChoice, game)) {
|
||||
String chosenType = typeChoice.getChoice();
|
||||
FilterCreatureCard filter = new FilterCreatureCard(chosenType + " cards");
|
||||
filter.add(new SubtypePredicate(SubType.byDescription(chosenType)));
|
||||
ability.addTarget(new TargetCardInYourGraveyard(0, 3, filter));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,40 +1,32 @@
|
|||
|
||||
package mage.cards.a;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterLandPermanent;
|
||||
import mage.filter.predicate.mageobject.SupertypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class Avalanche extends CardImpl {
|
||||
|
||||
private static final FilterLandPermanent filter = new FilterLandPermanent("snow lands");
|
||||
|
||||
public Avalanche(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{2}{R}{R}");
|
||||
|
||||
// Destroy X target snow lands.
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect("Destroy X target snow lands"));
|
||||
this.getSpellAbility().addTarget(new TargetPermanent(filter));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
ability.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
ability.addTarget(new TargetPermanent(xValue, xValue, filter, false));
|
||||
}
|
||||
this.getSpellAbility().setTargetAdjuster(AvalancheAdjuster.instance);
|
||||
}
|
||||
|
||||
public Avalanche(final Avalanche card) {
|
||||
|
@ -46,3 +38,19 @@ public final class Avalanche extends CardImpl {
|
|||
return new Avalanche(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum AvalancheAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
private static final FilterPermanent filter = new FilterLandPermanent("snow lands");
|
||||
|
||||
static {
|
||||
filter.add(new SupertypePredicate(SuperType.SNOW));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
ability.addTarget(new TargetPermanent(xValue, xValue, filter, false));
|
||||
}
|
||||
}
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
package mage.cards.b;
|
||||
|
||||
import java.util.*;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
|
||||
|
@ -18,6 +16,7 @@ import mage.game.Game;
|
|||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
|
@ -31,34 +30,37 @@ public final class BlatantThievery extends CardImpl {
|
|||
|
||||
// For each opponent, gain control of target permanent that player controls.
|
||||
this.getSpellAbility().addEffect(new BlatantThieveryEffect());
|
||||
this.getSpellAbility().setTargetAdjuster(BlatantThieveryAdjuster.instance);
|
||||
}
|
||||
|
||||
public BlatantThievery(final BlatantThievery card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
ability.getTargets().clear();
|
||||
for (UUID opponentId : game.getOpponents(ability.getControllerId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
if (opponent != null) {
|
||||
FilterPermanent filter = new FilterPermanent("Permanent of player " + opponent.getName());
|
||||
filter.add(new ControllerIdPredicate(opponentId));
|
||||
TargetPermanent targetPermanent = new TargetPermanent(filter);
|
||||
ability.addTarget(targetPermanent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlatantThievery copy() {
|
||||
return new BlatantThievery(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum BlatantThieveryAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
for (UUID opponentId : game.getOpponents(ability.getControllerId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
if (opponent != null) {
|
||||
FilterPermanent filter = new FilterPermanent("Permanent of player " + opponent.getName());
|
||||
filter.add(new ControllerIdPredicate(opponentId));
|
||||
TargetPermanent targetPermanent = new TargetPermanent(filter);
|
||||
ability.addTarget(targetPermanent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class BlatantThieveryEffect extends OneShotEffect {
|
||||
|
||||
BlatantThieveryEffect() {
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
|
||||
package mage.cards.b;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -16,9 +12,13 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetArtifactPermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author sinsedrix
|
||||
*/
|
||||
public final class BuildersBane extends CardImpl {
|
||||
|
@ -29,15 +29,7 @@ public final class BuildersBane extends CardImpl {
|
|||
// Destroy X target artifacts. Builder's Bane deals damage to each player equal to the number of artifacts he or she controlled put into a graveyard this way.
|
||||
this.getSpellAbility().addTarget(new TargetArtifactPermanent());
|
||||
this.getSpellAbility().addEffect(new BuildersBaneEffect());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
ability.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
ability.addTarget(new TargetArtifactPermanent(xValue, xValue));
|
||||
}
|
||||
this.getSpellAbility().setTargetAdjuster(BuildersBaneAdjuster.instance);
|
||||
}
|
||||
|
||||
public BuildersBane(final BuildersBane card) {
|
||||
|
@ -50,11 +42,22 @@ public final class BuildersBane extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum BuildersBaneAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
ability.addTarget(new TargetArtifactPermanent(xValue, xValue));
|
||||
}
|
||||
}
|
||||
|
||||
class BuildersBaneEffect extends OneShotEffect {
|
||||
|
||||
public BuildersBaneEffect() {
|
||||
super(Outcome.DestroyPermanent);
|
||||
this.staticText = "Destroy X target artifacts. {this} deals damage to each player equal to the number of artifacts he or she controlled put into a graveyard this way";
|
||||
this.staticText = "Destroy X target artifacts. {this} deals damage to each player equal to the number of artifacts they controlled that were put into a graveyard this way";
|
||||
}
|
||||
|
||||
public BuildersBaneEffect(final BuildersBaneEffect effect) {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.b;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DiesCreatureTriggeredAbility;
|
||||
import mage.abilities.effects.common.SacrificeEffect;
|
||||
|
@ -12,39 +11,29 @@ import mage.constants.Zone;
|
|||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class BurningSands extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
|
||||
public BurningSands(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{3}{R}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{R}{R}");
|
||||
|
||||
// Whenever a creature dies, that creature's controller sacrifices a land.
|
||||
Ability ability = new DiesCreatureTriggeredAbility(new SacrificeEffect(StaticFilters.FILTER_LAND, 1, "that creature's controller"), false, false, true);
|
||||
originalId = ability.getOriginalId();
|
||||
Ability ability = new DiesCreatureTriggeredAbility(new SacrificeEffect(
|
||||
StaticFilters.FILTER_LAND, 1, "that creature's controller"
|
||||
), false, false, true);
|
||||
ability.setTargetAdjuster(BurningSandsAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
UUID creatureId = ability.getEffects().get(0).getTargetPointer().getFirst(game, ability);
|
||||
Permanent creature = (Permanent) game.getLastKnownInformation(creatureId, Zone.BATTLEFIELD);
|
||||
if (creature != null) {
|
||||
ability.getEffects().get(0).setTargetPointer(new FixedTarget(creature.getControllerId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public BurningSands(final BurningSands card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -52,3 +41,16 @@ public final class BurningSands extends CardImpl {
|
|||
return new BurningSands(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum BurningSandsAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
UUID creatureId = ability.getEffects().get(0).getTargetPointer().getFirst(game, ability);
|
||||
Permanent creature = game.getPermanentOrLKIBattlefield(creatureId);
|
||||
if (creature != null) {
|
||||
ability.getEffects().get(0).setTargetPointer(new FixedTarget(creature.getControllerId()));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,18 +1,18 @@
|
|||
|
||||
package mage.cards.b;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.game.Game;
|
||||
import mage.target.common.TargetArtifactPermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author spjspj
|
||||
*/
|
||||
public final class ByForce extends CardImpl {
|
||||
|
@ -23,15 +23,7 @@ public final class ByForce extends CardImpl {
|
|||
// Destroy X target artifacts.
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect("Destroy X target artifacts"));
|
||||
this.getSpellAbility().addTarget(new TargetArtifactPermanent());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
ability.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
ability.addTarget(new TargetArtifactPermanent(xValue, xValue));
|
||||
}
|
||||
this.getSpellAbility().setTargetAdjuster(ByForceAdjuster.instance);
|
||||
}
|
||||
|
||||
public ByForce(final ByForce card) {
|
||||
|
@ -43,3 +35,14 @@ public final class ByForce extends CardImpl {
|
|||
return new ByForce(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum ByForceAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
ability.addTarget(new TargetArtifactPermanent(xValue, xValue));
|
||||
}
|
||||
}
|
|
@ -1,14 +1,15 @@
|
|||
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.CostAdjuster;
|
||||
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.InfoEffect;
|
||||
import mage.abilities.effects.common.continuous.SetPowerSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.SetToughnessSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -21,8 +22,9 @@ import mage.filter.predicate.mageobject.ChosenSubtypePredicate;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class CallerOfTheHunt extends CardImpl {
|
||||
|
@ -34,14 +36,24 @@ public final class CallerOfTheHunt extends CardImpl {
|
|||
|
||||
// As an additional cost to cast Caller of the Hunt, choose a creature type.
|
||||
// Caller of the Hunt's power and toughness are each equal to the number of creatures of the chosen type on the battlefield.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new CallerOfTheHuntAdditionalCostEffect()));
|
||||
|
||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new InfoEffect("as an additional cost to cast this spell, choose a creature type. \r"
|
||||
+ "{this}'s power and toughness are each equal to the number of creatures of the chosen type on the battlefield")));
|
||||
this.getSpellAbility().setCostAdjuster(CallerOfTheHuntAdjuster.instance);
|
||||
}
|
||||
|
||||
public CallerOfTheHunt(final CallerOfTheHunt card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CallerOfTheHunt copy() {
|
||||
return new CallerOfTheHunt(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum CallerOfTheHuntAdjuster implements CostAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
MageObject mageObject = game.getObject(ability.getSourceId());
|
||||
|
@ -56,34 +68,6 @@ public final class CallerOfTheHunt extends CardImpl {
|
|||
game.addEffect(effectToughness, ability);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CallerOfTheHunt copy() {
|
||||
return new CallerOfTheHunt(this);
|
||||
}
|
||||
}
|
||||
|
||||
class CallerOfTheHuntAdditionalCostEffect extends OneShotEffect {
|
||||
|
||||
public CallerOfTheHuntAdditionalCostEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "as an additional cost to cast this spell, choose a creature type. \r"
|
||||
+ "{this}'s power and toughness are each equal to the number of creatures of the chosen type on the battlefield";
|
||||
}
|
||||
|
||||
public CallerOfTheHuntAdditionalCostEffect(final CallerOfTheHuntAdditionalCostEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CallerOfTheHuntAdditionalCostEffect copy() {
|
||||
return new CallerOfTheHuntAdditionalCostEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class ChooseCreatureTypeEffect extends OneShotEffect { // code by LevelX2, but that other version is not compatible with this card
|
||||
|
@ -116,5 +100,4 @@ class ChooseCreatureTypeEffect extends OneShotEffect { // code by LevelX2, but t
|
|||
public ChooseCreatureTypeEffect copy() {
|
||||
return new ChooseCreatureTypeEffect(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
|
||||
import mage.abilities.keyword.PersistAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -10,13 +9,14 @@ import mage.constants.CardType;
|
|||
import mage.constants.Duration;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class CauldronHaze extends CardImpl {
|
||||
|
||||
private final String rule = "Choose any number of target creatures. Each of those creatures gains persist until end of turn";
|
||||
private static final String rule = "Choose any number of target creatures. Each of those creatures gains persist until end of turn";
|
||||
|
||||
public CauldronHaze(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{W/B}");
|
||||
|
@ -24,7 +24,6 @@ public final class CauldronHaze extends CardImpl {
|
|||
// Choose any number of target creatures. Each of those creatures gains persist until end of turn.
|
||||
this.getSpellAbility().addEffect(new GainAbilityTargetEffect(new PersistAbility(), Duration.EndOfTurn, rule));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, Integer.MAX_VALUE));
|
||||
|
||||
}
|
||||
|
||||
public CauldronHaze(final CauldronHaze card) {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
@ -22,14 +21,15 @@ import mage.filter.common.FilterCreatureCard;
|
|||
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class ChampionOfStraySouls extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("other creatures");
|
||||
|
||||
static {
|
||||
|
@ -37,7 +37,7 @@ public final class ChampionOfStraySouls extends CardImpl {
|
|||
}
|
||||
|
||||
public ChampionOfStraySouls(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{B}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}{B}");
|
||||
this.subtype.add(SubType.SKELETON);
|
||||
this.subtype.add(SubType.WARRIOR);
|
||||
|
||||
|
@ -49,7 +49,6 @@ public final class ChampionOfStraySouls extends CardImpl {
|
|||
* ability, before you pay any costs. You can't target any of the
|
||||
* creatures you sacrifice.
|
||||
*/
|
||||
//TODO: Make ability properly copiable
|
||||
// {3}{B}{B}, {T}, Sacrifice X other creatures: Return X target creatures from your graveyard to the battlefield.
|
||||
Effect effect = new ReturnFromGraveyardToBattlefieldTargetEffect();
|
||||
effect.setText("Return X target creatures from your graveyard to the battlefield");
|
||||
|
@ -57,32 +56,17 @@ public final class ChampionOfStraySouls extends CardImpl {
|
|||
ability.addCost(new TapSourceCost());
|
||||
ability.addCost(new SacrificeXTargetCost(filter));
|
||||
ability.addTarget(new TargetCardInYourGraveyard(0, Integer.MAX_VALUE, new FilterCreatureCard("creature cards from your graveyard")));
|
||||
originalId = ability.getOriginalId();
|
||||
ability.setTargetAdjuster(ChampionOfStraySoulsAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
|
||||
// {5}{B}{B}: Put Champion of Stray Souls on top of your library from your graveyard.
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.GRAVEYARD,
|
||||
new PutOnLibrarySourceEffect(true, "Put {this} on top of your library from your graveyard"),
|
||||
new ManaCostsImpl("{5}{B}{B}")));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
for (Effect effect : ability.getEffects()) {
|
||||
if (effect instanceof ReturnFromGraveyardToBattlefieldTargetEffect) {
|
||||
int xValue = new GetXValue().calculate(game, ability, null);
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetCardInYourGraveyard(xValue, xValue, new FilterCreatureCard("creature cards from your graveyard")));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ChampionOfStraySouls(final ChampionOfStraySouls card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -90,3 +74,18 @@ public final class ChampionOfStraySouls extends CardImpl {
|
|||
return new ChampionOfStraySouls(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum ChampionOfStraySoulsAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
for (Effect effect : ability.getEffects()) {
|
||||
if (effect instanceof ReturnFromGraveyardToBattlefieldTargetEffect) {
|
||||
int xValue = new GetXValue().calculate(game, ability, null);
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetCardInYourGraveyard(xValue, xValue, new FilterCreatureCard("creature cards from your graveyard")));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -15,28 +15,33 @@ import mage.constants.CardType;
|
|||
import mage.constants.TargetController;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.filter.predicate.Predicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class CitadelSiege extends CardImpl {
|
||||
|
||||
private final static String ruleTrigger1 = "&bull Khans — At the beginning of combat on your turn, put two +1/+1 counters on target creature you control.";
|
||||
private final static String ruleTrigger2 = "&bull Dragons — At the beginning of combat on each opponent's turn, tap target creature that player controls.";
|
||||
private final static FilterCreaturePermanent filter = new FilterCreaturePermanent("creature controlled by the active player");
|
||||
|
||||
static {
|
||||
filter.add(CitadelSiegePredicate.instance);
|
||||
}
|
||||
|
||||
public CitadelSiege(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{W}{W}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}{W}");
|
||||
|
||||
// As Citadel Siege enters the battlefield, choose Khans or Dragons.
|
||||
this.addAbility(new EntersBattlefieldAbility(new ChooseModeEffect("Khans or Dragons?","Khans", "Dragons"),null,
|
||||
"As {this} enters the battlefield, choose Khans or Dragons.",""));
|
||||
this.addAbility(new EntersBattlefieldAbility(new ChooseModeEffect("Khans or Dragons?", "Khans", "Dragons"), null,
|
||||
"As {this} enters the battlefield, choose Khans or Dragons.", ""));
|
||||
|
||||
// * Khans - At the beginning of combat on your turn, put two +1/+1 counters on target creature you control.
|
||||
Ability ability = new ConditionalTriggeredAbility(
|
||||
|
@ -51,21 +56,10 @@ public final class CitadelSiege extends CardImpl {
|
|||
new BeginningOfCombatTriggeredAbility(new TapTargetEffect(), TargetController.OPPONENT, false),
|
||||
new ModeChoiceSourceCondition("Dragons"),
|
||||
ruleTrigger2);
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
ability.addTarget(new TargetCreaturePermanent(filter));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (this.getAbilities().contains(ability) && ability.getRule().startsWith("&bull Dragons")) {
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature that player controls");
|
||||
filter.add(new ControllerIdPredicate(game.getCombat().getAttackingPlayerId()));
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetCreaturePermanent(filter));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public CitadelSiege(final CitadelSiege card) {
|
||||
super(card);
|
||||
}
|
||||
|
@ -75,3 +69,12 @@ public final class CitadelSiege extends CardImpl {
|
|||
return new CitadelSiege(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum CitadelSiegePredicate implements Predicate<Permanent> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Permanent input, Game game) {
|
||||
return input.getControllerId().equals(game.getActivePlayerId());
|
||||
}
|
||||
}
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.dynamicvalue.common.MultikickerCount;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.keyword.MultikickerAbility;
|
||||
|
@ -15,6 +13,7 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetAnyTarget;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -31,27 +30,30 @@ public final class CometStorm extends CardImpl {
|
|||
// Choose any target, then choose another any target for each time Comet Storm was kicked. Comet Storm deals X damage to each of them.
|
||||
this.getSpellAbility().addEffect(new CometStormEffect());
|
||||
this.getSpellAbility().addTarget(new TargetAnyTarget(1));
|
||||
this.getSpellAbility().setTargetAdjuster(CometStormAdjuster.instance);
|
||||
}
|
||||
|
||||
public CometStorm(final CometStorm card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
ability.getTargets().clear();
|
||||
int numbTargets = new MultikickerCount().calculate(game, ability, null) + 1;
|
||||
ability.addTarget(new TargetAnyTarget(numbTargets));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CometStorm copy() {
|
||||
return new CometStorm(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum CometStormAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
int numbTargets = new MultikickerCount().calculate(game, ability, null) + 1;
|
||||
ability.addTarget(new TargetAnyTarget(numbTargets));
|
||||
}
|
||||
}
|
||||
|
||||
class CometStormEffect extends OneShotEffect {
|
||||
|
||||
public CometStormEffect() {
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
|
@ -22,9 +18,14 @@ import mage.filter.predicate.permanent.ControllerIdPredicate;
|
|||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author anonymous
|
||||
*/
|
||||
public final class ConfusionInTheRanks extends CardImpl {
|
||||
|
@ -38,7 +39,6 @@ public final class ConfusionInTheRanks extends CardImpl {
|
|||
new CardTypePredicate(CardType.ENCHANTMENT)
|
||||
));
|
||||
}
|
||||
private final UUID originalId;
|
||||
|
||||
public ConfusionInTheRanks(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{R}{R}");
|
||||
|
@ -49,54 +49,18 @@ public final class ConfusionInTheRanks extends CardImpl {
|
|||
new ExchangeControlTargetEffect(
|
||||
Duration.EndOfGame,
|
||||
"its controller chooses target permanent "
|
||||
+ "another player controls that shares a card type with it. "
|
||||
+ "Exchange control of those permanents"
|
||||
+ "another player controls that shares a card type with it. "
|
||||
+ "Exchange control of those permanents"
|
||||
),
|
||||
filter, false, SetTargetPointer.PERMANENT, null
|
||||
);
|
||||
ability.addTarget(new TargetPermanent());
|
||||
originalId = ability.getOriginalId();
|
||||
ability.setTargetAdjuster(ConfusionInTheRanksAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
public ConfusionInTheRanks(final ConfusionInTheRanks card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
UUID enteringPermanentId = null;
|
||||
for (Effect effect : ability.getEffects()) {
|
||||
enteringPermanentId = effect.getTargetPointer().getFirst(game, ability);
|
||||
}
|
||||
if (enteringPermanentId == null) {
|
||||
return;
|
||||
}
|
||||
Permanent enteringPermanent = game.getPermanent(enteringPermanentId);
|
||||
if (enteringPermanent == null) {
|
||||
return;
|
||||
}
|
||||
ability.getTargets().clear();
|
||||
FilterPermanent filterTarget = new FilterPermanent();
|
||||
String message = "";
|
||||
filterTarget.add(Predicates.not(new ControllerIdPredicate(enteringPermanent.getControllerId())));
|
||||
Set<CardTypePredicate> cardTypesPredicates = new HashSet<>(1);
|
||||
for (CardType cardTypeEntering : enteringPermanent.getCardType()) {
|
||||
cardTypesPredicates.add(new CardTypePredicate(cardTypeEntering));
|
||||
if (!message.isEmpty()) {
|
||||
message += "or ";
|
||||
}
|
||||
message += cardTypeEntering.toString().toLowerCase(Locale.ENGLISH) + ' ';
|
||||
}
|
||||
filterTarget.add(Predicates.or(cardTypesPredicates));
|
||||
message += "you don't control";
|
||||
filterTarget.setMessage(message);
|
||||
TargetPermanent target = new TargetPermanent(filterTarget);
|
||||
target.setTargetController(enteringPermanent.getControllerId());
|
||||
ability.getTargets().add(target);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -104,3 +68,40 @@ public final class ConfusionInTheRanks extends CardImpl {
|
|||
return new ConfusionInTheRanks(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum ConfusionInTheRanksAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
UUID enteringPermanentId = null;
|
||||
for (Effect effect : ability.getEffects()) {
|
||||
enteringPermanentId = effect.getTargetPointer().getFirst(game, ability);
|
||||
}
|
||||
if (enteringPermanentId == null) {
|
||||
return;
|
||||
}
|
||||
Permanent enteringPermanent = game.getPermanent(enteringPermanentId);
|
||||
if (enteringPermanent == null) {
|
||||
return;
|
||||
}
|
||||
ability.getTargets().clear();
|
||||
FilterPermanent filterTarget = new FilterPermanent();
|
||||
String message = "";
|
||||
filterTarget.add(Predicates.not(new ControllerIdPredicate(enteringPermanent.getControllerId())));
|
||||
Set<CardTypePredicate> cardTypesPredicates = new HashSet<>(1);
|
||||
for (CardType cardTypeEntering : enteringPermanent.getCardType()) {
|
||||
cardTypesPredicates.add(new CardTypePredicate(cardTypeEntering));
|
||||
if (!message.isEmpty()) {
|
||||
message += "or ";
|
||||
}
|
||||
message += cardTypeEntering.toString().toLowerCase(Locale.ENGLISH) + ' ';
|
||||
}
|
||||
filterTarget.add(Predicates.or(cardTypesPredicates));
|
||||
message += "you don't control";
|
||||
filterTarget.setMessage(message);
|
||||
TargetPermanent target = new TargetPermanent(filterTarget);
|
||||
target.setTargetController(enteringPermanent.getControllerId());
|
||||
ability.getTargets().add(target);
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksTriggeredAbility;
|
||||
|
@ -11,18 +10,23 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.DefendingPlayerControlsPredicate;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class CovetedPeacock extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
public static final FilterPermanent filter = new FilterCreaturePermanent("creature defending player controls");
|
||||
|
||||
static {
|
||||
filter.add(new DefendingPlayerControlsPredicate());
|
||||
}
|
||||
|
||||
public CovetedPeacock(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}{U}");
|
||||
|
@ -36,26 +40,12 @@ public final class CovetedPeacock extends CardImpl {
|
|||
|
||||
// Whenever Coveted Peacock attacks, you may goad target creature defending player controls.
|
||||
Ability ability = new AttacksTriggeredAbility(new GoadTargetEffect(), true, "Whenever {this} attacks, you may goad target creature defending player controls.");
|
||||
ability.addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("creature defending player controls")));
|
||||
originalId = ability.getOriginalId();
|
||||
ability.addTarget(new TargetPermanent(filter));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
public CovetedPeacock(final CovetedPeacock card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
ability.getTargets().clear();
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls");
|
||||
UUID defenderId = game.getCombat().getDefenderId(ability.getSourceId());
|
||||
filter.add(new ControllerIdPredicate(defenderId));
|
||||
TargetCreaturePermanent target = new TargetCreaturePermanent(filter);
|
||||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.ExileSourceCost;
|
||||
|
@ -15,14 +14,13 @@ import mage.constants.CardType;
|
|||
import mage.constants.Zone;
|
||||
import mage.target.common.TargetCardInGraveyard;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class CrookOfCondemnation extends CardImpl {
|
||||
|
||||
private UUID exileId = UUID.randomUUID();
|
||||
|
||||
public CrookOfCondemnation(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
@ -11,68 +10,42 @@ import mage.abilities.effects.common.DamageTargetEffect;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetAnyTarget;
|
||||
import mage.target.common.TargetOpponent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LoneFox
|
||||
|
||||
*/
|
||||
public final class CuombajjWitches extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
|
||||
public CuombajjWitches(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{B}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{B}{B}");
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.WIZARD);
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
//TODO: Make ability properly copiable
|
||||
// {T}: Cuombajj Witches deals 1 damage to any target and 1 damage to any target of an opponent's choice.
|
||||
Effect effect = new DamageTargetEffect(1);
|
||||
effect.setText("{this} deals 1 damage to any target and 1 damage to any target of an opponent's choice");
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new TapSourceCost());
|
||||
ability.addTarget(new TargetAnyTarget());
|
||||
ability.addTarget(new TargetAnyTarget());
|
||||
ability.setTargetAdjuster(CuombajjWitchesAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
originalId = ability.getOriginalId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if(ability.getOriginalId().equals(originalId)) {
|
||||
Player controller = game.getPlayer(ability.getControllerId());
|
||||
if(controller != null) {
|
||||
UUID opponentId = null;
|
||||
if(game.getOpponents(controller.getId()).size() > 1) {
|
||||
Target target = new TargetOpponent(true);
|
||||
if(controller.chooseTarget(Outcome.Neutral, target, ability, game)) {
|
||||
opponentId = target.getFirstTarget();
|
||||
}
|
||||
}
|
||||
else {
|
||||
opponentId = game.getOpponents(controller.getId()).iterator().next();
|
||||
}
|
||||
|
||||
if(opponentId != null) {
|
||||
ability.getTargets().get(1).setTargetController(opponentId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public CuombajjWitches(final CuombajjWitches card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -80,3 +53,26 @@ public final class CuombajjWitches extends CardImpl {
|
|||
return new CuombajjWitches(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum CuombajjWitchesAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
Player controller = game.getPlayer(ability.getControllerId());
|
||||
if (controller != null) {
|
||||
UUID opponentId = null;
|
||||
if (game.getOpponents(controller.getId()).size() > 1) {
|
||||
Target target = new TargetOpponent(true);
|
||||
if (controller.chooseTarget(Outcome.Neutral, target, ability, game)) {
|
||||
opponentId = target.getFirstTarget();
|
||||
}
|
||||
} else {
|
||||
opponentId = game.getOpponents(controller.getId()).iterator().next();
|
||||
}
|
||||
if (opponentId != null) {
|
||||
ability.getTargets().get(1).setTargetController(opponentId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,15 +1,10 @@
|
|||
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.AbilityType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
|
@ -18,9 +13,13 @@ import mage.game.permanent.Permanent;
|
|||
import mage.game.permanent.token.CurseOfTheSwineBoarToken;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class CurseOfTheSwine extends CardImpl {
|
||||
|
@ -31,15 +30,7 @@ public final class CurseOfTheSwine extends CardImpl {
|
|||
// Exile X target creatures. For each creature exiled this way, its controller creates a 2/2 green Boar creature token.
|
||||
this.getSpellAbility().addEffect(new CurseOfTheSwineEffect());
|
||||
// Correct number of targets will be set in adjustTargets
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility && ability.getAbilityType() == AbilityType.SPELL) {
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetCreaturePermanent(ability.getManaCostsToPay().getX()));
|
||||
}
|
||||
this.getSpellAbility().setTargetAdjuster(CurseOfTheSwineAdjuster.instance);
|
||||
}
|
||||
|
||||
public CurseOfTheSwine(final CurseOfTheSwine card) {
|
||||
|
@ -52,6 +43,16 @@ public final class CurseOfTheSwine extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum CurseOfTheSwineAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetCreaturePermanent(ability.getManaCostsToPay().getX()));
|
||||
}
|
||||
}
|
||||
|
||||
class CurseOfTheSwineEffect extends OneShotEffect {
|
||||
|
||||
public CurseOfTheSwineEffect() {
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksTriggeredAbility;
|
||||
|
@ -12,7 +8,10 @@ import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffec
|
|||
import mage.abilities.keyword.MeleeAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.predicate.Predicates;
|
||||
|
@ -23,16 +22,21 @@ import mage.game.events.GameEvent;
|
|||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author L_J
|
||||
*/
|
||||
public final class CustodiSoulcaller extends CardImpl {
|
||||
|
||||
public CustodiSoulcaller(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{W}{W}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}{W}");
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.CLERIC);
|
||||
this.power = new MageInt(1);
|
||||
|
@ -45,25 +49,10 @@ public final class CustodiSoulcaller extends CardImpl {
|
|||
Ability ability = new AttacksTriggeredAbility(new ReturnFromGraveyardToBattlefieldTargetEffect(), false);
|
||||
ability.addWatcher(new CustodiSoulcallerWatcher());
|
||||
ability.addTarget(new TargetCardInYourGraveyard(new FilterCreatureCard("creature card with converted mana cost X or less from your graveyard, where X is the number of players you attacked with a creature this combat")));
|
||||
ability.setTargetAdjuster(CustodiSoulcallerAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getClass().equals(AttacksTriggeredAbility.class)) {
|
||||
ability.getTargets().clear();
|
||||
CustodiSoulcallerWatcher watcher = game.getState().getWatcher(CustodiSoulcallerWatcher.class);
|
||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(ability.getSourceId());
|
||||
if (watcher != null && watcher.playersAttacked != null) {
|
||||
int xValue = watcher.getNumberOfAttackedPlayers(sourcePermanent.getControllerId());
|
||||
FilterCard filter = new FilterCard("creature card with converted mana cost " + xValue + " or less");
|
||||
filter.add(new CardTypePredicate(CardType.CREATURE));
|
||||
filter.add(Predicates.or(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue), new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, xValue)));
|
||||
ability.getTargets().add(new TargetCardInYourGraveyard(filter));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public CustodiSoulcaller(final CustodiSoulcaller card) {
|
||||
super(card);
|
||||
}
|
||||
|
@ -74,9 +63,27 @@ public final class CustodiSoulcaller extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum CustodiSoulcallerAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
CustodiSoulcallerWatcher watcher = (CustodiSoulcallerWatcher) game.getState().getWatchers().get(CustodiSoulcallerWatcher.class.getSimpleName());
|
||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(ability.getSourceId());
|
||||
if (watcher != null) {
|
||||
int xValue = watcher.getNumberOfAttackedPlayers(sourcePermanent.getControllerId());
|
||||
FilterCard filter = new FilterCard("creature card with converted mana cost " + xValue + " or less");
|
||||
filter.add(new CardTypePredicate(CardType.CREATURE));
|
||||
filter.add(Predicates.or(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue), new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, xValue)));
|
||||
ability.getTargets().add(new TargetCardInYourGraveyard(filter));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class CustodiSoulcallerWatcher extends Watcher {
|
||||
|
||||
protected final HashMap<UUID, Set<UUID>> playersAttacked = new HashMap<>(0);
|
||||
private final HashMap<UUID, Set<UUID>> playersAttacked = new HashMap<>(0);
|
||||
|
||||
CustodiSoulcallerWatcher() {
|
||||
super("CustodiSoulcallerWatcher", WatcherScope.GAME);
|
||||
|
@ -91,8 +98,7 @@ class CustodiSoulcallerWatcher extends Watcher {
|
|||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() == EventType.BEGIN_COMBAT_STEP_PRE) {
|
||||
this.playersAttacked.clear();
|
||||
}
|
||||
else if (event.getType() == EventType.ATTACKER_DECLARED) {
|
||||
} else if (event.getType() == EventType.ATTACKER_DECLARED) {
|
||||
Set<UUID> attackedPlayers = this.playersAttacked.getOrDefault(event.getPlayerId(), new HashSet<>(1));
|
||||
attackedPlayers.add(event.getTargetId());
|
||||
this.playersAttacked.put(event.getPlayerId(), attackedPlayers);
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
package mage.cards.d;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -13,35 +12,24 @@ import mage.filter.common.FilterCreatureCard;
|
|||
import mage.game.Game;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class DeathDenied extends CardImpl {
|
||||
|
||||
public DeathDenied(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{X}{B}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{X}{B}{B}");
|
||||
this.subtype.add(SubType.ARCANE);
|
||||
|
||||
// Return X target creature cards from your graveyard to your hand.
|
||||
Effect effect = new ReturnFromGraveyardToHandTargetEffect();
|
||||
effect.setText("Return X target creature cards from your graveyard to your hand");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(1, new FilterCreatureCard()));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
ability.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
Target target = new TargetCardInYourGraveyard(xValue, new FilterCreatureCard((xValue != 1 ? " creature cards" : "creature card") + " from your graveyard"));
|
||||
ability.addTarget(target);
|
||||
}
|
||||
this.getSpellAbility().setTargetAdjuster(DeathDeniedAdjuster.instance);
|
||||
}
|
||||
|
||||
public DeathDenied(final DeathDenied card) {
|
||||
|
@ -53,3 +41,15 @@ public final class DeathDenied extends CardImpl {
|
|||
return new DeathDenied(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum DeathDeniedAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
Target target = new TargetCardInYourGraveyard(xValue, new FilterCreatureCard(new StringBuilder(xValue).append(xValue != 1 ? " creature cards" : "creature card").append(" from your graveyard").toString()));
|
||||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -13,17 +11,16 @@ import mage.filter.StaticFilters;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
import mage.target.targetpointer.FirstTargetPointer;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LoneFox
|
||||
*
|
||||
*/
|
||||
public final class DeathMatch extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
|
||||
public DeathMatch(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{B}");
|
||||
|
||||
|
@ -32,24 +29,12 @@ public final class DeathMatch extends CardImpl {
|
|||
Ability ability = new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD, new DeathMatchEffect(),
|
||||
StaticFilters.FILTER_PERMANENT_CREATURE, false, SetTargetPointer.PLAYER, "");
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
ability.setTargetAdjuster(DeathMatchAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
originalId = ability.getOriginalId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
UUID controllerId = ability.getEffects().get(0).getTargetPointer().getFirst(game, ability);
|
||||
if (controllerId != null) {
|
||||
ability.getTargets().get(0).setTargetController(controllerId);
|
||||
ability.getEffects().get(0).setTargetPointer(new FirstTargetPointer());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public DeathMatch(final DeathMatch card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -58,6 +43,19 @@ public final class DeathMatch extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum DeathMatchAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
UUID controllerId = ability.getEffects().get(0).getTargetPointer().getFirst(game, ability);
|
||||
if (controllerId != null) {
|
||||
ability.getTargets().get(0).setTargetController(controllerId);
|
||||
ability.getEffects().get(0).setTargetPointer(new FirstTargetPointer());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class DeathMatchEffect extends OneShotEffect {
|
||||
|
||||
public DeathMatchEffect() {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksTriggeredAbility;
|
||||
|
@ -13,24 +12,29 @@ import mage.abilities.effects.common.counter.RemoveCounterTargetEffect;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.filter.predicate.permanent.DefendingPlayerControlsPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author spjspj
|
||||
*/
|
||||
public final class DecimatorBeetle extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
public static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls");
|
||||
|
||||
static {
|
||||
filter.add(new DefendingPlayerControlsPredicate());
|
||||
}
|
||||
|
||||
public DecimatorBeetle(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}{G}");
|
||||
|
@ -46,29 +50,14 @@ public final class DecimatorBeetle extends CardImpl {
|
|||
this.addAbility(ability);
|
||||
|
||||
// Whenever Decimator Beetle attacks, remove a -1/-1 counter from target creature you control and put a -1/-1 counter on up to one target creature defending player controls.
|
||||
Ability ability2 = new AttacksTriggeredAbility(new DecimatorBeetleEffect(), false);
|
||||
ability2.addTarget(new TargetControlledCreaturePermanent());
|
||||
ability2.addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("creature defending player controls")));
|
||||
this.addAbility(ability2);
|
||||
this.originalId = ability2.getOriginalId();
|
||||
ability = new AttacksTriggeredAbility(new DecimatorBeetleEffect(), false);
|
||||
ability.addTarget(new TargetControlledCreaturePermanent());
|
||||
ability.addTarget(new TargetCreaturePermanent(0, 1, filter, false));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
public DecimatorBeetle(final DecimatorBeetle card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetControlledCreaturePermanent());
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls");
|
||||
UUID defenderId = game.getCombat().getDefenderId(ability.getSourceId());
|
||||
filter.add(new ControllerIdPredicate(defenderId));
|
||||
TargetCreaturePermanent target = new TargetCreaturePermanent(0, 1, filter, false);
|
||||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.DamageTargetControllerEffect;
|
||||
|
@ -16,15 +14,17 @@ import mage.filter.common.FilterArtifactPermanent;
|
|||
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.target.common.TargetArtifactPermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LoneFox
|
||||
*/
|
||||
public final class Detonate extends CardImpl {
|
||||
|
||||
public Detonate(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{X}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{R}");
|
||||
|
||||
// Destroy target artifact with converted mana cost X. It can't be regenerated. Detonate deals X damage to that artifact's controller.
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect(true));
|
||||
|
@ -32,17 +32,7 @@ public final class Detonate extends CardImpl {
|
|||
Effect effect = new DamageTargetControllerEffect(new ManacostVariableValue());
|
||||
effect.setText("{this} deals X damage to that artifact's controller");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if(ability instanceof SpellAbility) {
|
||||
ability.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
FilterArtifactPermanent filter = new FilterArtifactPermanent("artifact with converted mana cost X");
|
||||
filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||
ability.addTarget(new TargetArtifactPermanent(filter));
|
||||
}
|
||||
this.getSpellAbility().setTargetAdjuster(DetonateAdjuster.instance);
|
||||
}
|
||||
|
||||
public Detonate(final Detonate card) {
|
||||
|
@ -54,3 +44,16 @@ public final class Detonate extends CardImpl {
|
|||
return new Detonate(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum DetonateAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
FilterArtifactPermanent filter = new FilterArtifactPermanent("artifact with converted mana cost X");
|
||||
filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||
ability.addTarget(new TargetArtifactPermanent(filter));
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -13,11 +12,7 @@ import mage.abilities.keyword.FlyingAbility;
|
|||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
|
@ -29,10 +24,12 @@ import mage.game.events.ZoneChangeEvent;
|
|||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetCardInOpponentsGraveyard;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class DiluvianPrimordial extends CardImpl {
|
||||
|
@ -48,24 +45,9 @@ public final class DiluvianPrimordial extends CardImpl {
|
|||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// When Diluvian Primordial enters the battlefield, for each opponent, you may cast up to one target instant or sorcery card from that player's graveyard without paying its mana cost. If a card cast this way would be put into a graveyard this turn, exile it instead.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new DiluvianPrimordialEffect(), false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof EntersBattlefieldTriggeredAbility) {
|
||||
ability.getTargets().clear();
|
||||
for (UUID opponentId : game.getOpponents(ability.getControllerId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
if (opponent != null) {
|
||||
FilterCard filter = new FilterCard("instant or sorcery card from " + opponent.getLogName() + "'s graveyard");
|
||||
filter.add(new OwnerIdPredicate(opponentId));
|
||||
filter.add(Predicates.or(new CardTypePredicate(CardType.INSTANT), new CardTypePredicate(CardType.SORCERY)));
|
||||
TargetCardInOpponentsGraveyard target = new TargetCardInOpponentsGraveyard(0, 1, filter);
|
||||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new DiluvianPrimordialEffect(), false);
|
||||
ability.setTargetAdjuster(DiluvianPrimordialAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
public DiluvianPrimordial(final DiluvianPrimordial card) {
|
||||
|
@ -78,6 +60,26 @@ public final class DiluvianPrimordial extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum DiluvianPrimordialAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
for (UUID opponentId : game.getOpponents(ability.getControllerId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
if (opponent == null) {
|
||||
continue;
|
||||
}
|
||||
FilterCard filter = new FilterCard("instant or sorcery card from " + opponent.getLogName() + "'s graveyard");
|
||||
filter.add(new OwnerIdPredicate(opponentId));
|
||||
filter.add(Predicates.or(new CardTypePredicate(CardType.INSTANT), new CardTypePredicate(CardType.SORCERY)));
|
||||
TargetCardInOpponentsGraveyard target = new TargetCardInOpponentsGraveyard(0, 1, filter);
|
||||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class DiluvianPrimordialEffect extends OneShotEffect {
|
||||
|
||||
public DiluvianPrimordialEffect() {
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -13,30 +11,21 @@ import mage.filter.common.FilterCreaturePermanent;
|
|||
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LoneFox
|
||||
*/
|
||||
public final class Disembowel extends CardImpl {
|
||||
|
||||
public Disembowel(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{X}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{X}{B}");
|
||||
|
||||
// Destroy target creature with converted mana cost X.
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect());
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("creature with converted mana cost X")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if(ability instanceof SpellAbility) {
|
||||
ability.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with converted mana cost X");
|
||||
filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||
ability.addTarget(new TargetCreaturePermanent(filter));
|
||||
}
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect("creature with converted mana cost X"));
|
||||
this.getSpellAbility().setTargetAdjuster(DisembowelAdjuster.instance);
|
||||
}
|
||||
|
||||
public Disembowel(final Disembowel card) {
|
||||
|
@ -48,3 +37,16 @@ public final class Disembowel extends CardImpl {
|
|||
return new Disembowel(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum DisembowelAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with converted mana cost X");
|
||||
filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||
ability.addTarget(new TargetCreaturePermanent(filter));
|
||||
}
|
||||
}
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.ReturnToHandTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -13,22 +11,23 @@ import mage.filter.common.FilterNonlandPermanent;
|
|||
import mage.game.Game;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetNonlandPermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class DistortingWake extends CardImpl {
|
||||
|
||||
public DistortingWake(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{X}{U}{U}{U}");
|
||||
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{U}{U}{U}");
|
||||
|
||||
// Return X target nonland permanents to their owners' hands.
|
||||
Effect effect = new ReturnToHandTargetEffect();
|
||||
effect.setText("Return X target nonland permanents to their owners' hands");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
this.getSpellAbility().addTarget(new TargetNonlandPermanent());
|
||||
this.getSpellAbility().setTargetAdjuster(DistortingWakeAdjuster.instance);
|
||||
}
|
||||
|
||||
public DistortingWake(final DistortingWake card) {
|
||||
|
@ -39,16 +38,17 @@ public final class DistortingWake extends CardImpl {
|
|||
public DistortingWake copy() {
|
||||
return new DistortingWake(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum DistortingWakeAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
Target target = new TargetNonlandPermanent(xValue, xValue,
|
||||
new FilterNonlandPermanent(xValue + " target nonland permanent(s)"), false);
|
||||
ability.getTargets().clear();
|
||||
ability.getTargets().add(target);
|
||||
}
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
Target target = new TargetNonlandPermanent(xValue, xValue,
|
||||
new FilterNonlandPermanent(xValue + " target nonland permanent(s)"), false);
|
||||
ability.getTargets().clear();
|
||||
ability.getTargets().add(target);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,9 +1,6 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -15,38 +12,43 @@ import mage.filter.predicate.Predicates;
|
|||
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fireshoes
|
||||
*/
|
||||
public final class Dominate extends CardImpl {
|
||||
|
||||
public Dominate(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{X}{1}{U}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{X}{1}{U}{U}");
|
||||
|
||||
// Gain control of target creature with converted mana cost X or less.
|
||||
this.getSpellAbility().addEffect(new GainControlTargetEffect(Duration.Custom, true));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("creature with converted mana cost X or less")));
|
||||
this.getSpellAbility().setTargetAdjuster(DominateAdjuster.instance);
|
||||
}
|
||||
|
||||
public Dominate(final Dominate card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if(ability instanceof SpellAbility) {
|
||||
ability.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with converted mana cost X or less");
|
||||
filter.add(Predicates.not(new ConvertedManaCostPredicate(ComparisonType.MORE_THAN, xValue)));
|
||||
ability.addTarget(new TargetCreaturePermanent(filter));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dominate copy() {
|
||||
return new Dominate(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum DominateAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with converted mana cost X or less");
|
||||
filter.add(Predicates.not(new ConvertedManaCostPredicate(ComparisonType.MORE_THAN, xValue)));
|
||||
ability.addTarget(new TargetCreaturePermanent(filter));
|
||||
}
|
||||
}
|
|
@ -1,15 +1,14 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.CostAdjuster;
|
||||
import mage.abilities.costs.common.RevealTargetFromHandCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.abilities.effects.common.InfoEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.AbilityType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
|
@ -22,23 +21,19 @@ import mage.target.common.TargetCardInHand;
|
|||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.watchers.common.DragonOnTheBattlefieldWhileSpellWasCastWatcher;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class DraconicRoar extends CardImpl {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("a Dragon card from your hand (you don't have to)");
|
||||
|
||||
static {
|
||||
filter.add(new SubtypePredicate(SubType.DRAGON));
|
||||
}
|
||||
|
||||
public DraconicRoar(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{R}");
|
||||
|
||||
// As an additional cost to cast Draconic Roar, you may reveal a Dragon card from your hand.
|
||||
this.getSpellAbility().addEffect(new InfoEffect("as an additional cost to cast this spell, you may reveal a Dragon card from your hand"));
|
||||
this.getSpellAbility().setCostAdjuster(DraconicRoarAdjuster.instance);
|
||||
|
||||
// Draconic Roar deals 3 damage to target creature. If you revealed a Dragon card or controlled a Dragon as you cast Draconic Roar, Draconic Roar deals 3 damage to that creature's controller.
|
||||
this.getSpellAbility().addEffect(new DamageTargetEffect(3));
|
||||
|
@ -47,18 +42,6 @@ public final class DraconicRoar extends CardImpl {
|
|||
this.getSpellAbility().addWatcher(new DragonOnTheBattlefieldWhileSpellWasCastWatcher());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
if (ability.getAbilityType() == AbilityType.SPELL) {
|
||||
Player controller = game.getPlayer(ability.getControllerId());
|
||||
if (controller != null) {
|
||||
if (controller.getHand().count(filter, game) > 0) {
|
||||
ability.addCost(new RevealTargetFromHandCost(new TargetCardInHand(0,1, filter)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public DraconicRoar(final DraconicRoar card) {
|
||||
super(card);
|
||||
}
|
||||
|
@ -69,6 +52,25 @@ public final class DraconicRoar extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum DraconicRoarAdjuster implements CostAdjuster {
|
||||
instance;
|
||||
|
||||
private static final FilterCard filter = new FilterCard("a Dragon card from your hand (you don't have to)");
|
||||
|
||||
static {
|
||||
filter.add(new SubtypePredicate(SubType.DRAGON));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
Player controller = game.getPlayer(ability.getControllerId());
|
||||
if (controller != null) {
|
||||
if (controller.getHand().count(filter, game) > 0) {
|
||||
ability.addCost(new RevealTargetFromHandCost(new TargetCardInHand(0, 1, filter)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class DraconicRoarEffect extends OneShotEffect {
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostAdjuster;
|
||||
import mage.abilities.costs.common.RevealTargetFromHandCost;
|
||||
import mage.abilities.decorator.ConditionalContinuousRuleModifyingEffect;
|
||||
import mage.abilities.effects.ContinuousRuleModifyingEffect;
|
||||
|
@ -25,23 +25,19 @@ import mage.game.stack.Spell;
|
|||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInHand;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class DragonlordsPrerogative extends CardImpl {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("a Dragon card from your hand");
|
||||
|
||||
static {
|
||||
filter.add(new SubtypePredicate(SubType.DRAGON));
|
||||
}
|
||||
|
||||
public DragonlordsPrerogative(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{4}{U}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{4}{U}{U}");
|
||||
|
||||
// As an additional cost to cast Dragonlord's Prerogative, you may reveal a Dragon card from your hand.
|
||||
this.getSpellAbility().addEffect(new InfoEffect("as an additional cost to cast this spell, you may reveal a Dragon card from your hand"));
|
||||
this.getSpellAbility().setCostAdjuster(DragonlordsPrerogativeAdjuster.instance);
|
||||
|
||||
// If you revealed a Dragon card or controlled a Dragon as you cast Dragonlord's Prerogative, Dragonlord's Prerogative can't be countered.
|
||||
Condition condition = new DragonlordsPrerogativeCondition();
|
||||
|
@ -56,16 +52,6 @@ public final class DragonlordsPrerogative extends CardImpl {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
Player controller = game.getPlayer(ability.getControllerId());
|
||||
if (controller != null) {
|
||||
if (controller.getHand().count(filter, game) > 0) {
|
||||
ability.addCost(new RevealTargetFromHandCost(new TargetCardInHand(0,1, filter)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public DragonlordsPrerogative(final DragonlordsPrerogative card) {
|
||||
super(card);
|
||||
}
|
||||
|
@ -76,6 +62,25 @@ public final class DragonlordsPrerogative extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum DragonlordsPrerogativeAdjuster implements CostAdjuster {
|
||||
instance;
|
||||
private static final FilterCard filter = new FilterCard("a Dragon card from your hand");
|
||||
|
||||
static {
|
||||
filter.add(new SubtypePredicate(SubType.DRAGON));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
Player controller = game.getPlayer(ability.getControllerId());
|
||||
if (controller != null) {
|
||||
if (controller.getHand().count(filter, game) > 0) {
|
||||
ability.addCost(new RevealTargetFromHandCost(new TargetCardInHand(0, 1, filter)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class DragonlordsPrerogativeCondition implements Condition {
|
||||
|
||||
private final static FilterControlledPermanent filter = new FilterControlledPermanent("Dragon");
|
||||
|
@ -89,7 +94,7 @@ class DragonlordsPrerogativeCondition implements Condition {
|
|||
boolean applies = false;
|
||||
Spell spell = game.getStack().getSpell(source.getSourceId());
|
||||
if (spell != null && spell.getSpellAbility() != null) {
|
||||
for(Cost cost: spell.getSpellAbility().getCosts()) {
|
||||
for (Cost cost : spell.getSpellAbility().getCosts()) {
|
||||
if (cost instanceof RevealTargetFromHandCost) {
|
||||
applies = !cost.getTargets().isEmpty();
|
||||
break;
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
|
@ -16,39 +13,25 @@ import mage.filter.predicate.Predicates;
|
|||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class DregsOfSorrow extends CardImpl {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("nonblack creatures");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.not(new ColorPredicate(ObjectColor.BLACK)));
|
||||
}
|
||||
|
||||
public DregsOfSorrow(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{X}{4}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{4}{B}");
|
||||
|
||||
|
||||
// Destroy X target nonblack creatures. Draw X cards.
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect("Destroy X target nonblack creatures"));
|
||||
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(new ManacostVariableValue()));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter));
|
||||
this.getSpellAbility().setTargetAdjuster(DregsOfSorrowAdjuster.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
ability.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
ability.addTarget(new TargetCreaturePermanent(xValue, xValue, filter, false));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public DregsOfSorrow(final DregsOfSorrow card) {
|
||||
super(card);
|
||||
}
|
||||
|
@ -58,3 +41,19 @@ public final class DregsOfSorrow extends CardImpl {
|
|||
return new DregsOfSorrow(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum DregsOfSorrowAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("nonblack creatures");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.not(new ColorPredicate(ObjectColor.BLACK)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
ability.addTarget(new TargetCreaturePermanent(xValue, xValue, filter, false));
|
||||
}
|
||||
}
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.condition.common.KickedCondition;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.Costs;
|
||||
|
@ -19,6 +17,7 @@ import mage.filter.common.FilterControlledLandPermanent;
|
|||
import mage.game.Game;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
import mage.target.common.TargetLandPermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -27,34 +26,38 @@ import mage.target.common.TargetLandPermanent;
|
|||
public final class DwarvenLandslide extends CardImpl {
|
||||
|
||||
public DwarvenLandslide(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{3}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{R}");
|
||||
|
||||
// Kicker-{2}{R}, Sacrifice a land.
|
||||
Costs<Cost> kickerCosts = new CostsImpl<>();
|
||||
kickerCosts.add(new ManaCostsImpl<>("{2}{R}"));
|
||||
kickerCosts.add(new SacrificeTargetCost(new TargetControlledPermanent(new FilterControlledLandPermanent("a land"))));
|
||||
this.addAbility(new KickerAbility(kickerCosts));
|
||||
|
||||
// Destroy target land. If Dwarven Landslide was kicked, destroy another target land.
|
||||
getSpellAbility().addEffect(new DestroyTargetEffect("Destroy target land. if this spell was kicked, destroy another target land"));
|
||||
getSpellAbility().addTarget(new TargetLandPermanent());
|
||||
getSpellAbility().setTargetAdjuster(DwarvenLandslideAdjuster.instance);
|
||||
}
|
||||
|
||||
public DwarvenLandslide(final DwarvenLandslide card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
if (KickedCondition.instance.apply(game, ability)) {
|
||||
ability.getTargets().clear();
|
||||
getSpellAbility().addTarget(new TargetLandPermanent(2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public DwarvenLandslide copy() {
|
||||
return new DwarvenLandslide(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum DwarvenLandslideAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (KickedCondition.instance.apply(game, ability)) {
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetLandPermanent(2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
|
||||
package mage.cards.e;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.combat.CantBlockTargetEffect;
|
||||
import mage.abilities.keyword.EternalizeAbility;
|
||||
import mage.abilities.keyword.HasteAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.PowerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class EarthshakerKhenra extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with power less than or equal to {this}'s power");
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with power less than or equal to this creature's power");
|
||||
|
||||
static {
|
||||
filter.add(EarthshakerKhenraPredicate.instance);
|
||||
}
|
||||
|
||||
public EarthshakerKhenra(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}");
|
||||
|
@ -46,32 +46,20 @@ public final class EarthshakerKhenra extends CardImpl {
|
|||
this.addAbility(HasteAbility.getInstance());
|
||||
|
||||
// When Earthshaker Khenra enters the battlefield, target creature with power less than or equal to Earthshaker Khenra's power can't block this turn.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new EarthshakerKhenraEffect());
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(
|
||||
new CantBlockTargetEffect(Duration.EndOfTurn)
|
||||
.setText("target creature with power less than or equal " +
|
||||
"to {this}'s power can't block this turn")
|
||||
);
|
||||
ability.addTarget(new TargetCreaturePermanent(filter));
|
||||
this.addAbility(ability);
|
||||
originalId = ability.getOriginalId();
|
||||
|
||||
// Eternalize {4}{R}{R}
|
||||
this.addAbility(new EternalizeAbility(new ManaCostsImpl("{4}{R}{R}"), this));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
Permanent sourcePermanent = game.getPermanent(ability.getSourceId());
|
||||
if (sourcePermanent != null) {
|
||||
FilterCreaturePermanent targetFilter = new FilterCreaturePermanent("creature with power less than or equal to " + getLogName() + "'s power");
|
||||
targetFilter.add(new PowerPredicate(ComparisonType.FEWER_THAN, sourcePermanent.getPower().getValue() + 1));
|
||||
ability.getTargets().clear();
|
||||
ability.getTargets().add(new TargetCreaturePermanent(targetFilter));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public EarthshakerKhenra(final EarthshakerKhenra card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -80,39 +68,12 @@ public final class EarthshakerKhenra extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class EarthshakerKhenraEffect extends OneShotEffect {
|
||||
|
||||
public EarthshakerKhenraEffect() {
|
||||
super(Outcome.UnboostCreature);
|
||||
this.staticText = "target creature with power less than or equal to {this}'s power can't block this turn";
|
||||
}
|
||||
|
||||
public EarthshakerKhenraEffect(final EarthshakerKhenraEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
enum EarthshakerKhenraPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Card>> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public EarthshakerKhenraEffect copy() {
|
||||
return new EarthshakerKhenraEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent sourceObject = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
if (sourceObject != null) {
|
||||
Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
/*
|
||||
27.06.2017 The target creature's power is checked when you target it with Earthshaker Khenra's ability
|
||||
and when that ability resolves. Once the ability resolves, if the creature's power increases
|
||||
or Earthshaker Khenra's power decreases, the target creature will still be unable to block.
|
||||
*/
|
||||
if (targetCreature != null && targetCreature.getPower().getValue() <= sourceObject.getPower().getValue()) {
|
||||
ContinuousEffect effect = new CantBlockTargetEffect(Duration.EndOfTurn);
|
||||
effect.setTargetPointer(new FixedTarget(targetCreature, game));
|
||||
game.addEffect(effect, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
public boolean apply(ObjectSourcePlayer<Card> input, Game game) {
|
||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(input.getSourceId());
|
||||
return sourcePermanent != null && input.getObject().getPower().getValue() <= sourcePermanent.getPower().getValue();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.e;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -9,11 +8,11 @@ import mage.abilities.effects.Effect;
|
|||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.AbilityType;
|
||||
import mage.constants.CardType;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -22,7 +21,7 @@ import mage.target.common.TargetCreaturePermanent;
|
|||
public final class EliminateTheCompetition extends CardImpl {
|
||||
|
||||
public EliminateTheCompetition(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{4}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{B}");
|
||||
|
||||
// As an additional cost to cast Eliminate the Competition, sacrifice X creatures.
|
||||
this.getSpellAbility().addCost(new SacrificeXTargetCost(new FilterControlledCreaturePermanent("creatures"), true));
|
||||
|
@ -32,23 +31,26 @@ public final class EliminateTheCompetition extends CardImpl {
|
|||
effect.setText("Destroy X target creatures");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
this.getSpellAbility().setTargetAdjuster(EliminateTheCompetitionAdjuster.instance);
|
||||
}
|
||||
|
||||
public EliminateTheCompetition(final EliminateTheCompetition card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getAbilityType() == AbilityType.SPELL) {
|
||||
ability.getTargets().clear();
|
||||
int sac = new GetXValue().calculate(game, ability, null);
|
||||
ability.addTarget(new TargetCreaturePermanent(sac, sac));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EliminateTheCompetition copy() {
|
||||
return new EliminateTheCompetition(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum EliminateTheCompetitionAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
int sac = new GetXValue().calculate(game, ability, null);
|
||||
ability.addTarget(new TargetCreaturePermanent(sac, sac));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
|
||||
package mage.cards.e;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.CostAdjuster;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
|
@ -25,8 +25,9 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class EliteArcanist extends CardImpl {
|
||||
|
@ -45,6 +46,7 @@ public final class EliteArcanist extends CardImpl {
|
|||
// {X}, {T}: Copy the exiled card. You may cast the copy without paying its mana cost. X is the converted mana cost of the exiled card.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new EliteArcanistCopyEffect(), new ManaCostsImpl("{X}"));
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.setCostAdjuster(EliteArcanistAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
@ -52,29 +54,35 @@ public final class EliteArcanist extends CardImpl {
|
|||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
if (ability instanceof SimpleActivatedAbility) {
|
||||
Permanent sourcePermanent = game.getPermanent(ability.getSourceId());
|
||||
if (sourcePermanent != null && sourcePermanent.getImprinted() != null && !sourcePermanent.getImprinted().isEmpty()) {
|
||||
Card imprintedInstant = game.getCard(sourcePermanent.getImprinted().get(0));
|
||||
if (imprintedInstant != null) {
|
||||
int cmc = imprintedInstant.getConvertedManaCost();
|
||||
if (cmc > 0) {
|
||||
ability.getManaCostsToPay().clear();
|
||||
ability.getManaCostsToPay().add(new GenericManaCost(cmc));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EliteArcanist copy() {
|
||||
return new EliteArcanist(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum EliteArcanistAdjuster implements CostAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
Permanent sourcePermanent = game.getPermanent(ability.getSourceId());
|
||||
if (sourcePermanent == null
|
||||
|| sourcePermanent.getImprinted() == null
|
||||
|| sourcePermanent.getImprinted().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Card imprintedInstant = game.getCard(sourcePermanent.getImprinted().get(0));
|
||||
if (imprintedInstant == null) {
|
||||
return;
|
||||
}
|
||||
int cmc = imprintedInstant.getConvertedManaCost();
|
||||
if (cmc > 0) {
|
||||
ability.getManaCostsToPay().clear();
|
||||
ability.getManaCostsToPay().add(new GenericManaCost(cmc));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class EliteArcanistImprintEffect extends OneShotEffect {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("instant card from your hand");
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
|
||||
package mage.cards.e;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksCreatureYouControlTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.TapTargetEffect;
|
||||
import mage.abilities.effects.keyword.BolsterEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -16,25 +14,29 @@ import mage.constants.SubType;
|
|||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.filter.predicate.permanent.CounterPredicate;
|
||||
import mage.filter.predicate.permanent.DefendingPlayerControlsPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author emerald000
|
||||
*/
|
||||
public final class EliteScaleguard extends CardImpl {
|
||||
|
||||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("creature you control with a +1/+1 counter on it");
|
||||
private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent("creature defending player controls");
|
||||
|
||||
static {
|
||||
filter.add(new CounterPredicate(CounterType.P1P1));
|
||||
filter2.add(new DefendingPlayerControlsPredicate());
|
||||
}
|
||||
|
||||
public EliteScaleguard(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{W}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{W}");
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.SOLDIER);
|
||||
this.power = new MageInt(2);
|
||||
|
@ -45,7 +47,7 @@ public final class EliteScaleguard extends CardImpl {
|
|||
|
||||
// Whenever a creature you control with a +1/+1 counter on it attacks, tap target creature defending player controls.
|
||||
Ability ability = new AttacksCreatureYouControlTriggeredAbility(new EliteScaleguardTapEffect(), false, filter, true);
|
||||
ability.addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("creature defending player controls")));
|
||||
ability.addTarget(new TargetCreaturePermanent(filter2));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
@ -53,22 +55,6 @@ public final class EliteScaleguard extends CardImpl {
|
|||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof AttacksCreatureYouControlTriggeredAbility) {
|
||||
FilterCreaturePermanent filterDefender = new FilterCreaturePermanent("creature defending player controls");
|
||||
for (Effect effect : ability.getEffects()) {
|
||||
if (effect instanceof EliteScaleguardTapEffect) {
|
||||
filterDefender.add(new ControllerIdPredicate(game.getCombat().getDefendingPlayerId(effect.getTargetPointer().getFirst(game, ability), game)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
ability.getTargets().clear();
|
||||
TargetCreaturePermanent target = new TargetCreaturePermanent(filterDefender);
|
||||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EliteScaleguard copy() {
|
||||
return new EliteScaleguard(this);
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
package mage.cards.e;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -14,38 +12,45 @@ import mage.filter.common.FilterCreaturePermanent;
|
|||
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class EntrancingMelody extends CardImpl {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with converted mana cost X");
|
||||
|
||||
public EntrancingMelody(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{U}{U}");
|
||||
|
||||
// Gain control of target creature with converted mana cost X.
|
||||
this.getSpellAbility().addEffect(new GainControlTargetEffect(Duration.Custom, true));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("creature with converted mana cost X")));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter));
|
||||
this.getSpellAbility().setTargetAdjuster(EntrancingMelodyAdjuster.instance);
|
||||
}
|
||||
|
||||
public EntrancingMelody(final EntrancingMelody card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
ability.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with converted mana cost X");
|
||||
filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||
ability.addTarget(new TargetCreaturePermanent(filter));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntrancingMelody copy() {
|
||||
return new EntrancingMelody(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum EntrancingMelodyAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with converted mana cost " + xValue);
|
||||
filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||
ability.addTarget(new TargetCreaturePermanent(filter));
|
||||
}
|
||||
}
|
|
@ -2,7 +2,6 @@ package mage.cards.e;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect;
|
||||
import mage.abilities.keyword.MiracleAbility;
|
||||
|
@ -14,6 +13,7 @@ import mage.filter.common.FilterCreatureCard;
|
|||
import mage.game.Game;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -27,25 +27,10 @@ public final class EntreatTheDead extends CardImpl {
|
|||
// Return X target creature cards from your graveyard to the battlefield.
|
||||
this.getSpellAbility().addEffect(new ReturnFromGraveyardToBattlefieldTargetEffect());
|
||||
this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(1, StaticFilters.FILTER_CARD_CREATURE));
|
||||
this.getSpellAbility().setTargetAdjuster(EntreatTheDeadAdjuster.instance);
|
||||
|
||||
// Miracle {X}{B}{B}
|
||||
this.addAbility(new MiracleAbility(this, new ManaCostsImpl("{X}{B}{B}")));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
ability.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
String filterName = xValue
|
||||
+ (xValue != 1 ? " creature cards" : "creature card")
|
||||
+ " from your graveyard";
|
||||
Target target = new TargetCardInYourGraveyard(
|
||||
xValue, new FilterCreatureCard(filterName)
|
||||
);
|
||||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
|
||||
public EntreatTheDead(final EntreatTheDead card) {
|
||||
|
@ -57,3 +42,20 @@ public final class EntreatTheDead extends CardImpl {
|
|||
return new EntreatTheDead(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum EntreatTheDeadAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
String filterName = xValue
|
||||
+ (xValue != 1 ? " creature cards" : "creature card")
|
||||
+ " from your graveyard";
|
||||
Target target = new TargetCardInYourGraveyard(
|
||||
xValue, new FilterCreatureCard(filterName)
|
||||
);
|
||||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.f;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -16,38 +15,30 @@ import mage.filter.common.FilterControlledLandPermanent;
|
|||
import mage.game.Game;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LoneFox
|
||||
|
||||
*
|
||||
*/
|
||||
public final class FallingTimber extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
|
||||
public FallingTimber(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{G}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{G}");
|
||||
|
||||
// Kicker-Sacrifice a land.
|
||||
this.addAbility(new KickerAbility(new SacrificeTargetCost(new TargetControlledPermanent(1, 1, new FilterControlledLandPermanent("a land"), true))));
|
||||
|
||||
// Prevent all combat damage target creature would deal this turn. If Falling Timber was kicked, prevent all combat damage another target creature would deal this turn.
|
||||
Effect effect = new PreventDamageByTargetEffect(Duration.EndOfTurn, true);
|
||||
effect.setText("Prevent all combat damage target creature would deal this turn. if this spell was kicked, prevent all combat damage another target creature would deal this turn.");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
originalId = this.getSpellAbility().getOriginalId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if(ability.getOriginalId().equals(originalId)) {
|
||||
ability.addTarget(new TargetCreaturePermanent(KickedCondition.instance.apply(game, ability) ? 2 : 1));
|
||||
}
|
||||
this.getSpellAbility().setTargetAdjuster(FallingTimberAdjuster.instance);
|
||||
}
|
||||
|
||||
public FallingTimber(final FallingTimber card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -55,3 +46,13 @@ public final class FallingTimber extends CardImpl {
|
|||
return new FallingTimber(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum FallingTimberAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetCreaturePermanent(KickedCondition.instance.apply(game, ability) ? 2 : 1));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
package mage.cards.f;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.condition.common.KickedCondition;
|
||||
import mage.abilities.decorator.ConditionalOneShotEffect;
|
||||
import mage.abilities.effects.common.DamageMultiEffect;
|
||||
|
@ -16,6 +14,7 @@ import mage.game.Game;
|
|||
import mage.target.common.TargetAnyTarget;
|
||||
import mage.target.common.TargetAnyTargetAmount;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -39,26 +38,29 @@ public final class FightWithFire extends CardImpl {
|
|||
+ "<i> (Those targets can include players and planeswalkers.)</i>"
|
||||
));
|
||||
this.getSpellAbility().addTarget(new TargetAnyTarget());
|
||||
this.getSpellAbility().setTargetAdjuster(FightWithFireAdjuster.instance);
|
||||
}
|
||||
|
||||
public FightWithFire(final FightWithFire card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
if (ability instanceof SpellAbility) {
|
||||
if (KickedCondition.instance.apply(game, ability)) {
|
||||
ability.addTarget(new TargetAnyTargetAmount(10));
|
||||
} else {
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FightWithFire copy() {
|
||||
return new FightWithFire(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum FightWithFireAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
if (KickedCondition.instance.apply(game, ability)) {
|
||||
ability.addTarget(new TargetAnyTargetAmount(10));
|
||||
} else {
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
package mage.cards.f;
|
||||
|
||||
import java.util.*;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.CostAdjuster;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -14,8 +14,9 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.target.common.TargetAnyTarget;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public final class Fireball extends CardImpl {
|
||||
|
@ -27,14 +28,7 @@ public final class Fireball extends CardImpl {
|
|||
// Fireball costs 1 more to cast for each target beyond the first.
|
||||
this.getSpellAbility().addTarget(new FireballTargetCreatureOrPlayer(0, Integer.MAX_VALUE));
|
||||
this.getSpellAbility().addEffect(new FireballEffect());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
int numTargets = ability.getTargets().isEmpty() ? 0 : ability.getTargets().get(0).getTargets().size();
|
||||
if (numTargets > 1) {
|
||||
ability.getManaCostsToPay().add(new GenericManaCost(numTargets - 1));
|
||||
}
|
||||
this.getSpellAbility().setCostAdjuster(FireballAdjuster.instance);
|
||||
}
|
||||
|
||||
public Fireball(final Fireball card) {
|
||||
|
@ -47,6 +41,18 @@ public final class Fireball extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum FireballAdjuster implements CostAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
int numTargets = ability.getTargets().isEmpty() ? 0 : ability.getTargets().get(0).getTargets().size();
|
||||
if (numTargets > 1) {
|
||||
ability.getManaCostsToPay().add(new GenericManaCost(numTargets - 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class FireballEffect extends OneShotEffect {
|
||||
|
||||
public FireballEffect() {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.f;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -16,6 +15,7 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetAnyTarget;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -24,19 +24,28 @@ import mage.target.common.TargetAnyTarget;
|
|||
public final class Firestorm extends CardImpl {
|
||||
|
||||
public Firestorm(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{R}");
|
||||
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{R}");
|
||||
|
||||
// As an additional cost to cast Firestorm, discard X cards.
|
||||
this.getSpellAbility().addCost(new DiscardXTargetCost(new FilterCard("cards"), true));
|
||||
// Firestorm deals X damage to each of X target creatures and/or players.
|
||||
this.getSpellAbility().addEffect(new FirestormEffect());
|
||||
this.getSpellAbility().setTargetAdjuster(FirestormAdjuster.instance);
|
||||
}
|
||||
|
||||
public Firestorm(final Firestorm card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Firestorm copy() {
|
||||
return new Firestorm(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum FirestormAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
int xValue = new GetXValue().calculate(game, ability, null);
|
||||
|
@ -45,11 +54,6 @@ public final class Firestorm extends CardImpl {
|
|||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Firestorm copy() {
|
||||
return new Firestorm(this);
|
||||
}
|
||||
}
|
||||
|
||||
class FirestormEffect extends OneShotEffect {
|
||||
|
@ -86,9 +90,6 @@ class FirestormEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public FirestormEffect copy() {
|
||||
return new FirestormEffect(this);
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
|
||||
package mage.cards.f;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.CostAdjuster;
|
||||
import mage.abilities.costs.common.RevealTargetFromHandCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.InfoEffect;
|
||||
import mage.abilities.effects.common.SacrificeEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.AbilityType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
|
@ -22,23 +21,19 @@ import mage.target.TargetPlayer;
|
|||
import mage.target.common.TargetCardInHand;
|
||||
import mage.watchers.common.DragonOnTheBattlefieldWhileSpellWasCastWatcher;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class FoulTongueInvocation extends CardImpl {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("a Dragon card from your hand (you don't have to)");
|
||||
|
||||
static {
|
||||
filter.add(new SubtypePredicate(SubType.DRAGON));
|
||||
}
|
||||
|
||||
public FoulTongueInvocation(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{B}");
|
||||
|
||||
// As an additional cost to cast Foul-Tongue Invocation, you may reveal a Dragon card from your hand.
|
||||
this.getSpellAbility().addEffect(new InfoEffect("as an additional cost to cast this spell, you may reveal a Dragon card from your hand"));
|
||||
this.getSpellAbility().setCostAdjuster(FoulTongueInvocationAdjuster.instance);
|
||||
|
||||
// Target player sacrifices a creature. If you revealed a Dragon card or controlled a Dragon as you cast Foul-Tongue Invocation, you gain 4 life.
|
||||
this.getSpellAbility().addTarget(new TargetPlayer());
|
||||
|
@ -47,18 +42,6 @@ public final class FoulTongueInvocation extends CardImpl {
|
|||
this.getSpellAbility().addWatcher(new DragonOnTheBattlefieldWhileSpellWasCastWatcher());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
if (ability.getAbilityType() == AbilityType.SPELL) {
|
||||
Player controller = game.getPlayer(ability.getControllerId());
|
||||
if (controller != null) {
|
||||
if (controller.getHand().count(filter, game) > 0) {
|
||||
ability.addCost(new RevealTargetFromHandCost(new TargetCardInHand(0, 1, filter)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FoulTongueInvocation(final FoulTongueInvocation card) {
|
||||
super(card);
|
||||
}
|
||||
|
@ -69,6 +52,25 @@ public final class FoulTongueInvocation extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum FoulTongueInvocationAdjuster implements CostAdjuster {
|
||||
instance;
|
||||
private static final FilterCard filter = new FilterCard("a Dragon card from your hand (you don't have to)");
|
||||
|
||||
static {
|
||||
filter.add(new SubtypePredicate(SubType.DRAGON));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
Player controller = game.getPlayer(ability.getControllerId());
|
||||
if (controller != null) {
|
||||
if (controller.getHand().count(filter, game) > 0) {
|
||||
ability.addCost(new RevealTargetFromHandCost(new TargetCardInHand(0, 1, filter)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class FoulTongueInvocationEffect extends OneShotEffect {
|
||||
|
||||
public FoulTongueInvocationEffect() {
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
package mage.cards.g;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
import mage.abilities.keyword.AssistAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -14,9 +12,11 @@ import mage.filter.common.FilterCreaturePermanent;
|
|||
import mage.filter.predicate.mageobject.PowerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class GangUp extends CardImpl {
|
||||
|
@ -28,27 +28,29 @@ public final class GangUp extends CardImpl {
|
|||
this.addAbility(new AssistAbility());
|
||||
|
||||
// Destroy target creature with power X or less.
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect());
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("creature with power X or less")));
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect("destroy target creature with power X or less"));
|
||||
this.getSpellAbility().setTargetAdjuster(GangUpAdjuster.instance);
|
||||
}
|
||||
|
||||
public GangUp(final GangUp card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
ability.getTargets().clear();
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with power " + xValue + " or less");
|
||||
filter.add(new PowerPredicate(ComparisonType.FEWER_THAN, xValue + 1));
|
||||
ability.addTarget(new TargetCreaturePermanent(filter));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public GangUp copy() {
|
||||
return new GangUp(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum GangUpAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
ability.getTargets().clear();
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with power " + xValue + " or less");
|
||||
filter.add(new PowerPredicate(ComparisonType.FEWER_THAN, xValue + 1));
|
||||
ability.addTarget(new TargetCreaturePermanent(filter));
|
||||
}
|
||||
}
|
|
@ -1,20 +1,21 @@
|
|||
|
||||
package mage.cards.g;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.effects.common.TapTargetEffect;
|
||||
import mage.abilities.effects.keyword.ScryEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import static mage.filter.StaticFilters.FILTER_PERMANENT_CREATURES;
|
||||
import mage.game.Game;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import static mage.filter.StaticFilters.FILTER_PERMANENT_CREATURES;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class GlimpseTheSunGod extends CardImpl {
|
||||
|
@ -24,26 +25,27 @@ public final class GlimpseTheSunGod extends CardImpl {
|
|||
|
||||
// Tap X target creatures. Scry 1.
|
||||
this.getSpellAbility().addEffect(new TapTargetEffect("X target creatures"));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, 1, FILTER_PERMANENT_CREATURES, false));
|
||||
this.getSpellAbility().addEffect(new ScryEffect(1));
|
||||
this.getSpellAbility().setTargetAdjuster(GlimpseTheSunGodAdjuster.instance);
|
||||
}
|
||||
|
||||
public GlimpseTheSunGod(final GlimpseTheSunGod card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
ability.getTargets().clear();
|
||||
int numberToTap = ability.getManaCostsToPay().getX();
|
||||
numberToTap = Math.min(game.getBattlefield().count(FILTER_PERMANENT_CREATURES, ability.getSourceId(), ability.getControllerId(), game), numberToTap);
|
||||
ability.addTarget(new TargetCreaturePermanent(numberToTap, numberToTap, FILTER_PERMANENT_CREATURES, false));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public GlimpseTheSunGod copy() {
|
||||
return new GlimpseTheSunGod(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum GlimpseTheSunGodAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
int numberToTap = ability.getManaCostsToPay().getX();
|
||||
ability.addTarget(new TargetCreaturePermanent(numberToTap, numberToTap, FILTER_PERMANENT_CREATURES, false));
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.g;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.common.KickedCondition;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
|
@ -19,19 +18,28 @@ import mage.game.Game;
|
|||
import mage.target.common.TargetControlledPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.common.TargetPlayerOrPlaneswalker;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class GoblinBarrage extends CardImpl {
|
||||
|
||||
private static final FilterControlledPermanent filter = new FilterControlledPermanent("an artifact or Goblin");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.or(
|
||||
new CardTypePredicate(CardType.ARTIFACT),
|
||||
new SubtypePredicate(SubType.GOBLIN)
|
||||
));
|
||||
}
|
||||
|
||||
public GoblinBarrage(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{R}");
|
||||
|
||||
// Kicker—Sacrifice an artifact or Goblin.
|
||||
FilterControlledPermanent filter = new FilterControlledPermanent("an artifact or Goblin");
|
||||
filter.add(Predicates.or(new CardTypePredicate(CardType.ARTIFACT), new SubtypePredicate(SubType.GOBLIN)));
|
||||
this.addAbility(new KickerAbility(new SacrificeTargetCost(new TargetControlledPermanent(filter))));
|
||||
|
||||
// Goblin Barrage deals 4 damage to target creature. If this spell was kicked, it also deals 4 damage to target player or planeswalker.
|
||||
|
@ -40,13 +48,7 @@ public final class GoblinBarrage extends CardImpl {
|
|||
+ "it also deals 4 damage to target player or planeswalker")
|
||||
);
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (KickedCondition.instance.apply(game, ability)) {
|
||||
ability.addTarget(new TargetPlayerOrPlaneswalker());
|
||||
}
|
||||
this.getSpellAbility().setTargetAdjuster(GoblinBarrageAdjuster.instance);
|
||||
}
|
||||
|
||||
public GoblinBarrage(final GoblinBarrage card) {
|
||||
|
@ -58,3 +60,14 @@ public final class GoblinBarrage extends CardImpl {
|
|||
return new GoblinBarrage(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum GoblinBarrageAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (KickedCondition.instance.apply(game, ability)) {
|
||||
ability.addTarget(new TargetPlayerOrPlaneswalker());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,8 +1,6 @@
|
|||
|
||||
package mage.cards.g;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksTriggeredAbility;
|
||||
|
@ -12,16 +10,21 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.filter.predicate.permanent.DefendingPlayerControlsPredicate;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class GoblinRacketeer extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls");
|
||||
|
||||
static {
|
||||
filter.add(new DefendingPlayerControlsPredicate());
|
||||
}
|
||||
|
||||
public GoblinRacketeer(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}");
|
||||
|
@ -33,27 +36,12 @@ public final class GoblinRacketeer extends CardImpl {
|
|||
|
||||
// Whenever Goblin Racketeer attacks, you may goad target creature defending player controls.
|
||||
Ability ability = new AttacksTriggeredAbility(new GoadTargetEffect(), true, "Whenever {this} attacks, you may goad target creature defending player controls");
|
||||
ability.addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("creature defending player controls")));
|
||||
originalId = ability.getOriginalId();
|
||||
ability.addTarget(new TargetCreaturePermanent(filter));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
public GoblinRacketeer(final GoblinRacketeer card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
ability.getTargets().clear();
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls");
|
||||
UUID defenderId = game.getCombat().getDefenderId(ability.getSourceId());
|
||||
filter.add(new ControllerIdPredicate(defenderId));
|
||||
TargetCreaturePermanent target = new TargetCreaturePermanent(filter);
|
||||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.g;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.delayed.OnLeaveReturnExiledToBattlefieldAbility;
|
||||
|
@ -23,10 +22,12 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fireshoes
|
||||
*/
|
||||
public final class GraspOfFate extends CardImpl {
|
||||
|
@ -36,8 +37,8 @@ public final class GraspOfFate extends CardImpl {
|
|||
|
||||
// When Grasp of Fate enters the battlefield, for each opponent, exile up to one target nonland permanent that player controls until Grasp of Fate leaves the battlefield.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new GraspOfFateExileEffect());
|
||||
ability.addTarget(new TargetPermanent());
|
||||
ability.addEffect(new CreateDelayedTriggeredAbilityEffect(new OnLeaveReturnExiledToBattlefieldAbility()));
|
||||
ability.setTargetAdjuster(GraspOfFateAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
@ -45,29 +46,32 @@ public final class GraspOfFate extends CardImpl {
|
|||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof EntersBattlefieldTriggeredAbility) {
|
||||
ability.getTargets().clear();
|
||||
for (UUID opponentId : game.getOpponents(ability.getControllerId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
if (opponent != null) {
|
||||
FilterPermanent filter = new FilterPermanent("nonland permanent from opponent " + opponent.getLogName());
|
||||
filter.add(new ControllerIdPredicate(opponentId));
|
||||
filter.add(Predicates.not(new CardTypePredicate(CardType.LAND)));
|
||||
TargetPermanent target = new TargetPermanent(0, 1, filter, false);
|
||||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraspOfFate copy() {
|
||||
return new GraspOfFate(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum GraspOfFateAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
for (UUID opponentId : game.getOpponents(ability.getControllerId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
if (opponent == null) {
|
||||
continue;
|
||||
}
|
||||
FilterPermanent filter = new FilterPermanent("nonland permanent from opponent " + opponent.getLogName());
|
||||
filter.add(new ControllerIdPredicate(opponentId));
|
||||
filter.add(Predicates.not(new CardTypePredicate(CardType.LAND)));
|
||||
TargetPermanent target = new TargetPermanent(0, 1, filter, false);
|
||||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class GraspOfFateExileEffect extends OneShotEffect {
|
||||
|
||||
public GraspOfFateExileEffect() {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.g;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksTriggeredAbility;
|
||||
|
@ -11,20 +10,22 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.other.OwnerIdPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.filter.predicate.permanent.DefendingPlayerOwnsCardPredicate;
|
||||
import mage.target.common.TargetCardInGraveyard;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class GravenAbomination extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
private static final String rule = "Whenever {this} attacks, exile target card from defending player's graveyard.";
|
||||
private static final FilterCard filter = new FilterCard("card from defending player's graveyard");
|
||||
|
||||
private final static String rule = "Whenever {this} attacks, exile target card from defending player's graveyard.";
|
||||
static {
|
||||
filter.add(new DefendingPlayerOwnsCardPredicate());
|
||||
}
|
||||
|
||||
public GravenAbomination(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{3}");
|
||||
|
@ -35,30 +36,12 @@ public final class GravenAbomination extends CardImpl {
|
|||
|
||||
// Whenever Graven Abomination attacks, exile target card from defending player's graveyard.
|
||||
Ability ability = new AttacksTriggeredAbility(new ExileTargetEffect(), false, rule);
|
||||
ability.addTarget(new TargetCardInGraveyard());
|
||||
ability.addTarget(new TargetCardInGraveyard(filter));
|
||||
this.addAbility(ability);
|
||||
originalId = ability.getOriginalId();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
UUID gravenAbominationId = ability.getSourceId();
|
||||
FilterCard filter = new FilterCard("target card from defending player's graveyard");
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
UUID defendingPlayerId = game.getCombat().getDefendingPlayerId(gravenAbominationId, game);
|
||||
Player defendingPlayer = game.getPlayer(defendingPlayerId);
|
||||
if (defendingPlayer != null) {
|
||||
filter.add(new OwnerIdPredicate(defendingPlayerId));
|
||||
ability.getTargets().clear();
|
||||
ability.getTargets().add(new TargetCardInGraveyard(filter));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public GravenAbomination(final GravenAbomination card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
package mage.cards.g;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.effects.common.TapTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -11,41 +9,40 @@ import mage.constants.CardType;
|
|||
import mage.filter.common.FilterNonlandPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class Gridlock extends CardImpl {
|
||||
private static final FilterNonlandPermanent filter = new FilterNonlandPermanent("nonland permanents");
|
||||
|
||||
public Gridlock(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{X}{U}");
|
||||
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{X}{U}");
|
||||
|
||||
// Tap X target nonland permanents.
|
||||
this.getSpellAbility().addEffect(new TapTargetEffect());
|
||||
// Correct number of targets will be set in adjustTargets
|
||||
this.getSpellAbility().addTarget(new TargetPermanent(0, 1,filter, false));
|
||||
|
||||
this.getSpellAbility().addEffect(new TapTargetEffect("X target nonland permanents"));
|
||||
this.getSpellAbility().setTargetAdjuster(GridlockAdjuster.instance);
|
||||
}
|
||||
|
||||
public Gridlock(final Gridlock card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
ability.getTargets().clear();
|
||||
int numberToTap = ability.getManaCostsToPay().getX();
|
||||
numberToTap = Math.min(game.getBattlefield().count(filter, ability.getSourceId(), ability.getControllerId(), game), numberToTap);
|
||||
ability.addTarget(new TargetPermanent(numberToTap, filter));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Gridlock copy() {
|
||||
return new Gridlock(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum GridlockAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
private static final FilterNonlandPermanent filter = new FilterNonlandPermanent("nonland permanents");
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter));
|
||||
}
|
||||
}
|
|
@ -1,9 +1,6 @@
|
|||
|
||||
package mage.cards.g;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.Effect;
|
||||
|
@ -17,10 +14,14 @@ import mage.filter.predicate.Predicates;
|
|||
import mage.filter.predicate.mageobject.CardIdPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.target.common.TargetCardInGraveyard;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
import mage.watchers.common.CardsPutIntoGraveyardWatcher;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class GrimReturn extends CardImpl {
|
||||
|
@ -28,13 +29,13 @@ public final class GrimReturn extends CardImpl {
|
|||
private static final String textFilter = "creature card in a graveyard that was put there from the battlefield this turn";
|
||||
|
||||
public GrimReturn(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{B}");
|
||||
|
||||
// Choose target creature card in a graveyard that was put there from the battlefield this turn. Put that card onto the battlefield under your control.
|
||||
Effect effect = new ReturnFromGraveyardToBattlefieldTargetEffect();
|
||||
effect.setText("Choose target creature card in a graveyard that was put there from the battlefield this turn. Put that card onto the battlefield under your control");
|
||||
this.getSpellAbility().addEffect(new ReturnFromGraveyardToBattlefieldTargetEffect());
|
||||
this.getSpellAbility().addTarget(new TargetCardInGraveyard(new FilterCreatureCard(textFilter)));
|
||||
this.getSpellAbility().setTargetAdjuster(GrimReturnAdjuster.instance);
|
||||
this.getSpellAbility().addWatcher(new CardsPutIntoGraveyardWatcher());
|
||||
}
|
||||
|
||||
|
@ -46,22 +47,27 @@ public final class GrimReturn extends CardImpl {
|
|||
public GrimReturn copy() {
|
||||
return new GrimReturn(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum GrimReturnAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
private static final String textFilter = "creature card in a graveyard that was put there from the battlefield this turn";
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
CardsPutIntoGraveyardWatcher watcher = game.getState().getWatcher(CardsPutIntoGraveyardWatcher.class);
|
||||
if (watcher != null) {
|
||||
FilterCard filter = new FilterCreatureCard(textFilter);
|
||||
List<CardIdPredicate> uuidPredicates = new ArrayList<>();
|
||||
for (MageObjectReference mor : watcher.getCardsPutToGraveyardFromBattlefield()) {
|
||||
if (game.getState().getZoneChangeCounter(mor.getSourceId()) == mor.getZoneChangeCounter()) {
|
||||
uuidPredicates.add(new CardIdPredicate(mor.getSourceId()));
|
||||
}
|
||||
}
|
||||
filter.add(Predicates.or(uuidPredicates));
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetCardInGraveyard(filter));
|
||||
if (watcher == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
FilterCard filter = new FilterCreatureCard(textFilter);
|
||||
List<CardIdPredicate> uuidPredicates = new ArrayList<>();
|
||||
for (MageObjectReference mor : watcher.getCardsPutToGraveyardFromBattlefield()) {
|
||||
if (mor.zoneCounterIsCurrent(game)) {
|
||||
uuidPredicates.add(new CardIdPredicate(mor.getSourceId()));
|
||||
}
|
||||
}
|
||||
filter.add(Predicates.or(uuidPredicates));
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetCardInGraveyard(filter));
|
||||
}
|
||||
}
|
|
@ -1,12 +1,8 @@
|
|||
|
||||
package mage.cards.h;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -21,10 +17,14 @@ import mage.game.permanent.token.EmptyToken;
|
|||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author emerald000
|
||||
*/
|
||||
public final class HourOfEternity extends CardImpl {
|
||||
|
@ -34,17 +34,7 @@ public final class HourOfEternity extends CardImpl {
|
|||
|
||||
// Exile X target creature cards from your graveyard. For each card exiled this way, create a token that's a copy of that card, except it's a 4/4 black Zombie.
|
||||
this.getSpellAbility().addEffect(new HourOfEternityEffect());
|
||||
this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(0, Integer.MAX_VALUE, new FilterCreatureCard("creature cards from your graveyard")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
ability.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
Target target = new TargetCardInYourGraveyard(xValue, new FilterCreatureCard((xValue != 1 ? " creature cards" : "creature card") + " from your graveyard"));
|
||||
ability.addTarget(target);
|
||||
}
|
||||
this.getSpellAbility().setTargetAdjuster(HourOfEternityAdjuster.instance);
|
||||
}
|
||||
|
||||
public HourOfEternity(final HourOfEternity card) {
|
||||
|
@ -57,11 +47,25 @@ public final class HourOfEternity extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum HourOfEternityAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
Target target = new TargetCardInYourGraveyard(xValue, new FilterCreatureCard((xValue != 1 ? " creature cards" : "creature card") + " from your graveyard"));
|
||||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
|
||||
class HourOfEternityEffect extends OneShotEffect {
|
||||
|
||||
HourOfEternityEffect() {
|
||||
super(Outcome.PutCreatureInPlay);
|
||||
this.staticText = "Exile X target creature cards from your graveyard. For each card exiled this way, create a token that's a copy of that card, except it's a 4/4 black Zombie";
|
||||
this.staticText = "Exile X target creature cards from your graveyard. " +
|
||||
"For each card exiled this way, create a token that's a copy of that card, " +
|
||||
"except it's a 4/4 black Zombie";
|
||||
}
|
||||
|
||||
HourOfEternityEffect(final HourOfEternityEffect effect) {
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
package mage.cards.i;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.condition.LockedInCondition;
|
||||
import mage.abilities.condition.common.FerociousCondition;
|
||||
import mage.abilities.decorator.ConditionalContinuousRuleModifyingEffect;
|
||||
|
@ -13,12 +11,13 @@ import mage.abilities.effects.common.TapTargetEffect;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author emerald000
|
||||
*/
|
||||
public final class IcyBlast extends CardImpl {
|
||||
|
@ -28,7 +27,6 @@ public final class IcyBlast extends CardImpl {
|
|||
|
||||
// Tap X target creatures.
|
||||
this.getSpellAbility().addEffect(new TapTargetEffect("X target creatures"));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, 1, StaticFilters.FILTER_PERMANENT_CREATURE, false));
|
||||
|
||||
// <i>Ferocious</i> — If you control a creature with power 4 or greater, those creatures don't untap during their controllers' next untap steps.
|
||||
Effect effect = new ConditionalContinuousRuleModifyingEffect(
|
||||
|
@ -36,24 +34,25 @@ public final class IcyBlast extends CardImpl {
|
|||
new LockedInCondition(FerociousCondition.instance));
|
||||
effect.setText("<br/><i>Ferocious</i> — If you control a creature with power 4 or greater, those creatures don't untap during their controllers' next untap steps");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
this.getSpellAbility().setTargetAdjuster(IcyBlastAdjuster.instance);
|
||||
}
|
||||
|
||||
public IcyBlast(final IcyBlast card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
ability.getTargets().clear();
|
||||
int numberToTap = ability.getManaCostsToPay().getX();
|
||||
numberToTap = Math.min(game.getBattlefield().count(StaticFilters.FILTER_PERMANENT_CREATURE, ability.getSourceId(), ability.getControllerId(), game), numberToTap);
|
||||
ability.addTarget(new TargetCreaturePermanent(numberToTap));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IcyBlast copy() {
|
||||
return new IcyBlast(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum IcyBlastAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetCreaturePermanent(ability.getManaCostsToPay().getX()));
|
||||
}
|
||||
}
|
|
@ -2,7 +2,6 @@
|
|||
package mage.cards.i;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.*;
|
||||
import mage.constants.CardType;
|
||||
|
@ -16,53 +15,64 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Library;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class IndomitableCreativity extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterPermanent("artifacts and/or creatures");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.or(new CardTypePredicate(CardType.ARTIFACT), new CardTypePredicate(CardType.CREATURE)));
|
||||
}
|
||||
|
||||
public IndomitableCreativity(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{R}{R}{R}");
|
||||
|
||||
// Destroy X target artifacts and/or creatures. For each permanent destroyed this way, its controller reveals cards from the top of their library until an artifact or creature card is revealed and exiles that card. Those players put the exiled card onto the battlefield, then shuffle their libraries.
|
||||
getSpellAbility().addEffect(new IndomitableCreativityEffect());
|
||||
this.getSpellAbility().addTarget(new TargetPermanent(filter));
|
||||
this.getSpellAbility().addEffect(new IndomitableCreativityEffect());
|
||||
this.getSpellAbility().setTargetAdjuster(IndomitableCreativityAdjuster.instance);
|
||||
}
|
||||
|
||||
public IndomitableCreativity(final IndomitableCreativity card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
ability.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
ability.addTarget(new TargetPermanent(xValue, xValue, filter, false));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IndomitableCreativity copy() {
|
||||
return new IndomitableCreativity(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum IndomitableCreativityAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
private static final FilterPermanent filter = new FilterPermanent("artifacts and/or creatures");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.or(
|
||||
new CardTypePredicate(CardType.ARTIFACT),
|
||||
new CardTypePredicate(CardType.CREATURE)
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
ability.addTarget(new TargetPermanent(xValue, xValue, filter, false));
|
||||
}
|
||||
}
|
||||
|
||||
class IndomitableCreativityEffect extends OneShotEffect {
|
||||
|
||||
public IndomitableCreativityEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "Destroy X target artifacts and/or creatures. For each permanent destroyed this way, its controller reveals cards from the top of their library until an artifact or creature card is revealed and exiles that card. Those players put the exiled card onto the battlefield, then shuffle their libraries";
|
||||
this.staticText = "Destroy X target artifacts and/or creatures. " +
|
||||
"For each permanent destroyed this way, " +
|
||||
"its controller reveals cards from the top of their library" +
|
||||
" until an artifact or creature card is revealed and exiles that card. " +
|
||||
"Those players put the exiled card onto the battlefield, then shuffle their libraries";
|
||||
}
|
||||
|
||||
public IndomitableCreativityEffect(final IndomitableCreativityEffect effect) {
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
package mage.cards.j;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.condition.common.KickedCondition;
|
||||
import mage.abilities.decorator.ConditionalOneShotEffect;
|
||||
import mage.abilities.effects.Effect;
|
||||
|
@ -18,6 +16,7 @@ import mage.filter.predicate.mageobject.AnotherTargetPredicate;
|
|||
import mage.game.Game;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
import mage.target.targetpointer.SecondTargetPointer;
|
||||
|
||||
/**
|
||||
|
@ -43,18 +42,7 @@ public final class Jilt extends CardImpl {
|
|||
Target target = new TargetCreaturePermanent();
|
||||
target.setTargetTag(1);
|
||||
this.getSpellAbility().addTarget(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility && KickedCondition.instance.apply(game, ability)) {
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("Another creature: Damaged");
|
||||
filter.add(new AnotherTargetPredicate(2));
|
||||
Target target = new TargetCreaturePermanent(filter);
|
||||
target.setTargetTag(2);
|
||||
ability.addTarget(target);
|
||||
}
|
||||
|
||||
this.getSpellAbility().setTargetAdjuster(JiltAdjuster.instance);
|
||||
}
|
||||
|
||||
public Jilt(final Jilt card) {
|
||||
|
@ -66,3 +54,20 @@ public final class Jilt extends CardImpl {
|
|||
return new Jilt(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum JiltAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (!KickedCondition.instance.apply(game, ability)) {
|
||||
return;
|
||||
}
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("Another creature: Damaged");
|
||||
filter.add(new AnotherTargetPredicate(2));
|
||||
Target target = new TargetCreaturePermanent(filter);
|
||||
target.setTargetTag(2);
|
||||
ability.addTarget(target);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
package mage.cards.k;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -17,9 +15,11 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author sinsedrix
|
||||
*/
|
||||
public final class KaerveksPurge extends CardImpl {
|
||||
|
@ -28,19 +28,8 @@ public final class KaerveksPurge extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{B}{R}");
|
||||
|
||||
// Destroy target creature with converted mana cost X. If that creature dies this way, Kaervek's Purge deals damage equal to the creature's power to the creature's controller.
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("creature with converted mana cost X")));
|
||||
this.getSpellAbility().addEffect(new KaerveksPurgeEffect());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
ability.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with converted mana cost X");
|
||||
filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||
ability.addTarget(new TargetCreaturePermanent(filter));
|
||||
}
|
||||
this.getSpellAbility().setTargetAdjuster(KaerveksPurgeAdjuster.instance);
|
||||
}
|
||||
|
||||
public KaerveksPurge(final KaerveksPurge card) {
|
||||
|
@ -53,11 +42,27 @@ public final class KaerveksPurge extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum KaerveksPurgeAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with converted mana cost " + xValue);
|
||||
filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||
ability.addTarget(new TargetCreaturePermanent(filter));
|
||||
}
|
||||
}
|
||||
|
||||
class KaerveksPurgeEffect extends OneShotEffect {
|
||||
|
||||
public KaerveksPurgeEffect() {
|
||||
super(Outcome.DestroyPermanent);
|
||||
this.staticText = "Destroy target creature with converted mana cost X. If that creature dies this way, {this} deals damage equal to the creature's power to the creature's controller";
|
||||
this.staticText = "Destroy target creature with converted mana cost X. " +
|
||||
"If that creature dies this way, " +
|
||||
"{this} deals damage equal to the creature's power" +
|
||||
" to the creature's controller";
|
||||
}
|
||||
|
||||
public KaerveksPurgeEffect(final KaerveksPurgeEffect effect) {
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
|
||||
package mage.cards.k;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.abilities.keyword.CumulativeUpkeepAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -21,9 +20,11 @@ import mage.players.Player;
|
|||
import mage.target.Target;
|
||||
import mage.target.common.TargetAnyTarget;
|
||||
import mage.target.common.TargetOpponent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author L_J
|
||||
*/
|
||||
public final class KarplusanMinotaur extends CardImpl {
|
||||
|
@ -39,36 +40,10 @@ public final class KarplusanMinotaur extends CardImpl {
|
|||
this.addAbility(new CumulativeUpkeepAbility(new KarplusanMinotaurCost()));
|
||||
|
||||
// Whenever you win a coin flip, Karplusan Minotaur deals 1 damage to any target.
|
||||
Ability abilityWin = new KarplusanMinotaurFlipWinTriggeredAbility();
|
||||
abilityWin.addTarget(new TargetAnyTarget());
|
||||
this.addAbility(abilityWin);
|
||||
this.addAbility(new KarplusanMinotaurFlipWinTriggeredAbility());
|
||||
|
||||
//TODO: Make ability properly copiable
|
||||
// Whenever you lose a coin flip, Karplusan Minotaur deals 1 damage to any target of an opponent's choice.
|
||||
Ability abilityLose = new KarplusanMinotaurFlipLoseTriggeredAbility();
|
||||
abilityLose.addTarget(new TargetAnyTarget());
|
||||
this.addAbility(abilityLose);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof KarplusanMinotaurFlipLoseTriggeredAbility) {
|
||||
Player controller = game.getPlayer(ability.getControllerId());
|
||||
if (controller != null) {
|
||||
UUID opponentId = null;
|
||||
if (game.getOpponents(controller.getId()).size() > 1) {
|
||||
Target target = new TargetOpponent(true);
|
||||
if (controller.chooseTarget(Outcome.Neutral, target, ability, game)) {
|
||||
opponentId = target.getFirstTarget();
|
||||
}
|
||||
} else {
|
||||
opponentId = game.getOpponents(controller.getId()).iterator().next();
|
||||
}
|
||||
if (opponentId != null) {
|
||||
ability.getTargets().get(0).setTargetController(opponentId);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.addAbility(new KarplusanMinotaurFlipLoseTriggeredAbility());
|
||||
}
|
||||
|
||||
public KarplusanMinotaur(final KarplusanMinotaur card) {
|
||||
|
@ -81,10 +56,35 @@ public final class KarplusanMinotaur extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum KarplusanMinotaurAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
Player controller = game.getPlayer(ability.getControllerId());
|
||||
if (controller == null) {
|
||||
return;
|
||||
}
|
||||
UUID opponentId = null;
|
||||
if (game.getOpponents(controller.getId()).size() > 1) {
|
||||
Target target = new TargetOpponent(true);
|
||||
if (controller.chooseTarget(Outcome.Neutral, target, ability, game)) {
|
||||
opponentId = target.getFirstTarget();
|
||||
}
|
||||
} else {
|
||||
opponentId = game.getOpponents(controller.getId()).iterator().next();
|
||||
}
|
||||
if (opponentId != null) {
|
||||
ability.getTargets().get(0).setTargetController(opponentId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class KarplusanMinotaurFlipWinTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public KarplusanMinotaurFlipWinTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new DamageTargetEffect(1), false);
|
||||
this.addTarget(new TargetAnyTarget());
|
||||
}
|
||||
|
||||
public KarplusanMinotaurFlipWinTriggeredAbility(final KarplusanMinotaurFlipWinTriggeredAbility ability) {
|
||||
|
@ -116,6 +116,8 @@ class KarplusanMinotaurFlipLoseTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
public KarplusanMinotaurFlipLoseTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new DamageTargetEffect(1), false);
|
||||
this.addTarget(new TargetAnyTarget());
|
||||
targetAdjuster = KarplusanMinotaurAdjuster.instance;
|
||||
}
|
||||
|
||||
public KarplusanMinotaurFlipLoseTriggeredAbility(final KarplusanMinotaurFlipLoseTriggeredAbility ability) {
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
*/
|
||||
package mage.cards.k;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
@ -35,32 +34,25 @@ import mage.abilities.costs.common.TapSourceCost;
|
|||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.constants.SubType;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.FilterOpponent;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.target.common.TargetOpponent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public class KeeperOfTheMind extends CardImpl {
|
||||
|
||||
public final UUID originalId;
|
||||
private static final FilterOpponent filter = new FilterOpponent();
|
||||
|
||||
static {
|
||||
filter.add(new KeeperOfTheMindPredicate());
|
||||
}
|
||||
|
||||
|
||||
public KeeperOfTheMind(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{U}{U}");
|
||||
|
||||
|
@ -74,28 +66,12 @@ public class KeeperOfTheMind extends CardImpl {
|
|||
effect.setText("Choose target opponent who had at least two more cards in hand than you did as you activated this ability. Draw a card.");
|
||||
Ability ability = new SimpleActivatedAbility(effect, new ManaCostsImpl("{U}"));
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addTarget(new TargetOpponent());
|
||||
ability.setTargetAdjuster(KeeperOfTheMindAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
originalId = ability.getOriginalId();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
Player activePlayer = game.getPlayer(game.getActivePlayerId());
|
||||
if (activePlayer != null) {
|
||||
ability.getTargets().clear();
|
||||
TargetPlayer target = new TargetPlayer(1, 1, false, filter);
|
||||
target.setTargetController(activePlayer.getId());
|
||||
ability.getTargets().add(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public KeeperOfTheMind(final KeeperOfTheMind card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -104,6 +80,28 @@ public class KeeperOfTheMind extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum KeeperOfTheMindAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
private static final FilterOpponent filter = new FilterOpponent();
|
||||
|
||||
static {
|
||||
filter.add(new KeeperOfTheMindPredicate());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
Player activePlayer = game.getPlayer(game.getActivePlayerId());
|
||||
if (activePlayer == null) {
|
||||
return;
|
||||
}
|
||||
ability.getTargets().clear();
|
||||
TargetPlayer target = new TargetPlayer(1, 1, false, filter);
|
||||
target.setTargetController(activePlayer.getId());
|
||||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
|
||||
class KeeperOfTheMindPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Player>> {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
package mage.cards.k;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -13,21 +11,21 @@ import mage.filter.common.FilterCreaturePermanent;
|
|||
import mage.filter.predicate.mageobject.PowerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class KillingGlare extends CardImpl {
|
||||
|
||||
public KillingGlare (UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{X}{B}");
|
||||
|
||||
public KillingGlare(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{X}{B}");
|
||||
|
||||
// Destroy target creature with power X or less.
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect());
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("creature with power X or less")));
|
||||
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect("destroy target creature with power X or less"));
|
||||
this.getSpellAbility().setTargetAdjuster(KillingGlareAdjuster.instance);
|
||||
}
|
||||
|
||||
public KillingGlare(final KillingGlare card) {
|
||||
|
@ -35,19 +33,20 @@ public final class KillingGlare extends CardImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
ability.getTargets().clear();
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with power " + xValue + " or less");
|
||||
filter.add(new PowerPredicate(ComparisonType.FEWER_THAN, xValue + 1));
|
||||
ability.addTarget(new TargetCreaturePermanent(filter));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public KillingGlare copy() {
|
||||
public KillingGlare copy() {
|
||||
return new KillingGlare(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum KillingGlareAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
ability.getTargets().clear();
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with power " + xValue + " or less");
|
||||
filter.add(new PowerPredicate(ComparisonType.FEWER_THAN, xValue + 1));
|
||||
ability.addTarget(new TargetCreaturePermanent(filter));
|
||||
}
|
||||
}
|
|
@ -1,29 +1,32 @@
|
|||
|
||||
package mage.cards.k;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksAndIsNotBlockedTriggeredAbility;
|
||||
import mage.abilities.effects.common.continuous.AssignNoCombatDamageSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
|
||||
import mage.constants.SubType;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.common.FilterArtifactPermanent;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.filter.predicate.permanent.DefendingPlayerControlsPredicate;
|
||||
import mage.target.common.TargetArtifactPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class KukemssaPirates extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
private static final FilterArtifactPermanent filter = new FilterArtifactPermanent("artifact defending player controls");
|
||||
|
||||
static {
|
||||
filter.add(new DefendingPlayerControlsPredicate());
|
||||
}
|
||||
|
||||
public KukemssaPirates(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}");
|
||||
|
@ -36,26 +39,12 @@ public final class KukemssaPirates extends CardImpl {
|
|||
// Whenever Kukemssa Pirates attacks and isn't blocked, you may gain control of target artifact defending player controls. If you do, Kukemssa Pirates assigns no combat damage this turn.
|
||||
Ability ability = new AttacksAndIsNotBlockedTriggeredAbility(new GainControlTargetEffect(Duration.Custom), true);
|
||||
ability.addEffect(new AssignNoCombatDamageSourceEffect(Duration.EndOfTurn, true));
|
||||
ability.addTarget(new TargetArtifactPermanent(new FilterArtifactPermanent("artifact defending player controls")));
|
||||
originalId = ability.getOriginalId();
|
||||
ability.addTarget(new TargetArtifactPermanent(filter));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
public KukemssaPirates(final KukemssaPirates card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
ability.getTargets().clear();
|
||||
FilterArtifactPermanent filter = new FilterArtifactPermanent("artifact defending player controls");
|
||||
UUID defenderId = game.getCombat().getDefenderId(ability.getSourceId());
|
||||
filter.add(new ControllerIdPredicate(defenderId));
|
||||
TargetArtifactPermanent target = new TargetArtifactPermanent(filter);
|
||||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.l;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -21,6 +20,7 @@ import mage.filter.predicate.mageobject.SupertypePredicate;
|
|||
import mage.game.Game;
|
||||
import mage.game.command.emblems.LilianaDefiantNecromancerEmblem;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -28,14 +28,12 @@ import mage.target.common.TargetCardInYourGraveyard;
|
|||
*/
|
||||
public final class LilianaDefiantNecromancer extends CardImpl {
|
||||
|
||||
private static final FilterCreatureCard filter = new FilterCreatureCard("nonlegendary creature with converted mana cost X from your graveyard");
|
||||
protected static final FilterCreatureCard filter = new FilterCreatureCard("nonlegendary creature with converted mana cost X from your graveyard");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.not(new SupertypePredicate(SuperType.LEGENDARY)));
|
||||
}
|
||||
|
||||
UUID ability2Id;
|
||||
|
||||
public LilianaDefiantNecromancer(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "");
|
||||
this.addSuperType(SuperType.LEGENDARY);
|
||||
|
@ -49,36 +47,18 @@ public final class LilianaDefiantNecromancer extends CardImpl {
|
|||
// +2: Each player discards a card.
|
||||
this.addAbility(new LoyaltyAbility(new DiscardEachPlayerEffect(1, false), 2));
|
||||
|
||||
//TODO: Make ability properly copiable
|
||||
// -X: Return target nonlegendary creature with converted mana cost X from your graveyard to the battlefield.
|
||||
Ability ability = new LoyaltyAbility(new ReturnFromGraveyardToBattlefieldTargetEffect());
|
||||
ability2Id = ability.getOriginalId();
|
||||
ability.addTarget(new TargetCardInYourGraveyard(filter));
|
||||
ability.setTargetAdjuster(LilianaDefiantNecromancerAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
|
||||
//-8: You get an emblem with "Whenever a creature dies, return it to the battlefield under your control at the beginning of the next end step.";
|
||||
this.addAbility(new LoyaltyAbility(new GetEmblemEffect(new LilianaDefiantNecromancerEmblem()), -8));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(ability2Id)) {
|
||||
int cmc = 0;
|
||||
for (Cost cost : ability.getCosts()) {
|
||||
if (cost instanceof PayVariableLoyaltyCost) {
|
||||
cmc = ((PayVariableLoyaltyCost) cost).getAmount();
|
||||
}
|
||||
}
|
||||
FilterCard newFilter = filter.copy();
|
||||
newFilter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, cmc));
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetCardInYourGraveyard(newFilter));
|
||||
}
|
||||
}
|
||||
|
||||
public LilianaDefiantNecromancer(final LilianaDefiantNecromancer card) {
|
||||
super(card);
|
||||
this.ability2Id = card.ability2Id;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -86,3 +66,21 @@ public final class LilianaDefiantNecromancer extends CardImpl {
|
|||
return new LilianaDefiantNecromancer(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum LilianaDefiantNecromancerAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
int cmc = 0;
|
||||
for (Cost cost : ability.getCosts()) {
|
||||
if (cost instanceof PayVariableLoyaltyCost) {
|
||||
cmc = ((PayVariableLoyaltyCost) cost).getAmount();
|
||||
}
|
||||
}
|
||||
FilterCard newFilter = LilianaDefiantNecromancer.filter.copy();
|
||||
newFilter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, cmc));
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetCardInYourGraveyard(newFilter));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
|
||||
package mage.cards.l;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
@ -12,50 +9,38 @@ import mage.abilities.effects.OneShotEffect;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetCreaturePermanentAmount;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2 & L_J
|
||||
*/
|
||||
public final class LivingInferno extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
|
||||
public LivingInferno(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{6}{R}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{6}{R}{R}");
|
||||
this.subtype.add(SubType.ELEMENTAL);
|
||||
this.power = new MageInt(8);
|
||||
this.toughness = new MageInt(5);
|
||||
|
||||
// {T}: Living Inferno deals damage equal to its power divided as you choose among any number of target creatures. Each of those creatures deals damage equal to its power to Living Inferno.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new LivingInfernoEffect(), new TapSourceCost());
|
||||
ability.addTarget(new TargetCreaturePermanentAmount(1));
|
||||
ability.setTargetAdjuster(LivingInfernoAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
originalId = ability.getOriginalId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if(ability.getOriginalId().equals(originalId)) {
|
||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(ability.getSourceId());
|
||||
if (sourcePermanent != null) {
|
||||
int xValue = sourcePermanent.getPower().getValue();
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetCreaturePermanentAmount(xValue));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public LivingInferno(final LivingInferno card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -64,11 +49,26 @@ public final class LivingInferno extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum LivingInfernoAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(ability.getSourceId());
|
||||
if (sourcePermanent != null) {
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetCreaturePermanentAmount(sourcePermanent.getPower().getValue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class LivingInfernoEffect extends OneShotEffect {
|
||||
|
||||
public LivingInfernoEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "{this} deals damage equal to its power divided as you choose among any number of target creatures. Each of those creatures deals damage equal to its power to {this}";
|
||||
this.staticText = "{this} deals damage equal to its power " +
|
||||
"divided as you choose among any number of target creatures. " +
|
||||
"Each of those creatures deals damage equal to its power to {this}";
|
||||
}
|
||||
|
||||
public LivingInfernoEffect(final LivingInfernoEffect effect) {
|
||||
|
|
|
@ -29,7 +29,7 @@ import mage.watchers.common.PlayerLostLifeWatcher;
|
|||
*/
|
||||
public final class LuminarchAscension extends CardImpl {
|
||||
|
||||
private String rule = "At the beginning of each opponent's end step, if you didn't lose life this turn, you may put a quest counter on {this}. (Damage causes loss of life.)";
|
||||
private static final String rule = "At the beginning of each opponent's end step, if you didn't lose life this turn, you may put a quest counter on {this}. (Damage causes loss of life.)";
|
||||
|
||||
public LuminarchAscension(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.l;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
|
@ -10,8 +9,8 @@ import mage.abilities.keyword.VigilanceAbility;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.game.Game;
|
||||
|
@ -19,15 +18,17 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class LuminatePrimordial extends CardImpl {
|
||||
|
||||
public LuminatePrimordial(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{W}{W}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{W}{W}");
|
||||
this.subtype.add(SubType.AVATAR);
|
||||
|
||||
this.power = new MageInt(4);
|
||||
|
@ -38,23 +39,9 @@ public final class LuminatePrimordial extends CardImpl {
|
|||
|
||||
// When Luminate Primordial enters the battlefield, for each opponent, exile up to one target creature
|
||||
// that player controls and that player gains life equal to its power.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new LuminatePrimordialEffect(),false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof EntersBattlefieldTriggeredAbility) {
|
||||
ability.getTargets().clear();
|
||||
for(UUID opponentId : game.getOpponents(ability.getControllerId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
if (opponent != null) {
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature from opponent " + opponent.getLogName());
|
||||
filter.add(new ControllerIdPredicate(opponentId));
|
||||
TargetCreaturePermanent target = new TargetCreaturePermanent(0,1, filter,false);
|
||||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new LuminatePrimordialEffect(), false);
|
||||
ability.setTargetAdjuster(LuminatePrimordialAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
public LuminatePrimordial(final LuminatePrimordial card) {
|
||||
|
@ -67,6 +54,24 @@ public final class LuminatePrimordial extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum LuminatePrimordialAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
for (UUID opponentId : game.getOpponents(ability.getControllerId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
if (opponent != null) {
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature from opponent " + opponent.getLogName());
|
||||
filter.add(new ControllerIdPredicate(opponentId));
|
||||
TargetCreaturePermanent target = new TargetCreaturePermanent(0, 1, filter, false);
|
||||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class LuminatePrimordialEffect extends OneShotEffect {
|
||||
|
||||
public LuminatePrimordialEffect() {
|
||||
|
@ -85,7 +90,7 @@ class LuminatePrimordialEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
for (Target target: source.getTargets()) {
|
||||
for (Target target : source.getTargets()) {
|
||||
if (target instanceof TargetCreaturePermanent) {
|
||||
Permanent targetCreature = game.getPermanent(target.getFirstTarget());
|
||||
if (targetCreature != null && !targetCreature.isControlledBy(source.getControllerId())) {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.common.KickedCondition;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
|
@ -13,18 +12,17 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.filter.common.FilterControlledLandPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
import mage.target.common.TargetAnyTarget;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LoneFox
|
||||
*
|
||||
*/
|
||||
public final class MagmaBurst extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
|
||||
public MagmaBurst(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{R}");
|
||||
|
||||
|
@ -32,21 +30,13 @@ public final class MagmaBurst extends CardImpl {
|
|||
this.addAbility(new KickerAbility(new SacrificeTargetCost(new TargetControlledPermanent(2, 2, new FilterControlledLandPermanent("two lands"), true))));
|
||||
// Magma Burst deals 3 damage to any target. If Magma Burst was kicked, it deals 3 damage to another any target.
|
||||
Effect effect = new DamageTargetEffect(3);
|
||||
effect.setText("{this} deals 3 damage to any target. if this spell was kicked, it deals 3 damage to another target.");
|
||||
effect.setText("{this} deals 3 damage to any target. If this spell was kicked, it deals 3 damage to another target.");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
originalId = this.getSpellAbility().getOriginalId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
ability.addTarget(new TargetAnyTarget(KickedCondition.instance.apply(game, ability) ? 2 : 1));
|
||||
}
|
||||
this.getSpellAbility().setTargetAdjuster(MagmaBurstAdjuster.instance);
|
||||
}
|
||||
|
||||
public MagmaBurst(final MagmaBurst card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -54,3 +44,12 @@ public final class MagmaBurst extends CardImpl {
|
|||
return new MagmaBurst(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum MagmaBurstAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.addTarget(new TargetAnyTarget(KickedCondition.instance.apply(game, ability) ? 2 : 1));
|
||||
}
|
||||
}
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.LoseLifeSourceControllerEffect;
|
||||
|
@ -16,38 +14,24 @@ import mage.filter.predicate.Predicates;
|
|||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LoneFox
|
||||
*/
|
||||
public final class MaliciousAdvice extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterPermanent("artifacts, creatures, and/or lands");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.or(
|
||||
new CardTypePredicate(CardType.ARTIFACT),
|
||||
new CardTypePredicate(CardType.CREATURE),
|
||||
new CardTypePredicate(CardType.LAND)));
|
||||
}
|
||||
|
||||
public MaliciousAdvice(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{X}{U}{B}");
|
||||
|
||||
// Tap X target artifacts, creatures, and/or lands. You lose X life.
|
||||
Effect effect = new TapTargetEffect();
|
||||
effect.setText("X target artifacts, creatures, and/or lands");
|
||||
effect.setText("X target artifacts, creatures, and/or lands.");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
this.getSpellAbility().addEffect(new LoseLifeSourceControllerEffect(new ManacostVariableValue()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter));
|
||||
}
|
||||
this.getSpellAbility().setTargetAdjuster(MaliciousAdviceAdjuster.instance);
|
||||
}
|
||||
|
||||
public MaliciousAdvice(final MaliciousAdvice card) {
|
||||
|
@ -59,3 +43,22 @@ public final class MaliciousAdvice extends CardImpl {
|
|||
return new MaliciousAdvice(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum MaliciousAdviceAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
private static final FilterPermanent filter = new FilterPermanent("artifacts, creatures, and/or lands");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.or(
|
||||
new CardTypePredicate(CardType.ARTIFACT),
|
||||
new CardTypePredicate(CardType.CREATURE),
|
||||
new CardTypePredicate(CardType.LAND)
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter));
|
||||
}
|
||||
}
|
|
@ -1,80 +1,55 @@
|
|||
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.common.KickedCondition;
|
||||
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||
import mage.abilities.dynamicvalue.common.MultikickerCount;
|
||||
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostAllEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostControlledEffect;
|
||||
import mage.abilities.keyword.MultikickerAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.game.Game;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*
|
||||
*/
|
||||
public final class MarshalsAnthem extends CardImpl {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures you control");
|
||||
private static final FilterCard filterCard = new FilterCard("creature card in your graveyard");
|
||||
|
||||
static {
|
||||
filter.add(new ControllerPredicate(TargetController.YOU));
|
||||
filterCard.add(new CardTypePredicate(CardType.CREATURE));
|
||||
}
|
||||
|
||||
private final UUID originalId;
|
||||
private static final String rule = "return up to X target creature cards from your graveyard to the battlefield, " +
|
||||
"where X is the number of times {this} was kicked";
|
||||
|
||||
public MarshalsAnthem(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{W}{W}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}{W}");
|
||||
|
||||
// Multikicker {1}{W}
|
||||
this.addAbility(new MultikickerAbility("{1}{W}"));
|
||||
|
||||
// Creatures you control get +1/+1.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, filter, false)));
|
||||
this.addAbility(new SimpleStaticAbility(
|
||||
Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield)
|
||||
));
|
||||
|
||||
// When Marshal's Anthem enters the battlefield, return up to X target creature cards from your graveyard to the battlefield, where X is the number of times Marshal's Anthem was kicked.
|
||||
//TODO this should always trigger, even if it wasn't kicked
|
||||
Ability ability = new ConditionalInterveningIfTriggeredAbility(
|
||||
new EntersBattlefieldTriggeredAbility(new ReturnFromGraveyardToBattlefieldTargetEffect(), false),
|
||||
KickedCondition.instance,
|
||||
"When {this} enters the battlefield, return up to X target creature cards from your graveyard to the battlefield, where X is the number of times {this} was kicked.");
|
||||
originalId = ability.getOriginalId();
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(
|
||||
new ReturnFromGraveyardToBattlefieldTargetEffect().setText(rule), false
|
||||
);
|
||||
ability.setTargetAdjuster(MarshalsAnthemAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
ability.getTargets().clear();
|
||||
int numbTargets = new MultikickerCount().calculate(game, ability, null);
|
||||
if (numbTargets > 0) {
|
||||
ability.addTarget(new TargetCardInYourGraveyard(0, numbTargets, filterCard));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public MarshalsAnthem(final MarshalsAnthem card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -82,3 +57,17 @@ public final class MarshalsAnthem extends CardImpl {
|
|||
return new MarshalsAnthem(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum MarshalsAnthemAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
private static final FilterCard filter = new FilterCreatureCard("creature card in your graveyard");
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
int numbTargets = new MultikickerCount().calculate(game, ability, null);
|
||||
if (numbTargets > 0) {
|
||||
ability.addTarget(new TargetCardInYourGraveyard(0, numbTargets, filter));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -25,17 +24,17 @@ import mage.game.Game;
|
|||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInASingleGraveyard;
|
||||
import mage.target.common.TargetCardInHand;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author emerald000
|
||||
*/
|
||||
public final class MartyrOfBones extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
|
||||
public MartyrOfBones(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{B}");
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.WIZARD);
|
||||
|
||||
|
@ -49,27 +48,12 @@ public final class MartyrOfBones extends CardImpl {
|
|||
ability.addCost(new RevealVariableBlackCardsFromHandCost());
|
||||
ability.addCost(new SacrificeSourceCost());
|
||||
ability.addTarget(new TargetCardInASingleGraveyard(0, 1, new FilterCard("cards in a single graveyard")));
|
||||
originalId = ability.getOriginalId();
|
||||
ability.setTargetAdjuster(MartyrOfBonesAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
public MartyrOfBones(final MartyrOfBones card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
int amount = 0;
|
||||
for (Cost cost : ability.getCosts()) {
|
||||
if (cost instanceof RevealVariableBlackCardsFromHandCost) {
|
||||
amount = ((VariableCost) cost).getAmount();
|
||||
}
|
||||
}
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetCardInASingleGraveyard(0, amount, new FilterCard()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -78,6 +62,22 @@ public final class MartyrOfBones extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum MartyrOfBonesAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
int amount = 0;
|
||||
for (Cost cost : ability.getCosts()) {
|
||||
if (cost instanceof RevealVariableBlackCardsFromHandCost) {
|
||||
amount = ((VariableCost) cost).getAmount();
|
||||
}
|
||||
}
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetCardInASingleGraveyard(0, amount, new FilterCard()));
|
||||
}
|
||||
}
|
||||
|
||||
class RevealVariableBlackCardsFromHandCost extends VariableCostImpl {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("X black cards from your hand");
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
|
||||
|
@ -21,6 +19,7 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
|
@ -34,22 +33,7 @@ public final class MassMutiny extends CardImpl {
|
|||
|
||||
// For each opponent, gain control of up to one target creature that player controls until end of turn. Untap those creatures. They gain haste until end of turn.
|
||||
this.getSpellAbility().addEffect(new MassMutinyEffect());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
ability.getTargets().clear();
|
||||
for (UUID opponentId : game.getOpponents(ability.getControllerId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
if (opponent != null) {
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature from opponent " + opponent.getName());
|
||||
filter.add(new ControllerIdPredicate(opponentId));
|
||||
TargetCreaturePermanent target = new TargetCreaturePermanent(0, 1, filter, false);
|
||||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.getSpellAbility().setTargetAdjuster(MassMutinyAdjuster.instance);
|
||||
}
|
||||
|
||||
public MassMutiny(final MassMutiny card) {
|
||||
|
@ -62,6 +46,24 @@ public final class MassMutiny extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum MassMutinyAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
for (UUID opponentId : game.getOpponents(ability.getControllerId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
if (opponent != null) {
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature from opponent " + opponent.getName());
|
||||
filter.add(new ControllerIdPredicate(opponentId));
|
||||
TargetCreaturePermanent target = new TargetCreaturePermanent(0, 1, filter, false);
|
||||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class MassMutinyEffect extends OneShotEffect {
|
||||
|
||||
public MassMutinyEffect() {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -20,14 +19,13 @@ import mage.filter.FilterSpell;
|
|||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
import mage.target.TargetPlayer;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class MerrowBonegnawer extends CardImpl {
|
||||
|
||||
private UUID exileId = UUID.randomUUID();
|
||||
|
||||
private static final FilterSpell filter = new FilterSpell("a black spell");
|
||||
|
||||
static {
|
||||
|
@ -43,7 +41,7 @@ public final class MerrowBonegnawer extends CardImpl {
|
|||
this.toughness = new MageInt(1);
|
||||
|
||||
// {tap}: Target player exiles a card from their graveyard.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileFromZoneTargetEffect(Zone.GRAVEYARD, exileId, getIdName(), new FilterCard()), new TapSourceCost());
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileFromZoneTargetEffect(Zone.GRAVEYARD, null, getIdName(), new FilterCard()), new TapSourceCost());
|
||||
ability.addTarget(new TargetPlayer());
|
||||
this.addAbility(ability);
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -13,6 +12,7 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetAnyTarget;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -21,7 +21,7 @@ import mage.target.common.TargetAnyTarget;
|
|||
public final class MeteorBlast extends CardImpl {
|
||||
|
||||
public MeteorBlast(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{X}{R}{R}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{R}{R}{R}");
|
||||
|
||||
// Meteor Blast deals 4 damage to each of X target creatures and/or players.
|
||||
this.getSpellAbility().addEffect(new MeteorBlastEffect());
|
||||
|
@ -31,6 +31,15 @@ public final class MeteorBlast extends CardImpl {
|
|||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MeteorBlast copy() {
|
||||
return new MeteorBlast(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum MeteorBlastAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
|
@ -39,11 +48,6 @@ public final class MeteorBlast extends CardImpl {
|
|||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MeteorBlast copy() {
|
||||
return new MeteorBlast(this);
|
||||
}
|
||||
}
|
||||
|
||||
class MeteorBlastEffect extends OneShotEffect {
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -17,9 +15,11 @@ import mage.game.Game;
|
|||
import mage.game.permanent.token.ZombieToken;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Skyler Sell
|
||||
*/
|
||||
public final class MidnightRitual extends CardImpl {
|
||||
|
@ -31,14 +31,7 @@ public final class MidnightRitual extends CardImpl {
|
|||
// For each creature card exiled this way, create a 2/2 black Zombie creature token.
|
||||
this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD));
|
||||
this.getSpellAbility().addEffect(new MidnightRitualEffect());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetCardInYourGraveyard(ability.getManaCostsToPay().getX(), StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD));
|
||||
}
|
||||
this.getSpellAbility().setTargetAdjuster(MidnightRitualAdjuster.instance);
|
||||
}
|
||||
|
||||
public MidnightRitual(final MidnightRitual card) {
|
||||
|
@ -51,6 +44,16 @@ public final class MidnightRitual extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum MidnightRitualAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetCardInYourGraveyard(ability.getManaCostsToPay().getX(), StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD));
|
||||
}
|
||||
}
|
||||
|
||||
class MidnightRitualEffect extends OneShotEffect {
|
||||
|
||||
public MidnightRitualEffect() {
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
@ -11,8 +10,8 @@ import mage.abilities.effects.OneShotEffect;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -20,59 +19,36 @@ import mage.players.Player;
|
|||
import mage.target.Target;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.common.TargetOpponentsCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author L_J
|
||||
*/
|
||||
public final class MoggAssassin extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
|
||||
public MoggAssassin(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}");
|
||||
this.subtype.add(SubType.GOBLIN);
|
||||
this.subtype.add(SubType.ASSASSIN);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(1);
|
||||
|
||||
//TODO: Make ability properly copiable
|
||||
// {T}: You choose target creature an opponent controls, and that opponent chooses target creature. Flip a coin. If you win the flip, destroy the creature you chose. If you lose the flip, destroy the creature your opponent chose.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new MoggAssassinEffect(), new TapSourceCost());
|
||||
Ability ability = new SimpleActivatedAbility(
|
||||
Zone.BATTLEFIELD,
|
||||
new MoggAssassinEffect(),
|
||||
new TapSourceCost()
|
||||
);
|
||||
ability.addTarget(new TargetOpponentsCreaturePermanent());
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
ability.setTargetAdjuster(MoggAssassinAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
originalId = ability.getOriginalId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
Player controller = game.getPlayer(ability.getControllerId());
|
||||
if (controller != null) {
|
||||
UUID opponentId = null;
|
||||
if (game.getOpponents(controller.getId()).size() > 1) {
|
||||
Target target = ability.getTargets().get(0);
|
||||
if (controller.chooseTarget(Outcome.DestroyPermanent, target, ability, game)) {
|
||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||
opponentId = permanent.getControllerId();
|
||||
} else {
|
||||
opponentId = game.getOpponents(controller.getId()).iterator().next();
|
||||
}
|
||||
} else {
|
||||
opponentId = game.getOpponents(controller.getId()).iterator().next();
|
||||
}
|
||||
|
||||
if (opponentId != null) {
|
||||
ability.getTargets().get(1).setTargetController(opponentId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public MoggAssassin(final MoggAssassin card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -82,6 +58,34 @@ public final class MoggAssassin extends CardImpl {
|
|||
|
||||
}
|
||||
|
||||
enum MoggAssassinAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
Player controller = game.getPlayer(ability.getControllerId());
|
||||
if (controller == null) {
|
||||
return;
|
||||
}
|
||||
UUID opponentId = null;
|
||||
if (game.getOpponents(controller.getId()).size() > 1) {
|
||||
Target target = ability.getTargets().get(0);
|
||||
if (controller.chooseTarget(Outcome.DestroyPermanent, target, ability, game)) {
|
||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||
opponentId = permanent.getControllerId();
|
||||
} else {
|
||||
opponentId = game.getOpponents(controller.getId()).iterator().next();
|
||||
}
|
||||
} else {
|
||||
opponentId = game.getOpponents(controller.getId()).iterator().next();
|
||||
}
|
||||
|
||||
if (opponentId != null) {
|
||||
ability.getTargets().get(1).setTargetController(opponentId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class MoggAssassinEffect extends OneShotEffect {
|
||||
|
||||
public MoggAssassinEffect() {
|
||||
|
@ -100,21 +104,21 @@ class MoggAssassinEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Permanent chosenPermanent = game.getPermanent(source.getTargets().get(0).getFirstTarget());
|
||||
Permanent opponentsPermanent = game.getPermanent(source.getTargets().get(1).getFirstTarget());
|
||||
if (controller.flipCoin(game)) {
|
||||
if (chosenPermanent != null) {
|
||||
chosenPermanent.destroy(source.getSourceId(), game, false);
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (opponentsPermanent != null) {
|
||||
opponentsPermanent.destroy(source.getSourceId(), game, false);
|
||||
return true;
|
||||
}
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
Permanent chosenPermanent = game.getPermanent(source.getTargets().get(0).getFirstTarget());
|
||||
Permanent opponentsPermanent = game.getPermanent(source.getTargets().get(1).getFirstTarget());
|
||||
if (controller.flipCoin(game)) {
|
||||
if (chosenPermanent != null) {
|
||||
chosenPermanent.destroy(source.getSourceId(), game, false);
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (opponentsPermanent != null) {
|
||||
opponentsPermanent.destroy(source.getSourceId(), game, false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
|
@ -12,20 +11,22 @@ import mage.abilities.keyword.IntimidateAbility;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.ColoredManaSymbol;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.game.Game;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class MogissMarauder extends CardImpl {
|
||||
|
||||
public MogissMarauder(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}");
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.BERSERKER);
|
||||
|
||||
|
@ -35,24 +36,13 @@ public final class MogissMarauder extends CardImpl {
|
|||
// When Mogis's Marauder enters the battlefield, up to X target creatures each gain intimidate and haste, where X is your devotion to black.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(
|
||||
new GainAbilityTargetEffect(IntimidateAbility.getInstance(), Duration.EndOfTurn,
|
||||
"up to X target creatures each gain intimidate"), false);
|
||||
"up to X target creatures each gain intimidate"), false);
|
||||
ability.addEffect(new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn,
|
||||
"and haste until end of turn, where X is your devotion to black"));
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
ability.setTargetAdjuster(MogissMarauderAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof EntersBattlefieldTriggeredAbility) {
|
||||
ability.getTargets().clear();
|
||||
int numbTargets = new DevotionCount(ColoredManaSymbol.B).calculate(game, ability, null);
|
||||
if (numbTargets > 0) {
|
||||
ability.addTarget(new TargetCreaturePermanent(0,numbTargets));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public MogissMarauder(final MogissMarauder card) {
|
||||
super(card);
|
||||
}
|
||||
|
@ -62,3 +52,16 @@ public final class MogissMarauder extends CardImpl {
|
|||
return new MogissMarauder(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum MogissMarauderAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
int numbTargets = new DevotionCount(ColoredManaSymbol.B).calculate(game, ability, null);
|
||||
if (numbTargets > 0) {
|
||||
ability.addTarget(new TargetCreaturePermanent(0, numbTargets));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
|
@ -11,13 +9,16 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterArtifactOrEnchantmentPermanent;
|
||||
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LoneFox
|
||||
*/
|
||||
public final class Molder extends CardImpl {
|
||||
|
@ -26,20 +27,9 @@ public final class Molder extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{X}{G}");
|
||||
|
||||
// Destroy target artifact or enchantment with converted mana cost X. It can't be regenerated. You gain X life.
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect(true));
|
||||
this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent("artifact or enchantment with converted mana cost X")));
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect("Destroy target artifact or enchantment with converted mana cost X.", true));
|
||||
this.getSpellAbility().addEffect(new GainLifeEffect(new ManacostVariableValue()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
ability.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
FilterArtifactOrEnchantmentPermanent filter = new FilterArtifactOrEnchantmentPermanent("artifact or enchantment with converted mana cost X");
|
||||
filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||
ability.addTarget(new TargetPermanent(filter));
|
||||
}
|
||||
this.getSpellAbility().setTargetAdjuster(MolderAdjuster.instance);
|
||||
}
|
||||
|
||||
public Molder(final Molder card) {
|
||||
|
@ -51,3 +41,16 @@ public final class Molder extends CardImpl {
|
|||
return new Molder(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum MolderAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
FilterPermanent filter = new FilterArtifactOrEnchantmentPermanent("artifact or enchantment with converted mana cost " + xValue);
|
||||
filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||
ability.addTarget(new TargetPermanent(filter));
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
|
@ -13,9 +12,9 @@ import mage.abilities.keyword.HasteAbility;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.game.Game;
|
||||
|
@ -23,16 +22,18 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class MoltenPrimordial extends CardImpl {
|
||||
|
||||
public MoltenPrimordial(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{R}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{R}{R}");
|
||||
this.subtype.add(SubType.AVATAR);
|
||||
|
||||
this.power = new MageInt(6);
|
||||
|
@ -42,23 +43,9 @@ public final class MoltenPrimordial extends CardImpl {
|
|||
this.addAbility(HasteAbility.getInstance());
|
||||
|
||||
// When Molten Primordial enters the battlefield, for each opponent, take control of up to one target creature that player controls until end of turn. Untap those creatures. They have haste until end of turn.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new MoltenPrimordialEffect(),false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof EntersBattlefieldTriggeredAbility) {
|
||||
ability.getTargets().clear();
|
||||
for(UUID opponentId : game.getOpponents(ability.getControllerId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
if (opponent != null) {
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature from opponent " + opponent.getLogName());
|
||||
filter.add(new ControllerIdPredicate(opponentId));
|
||||
TargetCreaturePermanent target = new TargetCreaturePermanent(0,1, filter,false);
|
||||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new MoltenPrimordialEffect(), false);
|
||||
ability.setTargetAdjuster(MoltenPrimordialAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
public MoltenPrimordial(final MoltenPrimordial card) {
|
||||
|
@ -71,6 +58,24 @@ public final class MoltenPrimordial extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum MoltenPrimordialAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
for (UUID opponentId : game.getOpponents(ability.getControllerId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
if (opponent != null) {
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature from opponent " + opponent.getLogName());
|
||||
filter.add(new ControllerIdPredicate(opponentId));
|
||||
TargetCreaturePermanent target = new TargetCreaturePermanent(0, 1, filter, false);
|
||||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class MoltenPrimordialEffect extends OneShotEffect {
|
||||
|
||||
public MoltenPrimordialEffect() {
|
||||
|
@ -90,7 +95,7 @@ class MoltenPrimordialEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
boolean result = false;
|
||||
for (Target target: source.getTargets()) {
|
||||
for (Target target : source.getTargets()) {
|
||||
if (target instanceof TargetCreaturePermanent) {
|
||||
Permanent targetCreature = game.getPermanent(target.getFirstTarget());
|
||||
if (targetCreature != null) {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.n;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.VariableCost;
|
||||
|
@ -19,15 +18,17 @@ import mage.game.Game;
|
|||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInHand;
|
||||
import mage.target.common.TargetCreatureOrPlaneswalker;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class NahirisWrath extends CardImpl {
|
||||
|
||||
public NahirisWrath(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{R}");
|
||||
|
||||
// As an additional cost to cast Nahiri's Wrath, discard X cards.
|
||||
this.getSpellAbility().addCost(new NahirisWrathAdditionalCost());
|
||||
|
@ -36,8 +37,22 @@ public final class NahirisWrath extends CardImpl {
|
|||
Effect effect = new DamageTargetEffect(new DiscardCostCardConvertedMana());
|
||||
effect.setText("{this} deals damage equal to the total converted mana cost of the discarded cards to each of up to X target creatures and/or planeswalkers");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
this.getSpellAbility().setTargetAdjuster(NahirisWrathAdjuster.instance);
|
||||
}
|
||||
|
||||
public NahirisWrath(final NahirisWrath card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NahirisWrath copy() {
|
||||
return new NahirisWrath(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum NahirisWrathAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
|
@ -52,15 +67,6 @@ public final class NahirisWrath extends CardImpl {
|
|||
ability.addTarget(new TargetCreatureOrPlaneswalker(0, numTargets, new FilterCreatureOrPlaneswalkerPermanent(), false));
|
||||
}
|
||||
}
|
||||
|
||||
public NahirisWrath(final NahirisWrath card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NahirisWrath copy() {
|
||||
return new NahirisWrath(this);
|
||||
}
|
||||
}
|
||||
|
||||
class NahirisWrathAdditionalCost extends VariableCostImpl {
|
||||
|
|
|
@ -26,11 +26,11 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author spjspj
|
||||
*/
|
||||
public final class NazahnReveredBladesmith extends CardImpl {
|
||||
|
@ -65,25 +65,10 @@ public final class NazahnReveredBladesmith extends CardImpl {
|
|||
// Whenever an equipped creature you control attacks, you may tap target creature defending player controls.
|
||||
Ability ability = new AttacksCreatureYouControlTriggeredAbility(new NazahnTapEffect(), true, equippedFilter, true);
|
||||
ability.addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("creature defending player controls")));
|
||||
ability.setTargetAdjuster(NazahnReveredBladesmithAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof AttacksCreatureYouControlTriggeredAbility) {
|
||||
FilterCreaturePermanent filterDefender = new FilterCreaturePermanent("creature defending player controls");
|
||||
for (Effect effect : ability.getEffects()) {
|
||||
if (effect instanceof NazahnTapEffect) {
|
||||
filterDefender.add(new ControllerIdPredicate(game.getCombat().getDefendingPlayerId(effect.getTargetPointer().getFirst(game, ability), game)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
ability.getTargets().clear();
|
||||
TargetCreaturePermanent target = new TargetCreaturePermanent(filterDefender);
|
||||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
|
||||
public NazahnReveredBladesmith(final NazahnReveredBladesmith card) {
|
||||
super(card);
|
||||
}
|
||||
|
@ -94,6 +79,24 @@ public final class NazahnReveredBladesmith extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum NazahnReveredBladesmithAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
FilterCreaturePermanent filterDefender = new FilterCreaturePermanent("creature defending player controls");
|
||||
for (Effect effect : ability.getEffects()) {
|
||||
if (effect instanceof NazahnTapEffect) {
|
||||
filterDefender.add(new ControllerIdPredicate(game.getCombat().getDefendingPlayerId(effect.getTargetPointer().getFirst(game, ability), game)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
ability.getTargets().clear();
|
||||
TargetCreaturePermanent target = new TargetCreaturePermanent(filterDefender);
|
||||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
|
||||
class NazahnTapEffect extends TapTargetEffect {
|
||||
|
||||
NazahnTapEffect() {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
|
||||
package mage.cards.n;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostAdjuster;
|
||||
import mage.abilities.costs.VariableCost;
|
||||
import mage.abilities.costs.common.ExileFromGraveCost;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
|
@ -21,8 +21,8 @@ import mage.abilities.keyword.FlyingAbility;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
|
@ -30,15 +30,17 @@ import mage.players.Player;
|
|||
import mage.target.Target;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class NecropolisFiend extends CardImpl {
|
||||
|
||||
public NecropolisFiend(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{7}{B}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{7}{B}{B}");
|
||||
this.subtype.add(SubType.DEMON);
|
||||
|
||||
this.power = new MageInt(4);
|
||||
|
@ -46,54 +48,29 @@ public final class NecropolisFiend extends CardImpl {
|
|||
|
||||
// Delve
|
||||
this.addAbility(new DelveAbility());
|
||||
|
||||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
//TODO: Make ability properly copiable
|
||||
|
||||
// {X}, {T}, Exile X cards from your graveyard: Target creature gets -X/-X until end of turn.
|
||||
DynamicValue xValue = new SignInversionDynamicValue(new ManacostVariableValue());
|
||||
Effect effect = new BoostTargetEffect(xValue,xValue,Duration.EndOfTurn);
|
||||
Effect effect = new BoostTargetEffect(xValue, xValue, Duration.EndOfTurn);
|
||||
effect.setText("Target creature gets -X/-X until end of turn");
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{X}"));
|
||||
Ability ability = new SimpleActivatedAbility(
|
||||
Zone.BATTLEFIELD, effect,
|
||||
new ManaCostsImpl("{X}")
|
||||
);
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
ability.addCost(new ExileFromGraveCost(new TargetCardInYourGraveyard(1,1,new FilterCard("cards from your graveyard")), "Exile X cards from your graveyard"));
|
||||
ability.addCost(new ExileFromGraveCost(new TargetCardInYourGraveyard(
|
||||
1, 1, new FilterCard("cards from your graveyard")
|
||||
), "Exile X cards from your graveyard"));
|
||||
ability.setTargetAdjuster(NecropolisFiendTargetAdjuster.instance);
|
||||
ability.setCostAdjuster(NecropolisFiendCostAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
if (ability instanceof SimpleActivatedAbility) {
|
||||
Player controller = game.getPlayer(ability.getControllerId());
|
||||
if (controller != null) {
|
||||
for (VariableCost variableCost: ability.getManaCostsToPay().getVariableCosts()) {
|
||||
if (variableCost instanceof VariableManaCost) {
|
||||
((VariableManaCost)variableCost).setMaxX(controller.getGraveyard().size());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SimpleActivatedAbility) {
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
for(Cost cost: ability.getCosts()) {
|
||||
if (cost instanceof ExileFromGraveCost) {
|
||||
ExileFromGraveCost exileCost = (ExileFromGraveCost) cost;
|
||||
for(Target target: exileCost.getTargets()) {
|
||||
if (target instanceof TargetCardInYourGraveyard) {
|
||||
target.setMaxNumberOfTargets(xValue);
|
||||
target.setMinNumberOfTargets(xValue);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public NecropolisFiend(final NecropolisFiend card) {
|
||||
super(card);
|
||||
}
|
||||
|
@ -103,3 +80,41 @@ public final class NecropolisFiend extends CardImpl {
|
|||
return new NecropolisFiend(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum NecropolisFiendCostAdjuster implements CostAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
Player controller = game.getPlayer(ability.getControllerId());
|
||||
if (controller == null) {
|
||||
return;
|
||||
}
|
||||
for (VariableCost variableCost : ability.getManaCostsToPay().getVariableCosts()) {
|
||||
if (variableCost instanceof VariableManaCost) {
|
||||
((VariableManaCost) variableCost).setMaxX(controller.getGraveyard().size());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum NecropolisFiendTargetAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
for (Cost cost : ability.getCosts()) {
|
||||
if (!(cost instanceof ExileFromGraveCost)) {
|
||||
continue;
|
||||
}
|
||||
ExileFromGraveCost exileCost = (ExileFromGraveCost) cost;
|
||||
for (Target target : exileCost.getTargets()) {
|
||||
if (target instanceof TargetCardInYourGraveyard) {
|
||||
target.setMaxNumberOfTargets(xValue);
|
||||
target.setMinNumberOfTargets(xValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.n;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.common.DiesAttachedTriggeredAbility;
|
||||
|
@ -15,35 +14,24 @@ import mage.abilities.keyword.EnchantAbility;
|
|||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.AttachmentType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.common.TargetOpponentsCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public final class NecroticPlague extends CardImpl {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature an opponent controls");
|
||||
|
||||
static {
|
||||
filter.add(new ControllerPredicate(TargetController.OPPONENT));
|
||||
}
|
||||
|
||||
public NecroticPlague(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{B}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}{B}");
|
||||
|
||||
this.subtype.add(SubType.AURA);
|
||||
|
||||
|
@ -53,33 +41,18 @@ public final class NecroticPlague extends CardImpl {
|
|||
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment));
|
||||
Ability ability = new EnchantAbility(auraTarget.getTargetName());
|
||||
this.addAbility(ability);
|
||||
|
||||
// Enchanted creature has "At the beginning of your upkeep, sacrifice this creature."
|
||||
// When enchanted creature dies, its controller chooses target creature one of their opponents controls. Return Necrotic Plague from its owner's graveyard to the battlefield attached to that creature.
|
||||
Ability gainedAbility = new BeginningOfUpkeepTriggeredAbility(new SacrificeSourceEffect(), TargetController.YOU, false);
|
||||
Effect effect = new GainAbilityAttachedEffect(gainedAbility, AttachmentType.AURA, Duration.WhileOnBattlefield);
|
||||
ability = new BeginningOfUpkeepTriggeredAbility(new SacrificeSourceEffect(), TargetController.YOU, false);
|
||||
Effect effect = new GainAbilityAttachedEffect(ability, AttachmentType.AURA, Duration.WhileOnBattlefield);
|
||||
effect.setText("Enchanted creature has \"At the beginning of your upkeep, sacrifice this creature.\"");
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
|
||||
this.addAbility(new DiesAttachedTriggeredAbility(new NecroticPlagueEffect(), "enchanted creature", false));
|
||||
|
||||
}
|
||||
ability = new DiesAttachedTriggeredAbility(new NecroticPlagueEffect(), "enchanted creature", false);
|
||||
ability.setTargetAdjuster(NecroticPlagueAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof DiesAttachedTriggeredAbility) {
|
||||
Permanent attachedTo = null;
|
||||
for (Effect effect : ability.getEffects()) {
|
||||
attachedTo = (Permanent) effect.getValue("attachedTo");
|
||||
}
|
||||
if (attachedTo != null) {
|
||||
Player creatureController = game.getPlayer(attachedTo.getControllerId());
|
||||
if (creatureController != null) {
|
||||
ability.setControllerId(creatureController.getId());
|
||||
ability.getTargets().clear();
|
||||
TargetPermanent target = new TargetPermanent(filter);
|
||||
ability.getTargets().add(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public NecroticPlague(final NecroticPlague card) {
|
||||
|
@ -93,11 +66,35 @@ public final class NecroticPlague extends CardImpl {
|
|||
|
||||
}
|
||||
|
||||
enum NecroticPlagueAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
Permanent attachedTo = null;
|
||||
for (Effect effect : ability.getEffects()) {
|
||||
attachedTo = (Permanent) effect.getValue("attachedTo");
|
||||
}
|
||||
if (attachedTo == null) {
|
||||
return;
|
||||
}
|
||||
Player creatureController = game.getPlayer(attachedTo.getControllerId());
|
||||
if (creatureController == null) {
|
||||
return;
|
||||
}
|
||||
ability.setControllerId(creatureController.getId());
|
||||
ability.getTargets().clear();
|
||||
TargetPermanent target = new TargetOpponentsCreaturePermanent();
|
||||
ability.getTargets().add(target);
|
||||
}
|
||||
}
|
||||
|
||||
class NecroticPlagueEffect extends OneShotEffect {
|
||||
|
||||
public NecroticPlagueEffect() {
|
||||
super(Outcome.PutCardInPlay);
|
||||
staticText = "its controller chooses target creature one of their opponents controls. Return {this} from its owner's graveyard to the battlefield attached to that creature";
|
||||
staticText = "its controller chooses target creature one of their opponents controls. " +
|
||||
"Return {this} from its owner's graveyard to the battlefield attached to that creature";
|
||||
}
|
||||
|
||||
public NecroticPlagueEffect(final NecroticPlagueEffect effect) {
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
package mage.cards.n;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.costs.common.DiscardXTargetCost;
|
||||
import mage.abilities.dynamicvalue.common.GetXValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
|
@ -15,11 +13,12 @@ import mage.constants.CardType;
|
|||
import mage.filter.FilterCard;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class NostalgicDreams extends CardImpl {
|
||||
|
@ -33,27 +32,31 @@ public final class NostalgicDreams extends CardImpl {
|
|||
Effect effect = new ReturnFromGraveyardToHandTargetEffect();
|
||||
effect.setText("Return X target cards from your graveyard to your hand");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
this.getSpellAbility().setTargetAdjuster(NostalgicDreamsAdjuster.instance);
|
||||
|
||||
// Exile Nostalgic Dreams.
|
||||
this.getSpellAbility().addEffect(ExileSpellEffect.getInstance());
|
||||
|
||||
}
|
||||
|
||||
public NostalgicDreams(final NostalgicDreams card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
int xValue = new GetXValue().calculate(game, ability, null);
|
||||
Target target = new TargetCardInYourGraveyard(xValue, StaticFilters.FILTER_CARD_FROM_YOUR_GRAVEYARD);
|
||||
ability.addTarget(target);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public NostalgicDreams copy() {
|
||||
return new NostalgicDreams(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum NostalgicDreamsAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetCardInYourGraveyard(
|
||||
new GetXValue().calculate(game, ability, null),
|
||||
StaticFilters.FILTER_CARD_FROM_YOUR_GRAVEYARD
|
||||
));
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.n;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
|
||||
import mage.abilities.effects.common.continuous.BoostAllEffect;
|
||||
|
@ -10,42 +9,45 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardIdPredicate;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class NoxiousGhoul extends CardImpl {
|
||||
|
||||
final FilterPermanent filter = new FilterPermanent("Noxious Ghoul or another Zombie");
|
||||
final FilterCreaturePermanent filter2 = new FilterCreaturePermanent("non-Zombie");
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||
private static final FilterPermanent filter2 = new FilterPermanent();
|
||||
|
||||
static {
|
||||
filter.add(new CardTypePredicate(CardType.CREATURE));
|
||||
filter.add(Predicates.not(new SubtypePredicate(SubType.ZOMBIE)));
|
||||
filter2.add(NoxiousGhoulPredicate.instance);
|
||||
}
|
||||
|
||||
public NoxiousGhoul(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{B}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}{B}");
|
||||
this.subtype.add(SubType.ZOMBIE);
|
||||
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
filter.add(Predicates.or(
|
||||
new CardIdPredicate(this.getId()),
|
||||
new SubtypePredicate(SubType.ZOMBIE)));
|
||||
|
||||
filter2.add(new CardTypePredicate(CardType.CREATURE));
|
||||
filter2.add(Predicates.not(
|
||||
new SubtypePredicate(SubType.ZOMBIE)));
|
||||
|
||||
final String rule = "Whenever {this} or another Zombie enters the battlefield, all non-Zombie creatures get -1/-1 until end of turn.";
|
||||
|
||||
// Whenever Noxious Ghoul or another Zombie enters the battlefield, all non-Zombie creatures get -1/-1 until end of turn.
|
||||
this.addAbility(new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD, new BoostAllEffect(-1, -1, Duration.EndOfTurn, filter2, false), filter, false, rule));
|
||||
this.addAbility(new EntersBattlefieldAllTriggeredAbility(
|
||||
new BoostAllEffect(-1, -1, Duration.EndOfTurn, filter, false),
|
||||
filter2, "Whenever {this} or another Zombie enters the battlefield, " +
|
||||
"all non-Zombie creatures get -1/-1 until end of turn."
|
||||
));
|
||||
}
|
||||
|
||||
public NoxiousGhoul(final NoxiousGhoul card) {
|
||||
|
@ -57,3 +59,13 @@ public final class NoxiousGhoul extends CardImpl {
|
|||
return new NoxiousGhoul(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum NoxiousGhoulPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Permanent>> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
|
||||
return input.getObject().hasSubtype(SubType.ZOMBIE, game)
|
||||
|| input.getObject().getId().equals(input.getSourceId());
|
||||
}
|
||||
}
|
|
@ -1,15 +1,10 @@
|
|||
|
||||
package mage.cards.o;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.cards.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetController;
|
||||
|
@ -21,20 +16,15 @@ import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Plopman
|
||||
*/
|
||||
public final class OathOfDruids extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
private static final FilterPlayer filter = new FilterPlayer();
|
||||
|
||||
static {
|
||||
filter.add(new OathOfDruidsPredicate());
|
||||
}
|
||||
|
||||
public OathOfDruids(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}");
|
||||
|
||||
|
@ -42,27 +32,12 @@ public final class OathOfDruids extends CardImpl {
|
|||
// The first player may reveal cards from the top of their library until he or she reveals a creature card.
|
||||
// If he or she does, that player puts that card onto the battlefield and all other cards revealed this way into their graveyard.
|
||||
Ability ability = new BeginningOfUpkeepTriggeredAbility(new OathOfDruidsEffect(), TargetController.ANY, false);
|
||||
ability.addTarget(new TargetPlayer(1, 1, false, filter));
|
||||
originalId = ability.getOriginalId();
|
||||
ability.setTargetAdjuster(OathOfDruidsAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
Player activePlayer = game.getPlayer(game.getActivePlayerId());
|
||||
if (activePlayer != null) {
|
||||
ability.getTargets().clear();
|
||||
TargetPlayer target = new TargetPlayer(1, 1, false, filter);
|
||||
target.setTargetController(activePlayer.getId());
|
||||
ability.getTargets().add(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public OathOfDruids(final OathOfDruids card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -71,6 +46,26 @@ public final class OathOfDruids extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum OathOfDruidsAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
private static final FilterPlayer filter = new FilterPlayer();
|
||||
|
||||
static {
|
||||
filter.add(new OathOfDruidsPredicate());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
Player activePlayer = game.getPlayer(game.getActivePlayerId());
|
||||
if (activePlayer != null) {
|
||||
ability.getTargets().clear();
|
||||
TargetPlayer target = new TargetPlayer(1, 1, false, filter);
|
||||
target.setTargetController(activePlayer.getId());
|
||||
ability.getTargets().add(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class OathOfDruidsPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Player>> {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.o;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
|
@ -15,57 +14,36 @@ import mage.constants.TargetController;
|
|||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.FilterPlayer;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.filter.predicate.other.OwnerIdPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.target.common.TargetCardInGraveyard;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class OathOfGhouls extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
private static final FilterPlayer filter = new FilterPlayer();
|
||||
|
||||
static {
|
||||
filter.add(new OathOfGhoulsPredicate());
|
||||
}
|
||||
|
||||
public OathOfGhouls(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}");
|
||||
|
||||
// At the beginning of each player's upkeep, that player chooses target player whose graveyard has fewer creature cards in it than their graveyard does and is their opponent. The first player may return a creature card from their graveyard to their hand.
|
||||
Ability ability = new BeginningOfUpkeepTriggeredAbility(new OathOfGhoulsEffect(), TargetController.ANY, false);
|
||||
ability.addTarget(new TargetPlayer(1, 1, false, filter));
|
||||
ability.setTargetAdjuster(OathOfGhoulsAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
originalId = ability.getOriginalId();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
Player activePlayer = game.getPlayer(game.getActivePlayerId());
|
||||
if (activePlayer != null) {
|
||||
ability.getTargets().clear();
|
||||
TargetPlayer target = new TargetPlayer(1, 1, false, filter);
|
||||
target.setTargetController(activePlayer.getId());
|
||||
ability.getTargets().add(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public OathOfGhouls(final OathOfGhouls card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -74,14 +52,28 @@ public final class OathOfGhouls extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class OathOfGhoulsPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Player>> {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("creature cards");
|
||||
enum OathOfGhoulsAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
private static final FilterPlayer filter = new FilterPlayer();
|
||||
|
||||
static {
|
||||
filter.add(new CardTypePredicate(CardType.CREATURE));
|
||||
filter.add(new OathOfGhoulsPredicate());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
Player activePlayer = game.getPlayer(game.getActivePlayerId());
|
||||
if (activePlayer != null) {
|
||||
ability.getTargets().clear();
|
||||
TargetPlayer target = new TargetPlayer(1, 1, false, filter);
|
||||
target.setTargetController(activePlayer.getId());
|
||||
ability.getTargets().add(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class OathOfGhoulsPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Player>> {
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectSourcePlayer<Player> input, Game game) {
|
||||
Player targetPlayer = input.getObject();
|
||||
|
@ -91,8 +83,8 @@ class OathOfGhoulsPredicate implements ObjectSourcePlayerPredicate<ObjectSourceP
|
|||
|| !firstPlayer.hasOpponent(targetPlayer.getId(), game)) {
|
||||
return false;
|
||||
}
|
||||
int countGraveyardTargetPlayer = targetPlayer.getGraveyard().getCards(filter, game).size();
|
||||
int countGraveyardFirstPlayer = firstPlayer.getGraveyard().getCards(filter, game).size();
|
||||
int countGraveyardTargetPlayer = targetPlayer.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, game).size();
|
||||
int countGraveyardFirstPlayer = firstPlayer.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, game).size();
|
||||
|
||||
return countGraveyardTargetPlayer < countGraveyardFirstPlayer;
|
||||
}
|
||||
|
@ -105,13 +97,6 @@ class OathOfGhoulsPredicate implements ObjectSourcePlayerPredicate<ObjectSourceP
|
|||
|
||||
class OathOfGhoulsEffect extends OneShotEffect {
|
||||
|
||||
// private static final FilterCard filter = new FilterCard("creature card");
|
||||
//
|
||||
// static {
|
||||
// filter.add(new CardTypePredicate(CardType.CREATURE));
|
||||
// filter.add(new OwnerPredicate(TargetController.ACTIVE));
|
||||
// }
|
||||
|
||||
public OathOfGhoulsEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "that player chooses target player whose graveyard has fewer creature cards in it than their graveyard does and is their opponent. The first player may return a creature card from their graveyard to their hand";
|
||||
|
@ -132,8 +117,7 @@ class OathOfGhoulsEffect extends OneShotEffect {
|
|||
filter.add(new OwnerIdPredicate(firstPlayer.getId()));
|
||||
Target target = new TargetCardInGraveyard(filter);
|
||||
target.setNotTarget(true);
|
||||
// target.setTargetController(firstPlayer.getId());
|
||||
if (target.canChoose(source.getSourceId(),firstPlayer.getId(), game)
|
||||
if (target.canChoose(source.getSourceId(), firstPlayer.getId(), game)
|
||||
&& firstPlayer.chooseUse(outcome, "Return a creature card from your graveyard to your hand?", source, game)
|
||||
&& firstPlayer.chooseTarget(Outcome.ReturnToHand, target, source, game)) {
|
||||
Card card = game.getCard(target.getFirstTarget());
|
||||
|
|
|
@ -12,7 +12,6 @@ import mage.constants.Outcome;
|
|||
import mage.constants.TargetController;
|
||||
import mage.filter.FilterPlayer;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterLandPermanent;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
|
@ -20,6 +19,7 @@ import mage.players.Player;
|
|||
import mage.target.Target;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -29,29 +29,15 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class OathOfLieges extends CardImpl {
|
||||
|
||||
private static final FilterPlayer FILTER = new FilterPlayer("player who controls more lands than you do and is your opponent");
|
||||
|
||||
static {
|
||||
FILTER.add(new OathOfLiegesPredicate());
|
||||
}
|
||||
|
||||
public OathOfLieges(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
|
||||
|
||||
// At the beginning of each player's upkeep, that player chooses target player who controls more lands than he or she does and is their opponent. The first player may search their library for a basic land card, put that card onto the battlefield, then shuffle their library.
|
||||
Ability ability = new BeginningOfUpkeepTriggeredAbility(new OathOfLiegesEffect(), TargetController.ANY, false);
|
||||
ability.addTarget(new TargetPlayer(1, 1, false, FILTER));
|
||||
ability.setTargetAdjuster(OathOfLiegesAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
// target controller must be active player (even for copies)
|
||||
for (Target target : ability.getTargets()) {
|
||||
target.setTargetController(game.getActivePlayerId());
|
||||
}
|
||||
}
|
||||
|
||||
public OathOfLieges(final OathOfLieges card) {
|
||||
super(card);
|
||||
}
|
||||
|
@ -62,6 +48,26 @@ public final class OathOfLieges extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum OathOfLiegesAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
private static final FilterPlayer FILTER = new FilterPlayer("player who controls more lands than you do and is your opponent");
|
||||
|
||||
static {
|
||||
FILTER.add(new OathOfLiegesPredicate());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
Player activePlayer = game.getPlayer(game.getActivePlayerId());
|
||||
if (activePlayer != null) {
|
||||
ability.getTargets().clear();
|
||||
TargetPlayer target = new TargetPlayer(1, 1, false, FILTER);
|
||||
target.setTargetController(activePlayer.getId());
|
||||
ability.getTargets().add(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class OathOfLiegesEffect extends OneShotEffect {
|
||||
|
||||
public OathOfLiegesEffect() {
|
||||
|
@ -97,29 +103,20 @@ class OathOfLiegesEffect extends OneShotEffect {
|
|||
|
||||
class OathOfLiegesPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Player>> {
|
||||
|
||||
private static final FilterLandPermanent FILTER = new FilterLandPermanent();
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectSourcePlayer<Player> input, Game game) {
|
||||
// input.getPlayerId() -- source controller id
|
||||
// input.getObject() -- checking player
|
||||
|
||||
Player targetPlayer = input.getObject();
|
||||
//Get active input.playerId because adjust target is used after canTarget function
|
||||
Player activePlayer = game.getPlayer(game.getActivePlayerId());
|
||||
|
||||
if (targetPlayer == null || activePlayer == null) {
|
||||
UUID activePlayerId = game.getActivePlayerId();
|
||||
if (targetPlayer == null || activePlayerId == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// must be opponent
|
||||
if (!activePlayer.hasOpponent(targetPlayer.getId(), game)) {
|
||||
if (!targetPlayer.hasOpponent(activePlayerId, game)) {
|
||||
return false;
|
||||
}
|
||||
int countTargetPlayer = game.getBattlefield().countAll(StaticFilters.FILTER_LAND, targetPlayer.getId(), game);
|
||||
int countActivePlayer = game.getBattlefield().countAll(StaticFilters.FILTER_LAND, activePlayerId, game);
|
||||
|
||||
// must have more lands than active player
|
||||
int countTargetPlayer = game.getBattlefield().countAll(FILTER, targetPlayer.getId(), game);
|
||||
int countActivePlayer = game.getBattlefield().countAll(FILTER, activePlayer.getId(), game);
|
||||
return countTargetPlayer > countActivePlayer;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.o;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
|
@ -17,46 +16,26 @@ import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class OathOfMages extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
private static final FilterPlayer filter = new FilterPlayer();
|
||||
|
||||
static {
|
||||
filter.add(new OathOfMagesPredicate());
|
||||
}
|
||||
|
||||
public OathOfMages(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}");
|
||||
|
||||
// At the beginning of each player's upkeep, that player chooses target player who has more life than he or she does and is their opponent. The first player may have Oath of Mages deal 1 damage to the second player.
|
||||
Ability ability = new BeginningOfUpkeepTriggeredAbility(new OathOfMagesEffect(), TargetController.ANY, false);
|
||||
ability.addTarget(new TargetPlayer(1, 1, false, filter));
|
||||
ability.setTargetAdjuster(OathOfMagesAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
originalId = ability.getOriginalId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
Player activePlayer = game.getPlayer(game.getActivePlayerId());
|
||||
if (activePlayer != null) {
|
||||
ability.getTargets().clear();
|
||||
TargetPlayer target = new TargetPlayer(1, 1, false, filter);
|
||||
target.setTargetController(activePlayer.getId());
|
||||
ability.getTargets().add(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public OathOfMages(final OathOfMages card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -65,6 +44,26 @@ public final class OathOfMages extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum OathOfMagesAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
private static final FilterPlayer filter = new FilterPlayer();
|
||||
|
||||
static {
|
||||
filter.add(new OathOfMagesPredicate());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
Player activePlayer = game.getPlayer(game.getActivePlayerId());
|
||||
if (activePlayer != null) {
|
||||
ability.getTargets().clear();
|
||||
TargetPlayer target = new TargetPlayer(1, 1, false, filter);
|
||||
target.setTargetController(activePlayer.getId());
|
||||
ability.getTargets().add(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class OathOfMagesPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Player>> {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.o;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
|
@ -17,47 +16,26 @@ import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class OathOfScholars extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
private static final FilterPlayer filter = new FilterPlayer();
|
||||
|
||||
static {
|
||||
filter.add(new OathOfScholarsPredicate());
|
||||
}
|
||||
|
||||
public OathOfScholars(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}");
|
||||
|
||||
// At the beginning of each player's upkeep, that player chooses target player who has more cards in hand than he or she does and is their opponent. The first player may discard their hand and draw three cards.
|
||||
Ability ability = new BeginningOfUpkeepTriggeredAbility(new OathOfScholarsEffect(), TargetController.ANY, false);
|
||||
ability.addTarget(new TargetPlayer(1, 1, false, filter));
|
||||
ability.setTargetAdjuster(OathOfScholarsAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
originalId = ability.getOriginalId();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
Player activePlayer = game.getPlayer(game.getActivePlayerId());
|
||||
if (activePlayer != null) {
|
||||
ability.getTargets().clear();
|
||||
TargetPlayer target = new TargetPlayer(1, 1, false, filter);
|
||||
target.setTargetController(activePlayer.getId());
|
||||
ability.getTargets().add(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public OathOfScholars(final OathOfScholars card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -66,6 +44,26 @@ public final class OathOfScholars extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum OathOfScholarsAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
private static final FilterPlayer filter = new FilterPlayer();
|
||||
|
||||
static {
|
||||
filter.add(new OathOfScholarsPredicate());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
Player activePlayer = game.getPlayer(game.getActivePlayerId());
|
||||
if (activePlayer != null) {
|
||||
ability.getTargets().clear();
|
||||
TargetPlayer target = new TargetPlayer(1, 1, false, filter);
|
||||
target.setTargetController(activePlayer.getId());
|
||||
ability.getTargets().add(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class OathOfScholarsPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Player>> {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
package mage.cards.o;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
|
@ -13,12 +11,13 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class OpenIntoWonder extends CardImpl {
|
||||
|
@ -30,28 +29,28 @@ public final class OpenIntoWonder extends CardImpl {
|
|||
Effect effect = new CantBeBlockedTargetEffect(Duration.EndOfTurn);
|
||||
effect.setText("X target creatures can't be blocked this turn");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, 1, StaticFilters.FILTER_PERMANENT_CREATURE, false));
|
||||
Ability abilityToGain = new DealsCombatDamageToAPlayerTriggeredAbility(new DrawCardSourceControllerEffect(1), false);
|
||||
this.getSpellAbility().addEffect(new GainAbilityTargetEffect(abilityToGain, Duration.EndOfTurn,
|
||||
"Until end of turn, those creatures gain \"Whenever this creature deals combat damage to a player, draw a card.\""));
|
||||
this.getSpellAbility().setTargetAdjuster(OpenIntoWonderAdjuster.instance);
|
||||
}
|
||||
|
||||
public OpenIntoWonder(final OpenIntoWonder card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
ability.getTargets().clear();
|
||||
int numberOfTargets = ability.getManaCostsToPay().getX();
|
||||
numberOfTargets = Math.min(game.getBattlefield().count(StaticFilters.FILTER_PERMANENT_CREATURE, ability.getSourceId(), ability.getControllerId(), game), numberOfTargets);
|
||||
ability.addTarget(new TargetCreaturePermanent(numberOfTargets));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public OpenIntoWonder copy() {
|
||||
return new OpenIntoWonder(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum OpenIntoWonderAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetCreaturePermanent(ability.getManaCostsToPay().getX()));
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.o;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
|
@ -22,10 +21,11 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Styxo
|
||||
*/
|
||||
public final class OpenSeason extends CardImpl {
|
||||
|
@ -37,7 +37,7 @@ public final class OpenSeason extends CardImpl {
|
|||
Effect effect = new AddCountersTargetEffect(CounterType.BOUNTY.createInstance());
|
||||
effect.setText("for each opponent, put a bounty counter on target creature that player controls");
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(effect);
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
ability.setTargetAdjuster(OpenSeasonAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
|
||||
// Creatures your opponent control with bounty counters on them can't activate abilities
|
||||
|
@ -48,19 +48,6 @@ public final class OpenSeason extends CardImpl {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof EntersBattlefieldTriggeredAbility) {
|
||||
ability.getTargets().clear();
|
||||
for (UUID opponentId : game.getOpponents(ability.getControllerId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
if (opponent != null) {
|
||||
ability.addTarget(new TargetPermanent(new FilterCreaturePermanent("creature from opponent " + opponent.getLogName())));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public OpenSeason(final OpenSeason card) {
|
||||
super(card);
|
||||
}
|
||||
|
@ -71,6 +58,21 @@ public final class OpenSeason extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum OpenSeasonAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
for (UUID opponentId : game.getOpponents(ability.getControllerId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
if (opponent != null) {
|
||||
ability.addTarget(new TargetPermanent(new FilterCreaturePermanent("creature from opponent " + opponent.getLogName())));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class OpenSeasonRestrictionEffect extends RestrictionEffect {
|
||||
|
||||
public OpenSeasonRestrictionEffect() {
|
||||
|
|
|
@ -3,7 +3,6 @@ package mage.cards.o;
|
|||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.condition.common.KickedCondition;
|
||||
import mage.abilities.decorator.ConditionalOneShotEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -18,17 +17,17 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class OrimsThunder extends CardImpl {
|
||||
|
||||
public OrimsThunder(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{W}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{W}");
|
||||
|
||||
// Kicker {R}
|
||||
this.addAbility(new KickerAbility("{R}"));
|
||||
|
@ -39,16 +38,9 @@ public final class OrimsThunder extends CardImpl {
|
|||
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
|
||||
new OrimsThunderEffect2(),
|
||||
KickedCondition.instance,
|
||||
"If Orim's Thunder was kicked, it deals damage equal to that permanent's converted mana cost to target creature"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
if (KickedCondition.instance.apply(game, ability)) {
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
}
|
||||
}
|
||||
"If Orim's Thunder was kicked, it deals damage equal to that permanent's converted mana cost to target creature")
|
||||
);
|
||||
this.getSpellAbility().setTargetAdjuster(OrimsThunderAdjuster.instance);
|
||||
}
|
||||
|
||||
public OrimsThunder(final OrimsThunder card) {
|
||||
|
@ -61,6 +53,18 @@ public final class OrimsThunder extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum OrimsThunderAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (KickedCondition.instance.apply(game, ability)) {
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class OrimsThunderEffect2 extends OneShotEffect {
|
||||
|
||||
OrimsThunderEffect2() {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.p;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -16,39 +15,31 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetAnyTarget;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class Pandemonium extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
|
||||
public Pandemonium(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{R}");
|
||||
|
||||
// Whenever a creature enters the battlefield, that creature's controller may have it deal damage equal to its power to any target of their choice.
|
||||
Ability ability = new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD, new PandemoniumEffect(), StaticFilters.FILTER_PERMANENT_CREATURE, false, SetTargetPointer.PERMANENT, "");
|
||||
Ability ability = new EntersBattlefieldAllTriggeredAbility(
|
||||
Zone.BATTLEFIELD, new PandemoniumEffect(),
|
||||
StaticFilters.FILTER_PERMANENT_CREATURE,
|
||||
false, SetTargetPointer.PERMANENT, ""
|
||||
);
|
||||
ability.addTarget(new TargetAnyTarget());
|
||||
originalId = ability.getOriginalId();
|
||||
ability.setTargetAdjuster(PandemoniumAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
public Pandemonium(final Pandemonium card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
UUID creatureId = ability.getEffects().get(0).getTargetPointer().getFirst(game, ability);
|
||||
Permanent creature = game.getPermanent(creatureId);
|
||||
if (creature != null) {
|
||||
ability.getTargets().get(0).setTargetController(creature.getControllerId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -57,6 +48,19 @@ public final class Pandemonium extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum PandemoniumAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
UUID creatureId = ability.getEffects().get(0).getTargetPointer().getFirst(game, ability);
|
||||
Permanent creature = game.getPermanent(creatureId);
|
||||
if (creature != null) {
|
||||
ability.getTargets().get(0).setTargetController(creature.getControllerId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class PandemoniumEffect extends OneShotEffect {
|
||||
|
||||
public PandemoniumEffect() {
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
package mage.cards.p;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
|
||||
import mage.abilities.keyword.IslandwalkAbility;
|
||||
|
@ -11,34 +9,26 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fireshoes
|
||||
*/
|
||||
public final class PartWater extends CardImpl {
|
||||
|
||||
public PartWater(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{X}{X}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{X}{U}");
|
||||
|
||||
// X target creatures gain islandwalk until end of turn.
|
||||
Effect effect = new GainAbilityTargetEffect(new IslandwalkAbility(false), Duration.EndOfTurn);
|
||||
effect.setText("X target creatures gain islandwalk until end of turn");
|
||||
this.getSpellAbility().getEffects().add(effect);
|
||||
this.getSpellAbility().getTargets().add(new TargetCreaturePermanent(1,1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
ability.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures gain islandwalk until end of turn");
|
||||
ability.getTargets().add(new TargetCreaturePermanent(0, xValue, filter, false));
|
||||
}
|
||||
this.getSpellAbility().getTargets().add(new TargetCreaturePermanent());
|
||||
this.getSpellAbility().setTargetAdjuster(PartWaterAdjuster.instance);
|
||||
}
|
||||
|
||||
public PartWater(final PartWater card) {
|
||||
|
@ -50,3 +40,13 @@ public final class PartWater extends CardImpl {
|
|||
return new PartWater(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum PartWaterAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
ability.getTargets().add(new TargetCreaturePermanent(ability.getManaCostsToPay().getX()));
|
||||
}
|
||||
}
|
|
@ -21,14 +21,13 @@ import mage.util.functions.ApplyToPermanent;
|
|||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
*/
|
||||
public final class PhantasmalImage extends CardImpl {
|
||||
|
||||
private static final String effectText = "a copy of any creature on the battlefield, except it's an Illusion in addition to its other types and it has \"When this creature becomes the target of a spell or ability, sacrifice it.\"";
|
||||
|
||||
ApplyToPermanent phantasmalImageApplier = new ApplyToPermanent() {
|
||||
private static final ApplyToPermanent phantasmalImageApplier = new ApplyToPermanent() {
|
||||
@Override
|
||||
public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) {
|
||||
if (!permanent.hasSubtype(SubType.ILLUSION, game)) {
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
|
||||
package mage.cards.p;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.costs.CostAdjuster;
|
||||
import mage.abilities.costs.common.PayLifeCost;
|
||||
import mage.abilities.effects.common.DestroyMultiTargetEffect;
|
||||
import mage.abilities.effects.common.InfoEffect;
|
||||
|
@ -13,9 +12,11 @@ import mage.constants.CardType;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author escplan9 - Derek Monturo
|
||||
*/
|
||||
public final class PhyrexianPurge extends CardImpl {
|
||||
|
@ -28,26 +29,8 @@ public final class PhyrexianPurge extends CardImpl {
|
|||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, Integer.MAX_VALUE));
|
||||
this.getSpellAbility().addEffect(new DestroyMultiTargetEffect());
|
||||
this.getSpellAbility().addEffect(new InfoEffect("<br><br>{this} costs 3 life more to cast for each target"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
int numTargets = ability.getTargets().get(0).getTargets().size();
|
||||
if (numTargets > 0) {
|
||||
ability.getCosts().add(new PayLifeCost(numTargets * 3));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
ability.getTargets().clear();
|
||||
Player you = game.getPlayer(ownerId);
|
||||
if(you != null) {
|
||||
int maxTargets = you.getLife() / 3;
|
||||
ability.addTarget(new TargetCreaturePermanent(0, maxTargets));
|
||||
}
|
||||
}
|
||||
this.getSpellAbility().setTargetAdjuster(PhyrexianPurgeTargetAdjuster.instance);
|
||||
this.getSpellAbility().setCostAdjuster(PhyrexianPurgeCostAdjuster.instance);
|
||||
}
|
||||
|
||||
public PhyrexianPurge(final PhyrexianPurge card) {
|
||||
|
@ -59,3 +42,27 @@ public final class PhyrexianPurge extends CardImpl {
|
|||
return new PhyrexianPurge(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum PhyrexianPurgeCostAdjuster implements CostAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
int numTargets = ability.getTargets().get(0).getTargets().size();
|
||||
if (numTargets > 0) {
|
||||
ability.getCosts().add(new PayLifeCost(numTargets * 3));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum PhyrexianPurgeTargetAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
Player you = game.getPlayer(ability.getControllerId());
|
||||
int maxTargets = you.getLife() / 3;
|
||||
ability.addTarget(new TargetCreaturePermanent(0, maxTargets));
|
||||
}
|
||||
}
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.p;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -17,39 +16,30 @@ import mage.filter.common.FilterControlledLandPermanent;
|
|||
import mage.game.Game;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
import mage.target.common.TargetAnyTargetAmount;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LoneFox
|
||||
|
||||
*
|
||||
*/
|
||||
public final class PollenRemedy extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
|
||||
public PollenRemedy(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{W}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{W}");
|
||||
|
||||
// Kicker-Sacrifice a land.
|
||||
this.addAbility(new KickerAbility(new SacrificeTargetCost(new TargetControlledPermanent(1, 1, new FilterControlledLandPermanent("a land"), true))));
|
||||
// Prevent the next 3 damage that would be dealt this turn to any number of target creatures and/or players, divided as you choose. If Pollen Remedy was kicked, prevent the next 6 damage this way instead.
|
||||
Effect effect = new ConditionalReplacementEffect(new PreventDamageToTargetMultiAmountEffect(Duration.EndOfTurn, 6),
|
||||
KickedCondition.instance, new PreventDamageToTargetMultiAmountEffect(Duration.EndOfTurn, 3));
|
||||
KickedCondition.instance, new PreventDamageToTargetMultiAmountEffect(Duration.EndOfTurn, 3));
|
||||
effect.setText("Prevent the next 3 damage that would be dealt this turn to any number of targets, divided as you choose. if this spell was kicked, prevent the next 6 damage this way instead.");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
originalId = this.getSpellAbility().getOriginalId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if(ability.getOriginalId().equals(originalId)) {
|
||||
ability.addTarget(new TargetAnyTargetAmount(KickedCondition.instance.apply(game, ability) ? 6 : 3));
|
||||
}
|
||||
this.getSpellAbility().setTargetAdjuster(PollenRemedyAdjuster.instance);
|
||||
}
|
||||
|
||||
public PollenRemedy(final PollenRemedy card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -57,3 +47,12 @@ public final class PollenRemedy extends CardImpl {
|
|||
return new PollenRemedy(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum PollenRemedyAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.addTarget(new TargetAnyTargetAmount(KickedCondition.instance.apply(game, ability) ? 6 : 3));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
|
||||
package mage.cards.p;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BecomesMonstrousSourceTriggeredAbility;
|
||||
|
@ -12,47 +9,44 @@ import mage.abilities.keyword.MonstrosityAbility;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetCreaturePermanentAmount;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* * The value of X in Polukranos's last ability is equal to the value chosen
|
||||
* for X when its activated ability was activated.
|
||||
*
|
||||
* for X when its activated ability was activated.
|
||||
* <p>
|
||||
* * The number of targets chosen for the triggered ability must be at least one
|
||||
* (if X wasn't 0) and at most X. You choose the division of damage as you put
|
||||
* the ability on the stack, not as it resolves. Each target must be assigned
|
||||
* at least 1 damage. In multiplayer games, you may choose creatures controlled
|
||||
* by different opponents.
|
||||
*
|
||||
* (if X wasn't 0) and at most X. You choose the division of damage as you put
|
||||
* the ability on the stack, not as it resolves. Each target must be assigned
|
||||
* at least 1 damage. In multiplayer games, you may choose creatures controlled
|
||||
* by different opponents.
|
||||
* <p>
|
||||
* * If some, but not all, of the ability's targets become illegal, you can't change
|
||||
* the division of damage. Damage that would've been dealt to illegal targets
|
||||
* simply isn't dealt.
|
||||
*
|
||||
* the division of damage. Damage that would've been dealt to illegal targets
|
||||
* simply isn't dealt.
|
||||
* <p>
|
||||
* * As Polukranos's triggered ability resolves, Polukranos deals damage first, then
|
||||
* the target creatures do. Although no creature will die until after the ability
|
||||
* finishes resolving, the order could matter if Polukranos has wither or infect.
|
||||
* the target creatures do. Although no creature will die until after the ability
|
||||
* finishes resolving, the order could matter if Polukranos has wither or infect.
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class PolukranosWorldEater extends CardImpl {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||
static {
|
||||
filter.add(new ControllerPredicate(TargetController.OPPONENT));
|
||||
}
|
||||
|
||||
public PolukranosWorldEater(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{G}{G}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}{G}");
|
||||
addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.HYDRA);
|
||||
|
||||
|
@ -61,20 +55,11 @@ public final class PolukranosWorldEater extends CardImpl {
|
|||
|
||||
// {X}{X}{G}: Monstrosity X.
|
||||
this.addAbility(new MonstrosityAbility("{X}{X}{G}", Integer.MAX_VALUE));
|
||||
|
||||
// When Polukranos, World Eater becomes monstrous, it deals X damage divided as you choose among any number of target creatures your opponents control. Each of those creatures deals damage equal to its power to Polukranos.
|
||||
Ability ability = new BecomesMonstrousSourceTriggeredAbility(new PolukranosWorldEaterEffect());
|
||||
ability.addTarget(new TargetCreaturePermanentAmount(1, filter));
|
||||
ability.setTargetAdjuster(PolukranosWorldEaterAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof BecomesMonstrousSourceTriggeredAbility) {
|
||||
int xValue = ((BecomesMonstrousSourceTriggeredAbility) ability).getMonstrosityValue();
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetCreaturePermanentAmount(xValue, filter));
|
||||
}
|
||||
}
|
||||
|
||||
public PolukranosWorldEater(final PolukranosWorldEater card) {
|
||||
|
@ -87,6 +72,17 @@ public final class PolukranosWorldEater extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum PolukranosWorldEaterAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
int xValue = ((BecomesMonstrousSourceTriggeredAbility) ability).getMonstrosityValue();
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetCreaturePermanentAmount(xValue, StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE));
|
||||
}
|
||||
}
|
||||
|
||||
class PolukranosWorldEaterEffect extends OneShotEffect {
|
||||
|
||||
public PolukranosWorldEaterEffect() {
|
||||
|
@ -108,7 +104,7 @@ class PolukranosWorldEaterEffect extends OneShotEffect {
|
|||
if (!source.getTargets().isEmpty()) {
|
||||
Target multiTarget = source.getTargets().get(0);
|
||||
Set<Permanent> permanents = new HashSet<>();
|
||||
for (UUID target: multiTarget.getTargets()) {
|
||||
for (UUID target : multiTarget.getTargets()) {
|
||||
Permanent permanent = game.getPermanent(target);
|
||||
if (permanent != null) {
|
||||
permanents.add(permanent);
|
||||
|
@ -118,7 +114,7 @@ class PolukranosWorldEaterEffect extends OneShotEffect {
|
|||
// Each of those creatures deals damage equal to its power to Polukranos
|
||||
Permanent sourceCreature = game.getPermanent(source.getSourceId());
|
||||
if (sourceCreature != null) {
|
||||
for (Permanent permanent :permanents) {
|
||||
for (Permanent permanent : permanents) {
|
||||
sourceCreature.damage(permanent.getPower().getValue(), permanent.getId(), game, false, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -34,6 +35,7 @@ public final class PostmortemLunge extends CardImpl {
|
|||
// Return target creature card with converted mana cost X from your graveyard to the battlefield. It gains haste. Exile it at the beginning of the next end step.
|
||||
this.getSpellAbility().addEffect(new PostmortemLungeEffect());
|
||||
this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD));
|
||||
this.getSpellAbility().setTargetAdjuster(PostmortemLungeAdjuster.instance);
|
||||
}
|
||||
|
||||
public PostmortemLunge(final PostmortemLunge card) {
|
||||
|
@ -44,16 +46,18 @@ public final class PostmortemLunge extends CardImpl {
|
|||
public PostmortemLunge copy() {
|
||||
return new PostmortemLunge(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum PostmortemLungeAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getAbilityType() == AbilityType.SPELL) { // otherwise the target is also added to the delayed triggered ability
|
||||
ability.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
FilterCard filter = new FilterCreatureCard("creature card with converted mana cost " + xValue + " or less from your graveyard");
|
||||
filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, xValue + 1));
|
||||
ability.getTargets().add(new TargetCardInYourGraveyard(filter));
|
||||
}
|
||||
ability.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
FilterCard filter = new FilterCreatureCard("creature card with converted mana cost " + xValue + " or less from your graveyard");
|
||||
filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, xValue + 1));
|
||||
ability.getTargets().add(new TargetCardInYourGraveyard(filter));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
package mage.cards.p;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.condition.common.KickedCondition;
|
||||
import mage.abilities.decorator.ConditionalOneShotEffect;
|
||||
import mage.abilities.effects.common.DrawDiscardControllerEffect;
|
||||
|
@ -14,9 +12,11 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.game.Game;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fireshoes
|
||||
*/
|
||||
public final class Probe extends CardImpl {
|
||||
|
@ -33,16 +33,7 @@ public final class Probe extends CardImpl {
|
|||
new DiscardTargetEffect(2),
|
||||
KickedCondition.instance,
|
||||
"<br><br>if this spell was kicked, target player discards two cards"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
ability.getTargets().clear();
|
||||
if (KickedCondition.instance.apply(game, ability)) {
|
||||
ability.addTarget(new TargetPlayer());
|
||||
}
|
||||
}
|
||||
this.getSpellAbility().setTargetAdjuster(ProbeAdjuster.instance);
|
||||
}
|
||||
|
||||
public Probe(final Probe card) {
|
||||
|
@ -54,3 +45,15 @@ public final class Probe extends CardImpl {
|
|||
return new Probe(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum ProbeAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
if (KickedCondition.instance.apply(game, ability)) {
|
||||
ability.addTarget(new TargetPlayer());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.p;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
|
@ -26,6 +25,9 @@ import mage.game.Game;
|
|||
import mage.target.TargetPlayer;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author LevelX2
|
||||
|
@ -64,27 +66,8 @@ public final class ProfaneCommand extends CardImpl {
|
|||
mode.addEffect(effect);
|
||||
mode.addTarget(new TargetCreaturePermanent(0, 1));
|
||||
this.getSpellAbility().addMode(mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
// adjust targets is called for every selected mode
|
||||
Mode mode = ability.getModes().getMode();
|
||||
for (Effect effect : mode.getEffects()) {
|
||||
if (effect instanceof ReturnFromGraveyardToBattlefieldTargetEffect) {
|
||||
mode.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
FilterCard filter = new FilterCreatureCard("creature card with converted mana cost " + xValue + " or less from your graveyard");
|
||||
filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, xValue + 1));
|
||||
mode.addTarget(new TargetCardInYourGraveyard(filter));
|
||||
}
|
||||
if (effect instanceof GainAbilityTargetEffect) {
|
||||
mode.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures gain fear until end of turn");
|
||||
mode.addTarget(new TargetCreaturePermanent(0, xValue, filter, false));
|
||||
}
|
||||
}
|
||||
this.getSpellAbility().setTargetAdjuster(ProfaneCommandAdjuster.instance);
|
||||
}
|
||||
|
||||
public ProfaneCommand(final ProfaneCommand card) {
|
||||
|
@ -96,3 +79,27 @@ public final class ProfaneCommand extends CardImpl {
|
|||
return new ProfaneCommand(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum ProfaneCommandAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
// adjust targets is called for every selected mode
|
||||
Mode mode = ability.getModes().getMode();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
for (Effect effect : mode.getEffects()) {
|
||||
if (effect instanceof ReturnFromGraveyardToBattlefieldTargetEffect) {
|
||||
mode.getTargets().clear();
|
||||
FilterCard filter = new FilterCreatureCard("creature card with converted mana cost " + xValue + " or less from your graveyard");
|
||||
filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, xValue + 1));
|
||||
mode.addTarget(new TargetCardInYourGraveyard(filter));
|
||||
}
|
||||
if (effect instanceof GainAbilityTargetEffect) {
|
||||
mode.getTargets().clear();
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures gain fear until end of turn");
|
||||
mode.addTarget(new TargetCreaturePermanent(0, xValue, filter, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.q;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
|
@ -21,10 +20,12 @@ import mage.filter.predicate.permanent.ControllerPredicate;
|
|||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class QuarantineField extends CardImpl {
|
||||
|
@ -35,42 +36,43 @@ public final class QuarantineField extends CardImpl {
|
|||
// Quarantine Field enters the battlefield with X isolation counters on it.
|
||||
this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.ISOLATION.createInstance())));
|
||||
|
||||
// When Quarantine Field enters the battlefield, for each isolation counter on it, exile up to one target nonland permanent an opponenet controls until Quarantine Field leaves the battlefield.
|
||||
// When Quarantine Field enters the battlefield, for each isolation counter on it, exile up to one target nonland permanent an opponent controls until Quarantine Field leaves the battlefield.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new QuarantineFieldEffect(), false);
|
||||
ability.addEffect(new CreateDelayedTriggeredAbilityEffect(new OnLeaveReturnExiledToBattlefieldAbility()));
|
||||
ability.setTargetAdjuster(QuarantineFieldAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
|
||||
}
|
||||
|
||||
public QuarantineField(final QuarantineField card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof EntersBattlefieldTriggeredAbility) {
|
||||
Permanent sourceObject = game.getPermanent(ability.getSourceId());
|
||||
if (sourceObject != null) {
|
||||
int isolationCounters = sourceObject.getCounters(game).getCount(CounterType.ISOLATION);
|
||||
FilterNonlandPermanent filter = new FilterNonlandPermanent("up to " + isolationCounters + " nonland permanents controlled by any opponents");
|
||||
filter.add(new ControllerPredicate(TargetController.OPPONENT));
|
||||
ability.addTarget(new TargetPermanent(0, isolationCounters, filter, false));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public QuarantineField copy() {
|
||||
return new QuarantineField(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum QuarantineFieldAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
Permanent sourceObject = game.getPermanent(ability.getSourceId());
|
||||
if (sourceObject != null) {
|
||||
int isolationCounters = sourceObject.getCounters(game).getCount(CounterType.ISOLATION);
|
||||
FilterNonlandPermanent filter = new FilterNonlandPermanent("up to " + isolationCounters + " nonland permanents controlled by an opponent");
|
||||
filter.add(new ControllerPredicate(TargetController.OPPONENT));
|
||||
ability.addTarget(new TargetPermanent(0, isolationCounters, filter, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class QuarantineFieldEffect extends OneShotEffect {
|
||||
|
||||
public QuarantineFieldEffect() {
|
||||
super(Outcome.Exile);
|
||||
this.staticText = "for each isolation counter on it, exile up to one target nonland permanent an opponenet controls until {this} leaves the battlefield";
|
||||
this.staticText = "for each isolation counter on it, exile up to one target nonland permanent an opponent controls until {this} leaves the battlefield";
|
||||
}
|
||||
|
||||
public QuarantineFieldEffect(final QuarantineFieldEffect effect) {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue