mirror of
https://github.com/correl/mage.git
synced 2024-12-27 11:07:39 +00:00
updated some more target adjusters
This commit is contained in:
parent
7b309a6f7d
commit
c83c55df76
8 changed files with 138 additions and 114 deletions
|
@ -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));
|
||||
}
|
||||
}
|
|
@ -30,7 +30,7 @@ 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(BlatantThieveryEffect.class);
|
||||
this.getSpellAbility().setTargetAdjuster(BlatantThieveryAdjuster.instance);
|
||||
}
|
||||
|
||||
public BlatantThievery(final BlatantThievery card) {
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue