mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
Merge pull request #2120 from Dilnu/master
Fix all known cases of Issue #2106
This commit is contained in:
commit
218583ebf8
10 changed files with 99 additions and 224 deletions
|
@ -75,7 +75,8 @@ public class DwarvenLandslide extends CardImpl {
|
||||||
public void adjustTargets(Ability ability, Game game) {
|
public void adjustTargets(Ability ability, Game game) {
|
||||||
if (ability instanceof SpellAbility) {
|
if (ability instanceof SpellAbility) {
|
||||||
if (KickedCondition.getInstance().apply(game, ability)) {
|
if (KickedCondition.getInstance().apply(game, ability)) {
|
||||||
getSpellAbility().addTarget(new TargetLandPermanent(new FilterLandPermanent("land (Kicker)")));
|
ability.getTargets().clear();
|
||||||
|
getSpellAbility().addTarget(new TargetLandPermanent(2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,9 @@ import mage.cards.CardImpl;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
|
import mage.filter.predicate.mageobject.AnotherTargetPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
import mage.target.Target;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
import mage.target.targetpointer.SecondTargetPointer;
|
import mage.target.targetpointer.SecondTargetPointer;
|
||||||
|
|
||||||
|
@ -65,13 +67,19 @@ public class Jilt extends CardImpl {
|
||||||
"If {this} was kicked, it deals 2 damage to another target creature");
|
"If {this} was kicked, it deals 2 damage to another target creature");
|
||||||
effect.setTargetPointer(new SecondTargetPointer());
|
effect.setTargetPointer(new SecondTargetPointer());
|
||||||
this.getSpellAbility().addEffect(effect);
|
this.getSpellAbility().addEffect(effect);
|
||||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
Target target = new TargetCreaturePermanent(new FilterCreaturePermanent("Target Creature: returned to Hand"));
|
||||||
|
target.setTargetTag(1);
|
||||||
|
this.getSpellAbility().addTarget(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void adjustTargets(Ability ability, Game game) {
|
public void adjustTargets(Ability ability, Game game) {
|
||||||
if (ability instanceof SpellAbility && KickedCondition.getInstance().apply(game, ability)) {
|
if (ability instanceof SpellAbility && KickedCondition.getInstance().apply(game, ability)) {
|
||||||
ability.addTarget(new TargetOtherCreaturePermanent(new FilterCreaturePermanent("another target creature")));
|
FilterCreaturePermanent filter = new FilterCreaturePermanent("Another creature: Damaged");
|
||||||
|
filter.add(new AnotherTargetPredicate(2));
|
||||||
|
Target target = new TargetCreaturePermanent(filter);
|
||||||
|
target.setTargetTag(2);
|
||||||
|
ability.addTarget(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -85,27 +93,3 @@ public class Jilt extends CardImpl {
|
||||||
return new Jilt(this);
|
return new Jilt(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class TargetOtherCreaturePermanent extends TargetCreaturePermanent {
|
|
||||||
|
|
||||||
public TargetOtherCreaturePermanent(FilterCreaturePermanent filter) {
|
|
||||||
super(filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
public TargetOtherCreaturePermanent(final TargetOtherCreaturePermanent target) {
|
|
||||||
super(target);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
|
|
||||||
if (source.getTargets().get(0).getTargets().contains(id)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return super.canTarget(controllerId, id, source, game);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TargetOtherCreaturePermanent copy() {
|
|
||||||
return new TargetOtherCreaturePermanent(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -38,7 +38,10 @@ import mage.abilities.costs.common.TapSourceCost;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
import mage.abilities.effects.common.FightTargetsEffect;
|
import mage.abilities.effects.common.FightTargetsEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
|
import mage.filter.predicate.mageobject.AnotherTargetPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
import mage.target.Target;
|
||||||
import mage.target.common.TargetControlledCreaturePermanent;
|
import mage.target.common.TargetControlledCreaturePermanent;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
|
||||||
|
@ -60,8 +63,14 @@ public class UlvenwaldTracker extends CardImpl {
|
||||||
// {1}{G}, {tap}: Target creature you control fights another target creature.
|
// {1}{G}, {tap}: Target creature you control fights another target creature.
|
||||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new FightTargetsEffect(), new ManaCostsImpl("{1}{G}"));
|
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new FightTargetsEffect(), new ManaCostsImpl("{1}{G}"));
|
||||||
ability.addCost(new TapSourceCost());
|
ability.addCost(new TapSourceCost());
|
||||||
ability.addTarget(new TargetControlledCreaturePermanent());
|
Target controlledTarget = new TargetControlledCreaturePermanent();
|
||||||
ability.addTarget(new TargetOtherCreaturePermanent());
|
controlledTarget.setTargetTag(1);
|
||||||
|
ability.addTarget(controlledTarget);
|
||||||
|
FilterCreaturePermanent filter = new FilterCreaturePermanent("another creature to fight");
|
||||||
|
filter.add(new AnotherTargetPredicate(2));
|
||||||
|
Target secondTarget = new TargetCreaturePermanent(filter);
|
||||||
|
secondTarget.setTargetTag(2);
|
||||||
|
ability.addTarget(secondTarget);
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,27 +83,3 @@ public class UlvenwaldTracker extends CardImpl {
|
||||||
return new UlvenwaldTracker(this);
|
return new UlvenwaldTracker(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
class TargetOtherCreaturePermanent extends TargetCreaturePermanent {
|
|
||||||
|
|
||||||
public TargetOtherCreaturePermanent() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public TargetOtherCreaturePermanent(final TargetOtherCreaturePermanent target) {
|
|
||||||
super(target);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
|
|
||||||
if (source.getTargets().get(0).getTargets().contains(id)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return super.canTarget(controllerId, id, source, game);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TargetOtherCreaturePermanent copy() {
|
|
||||||
return new TargetOtherCreaturePermanent(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -34,7 +34,9 @@ import mage.cards.CardImpl;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
|
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
|
import mage.filter.predicate.mageobject.AnotherTargetPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.common.TargetControlledCreaturePermanent;
|
import mage.target.common.TargetControlledCreaturePermanent;
|
||||||
|
@ -55,8 +57,6 @@ import mage.target.common.TargetCreaturePermanent;
|
||||||
*/
|
*/
|
||||||
public class FallOfTheHammer extends CardImpl {
|
public class FallOfTheHammer extends CardImpl {
|
||||||
|
|
||||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("another target creature");
|
|
||||||
|
|
||||||
public FallOfTheHammer(UUID ownerId) {
|
public FallOfTheHammer(UUID ownerId) {
|
||||||
super(ownerId, 93, "Fall of the Hammer", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{R}");
|
super(ownerId, 93, "Fall of the Hammer", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{R}");
|
||||||
this.expansionSetCode = "BNG";
|
this.expansionSetCode = "BNG";
|
||||||
|
@ -64,8 +64,16 @@ public class FallOfTheHammer extends CardImpl {
|
||||||
|
|
||||||
// Target creature you control deals damage equal to its power to another target creature.
|
// Target creature you control deals damage equal to its power to another target creature.
|
||||||
this.getSpellAbility().addEffect(new FallOfTheHammerDamageEffect());
|
this.getSpellAbility().addEffect(new FallOfTheHammerDamageEffect());
|
||||||
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent());
|
TargetControlledCreaturePermanent target =
|
||||||
this.getSpellAbility().addTarget(new FallOfTheHammerTargetCreaturePermanent(filter));
|
new TargetControlledCreaturePermanent(new FilterControlledCreaturePermanent("Target creature: deals damage"));
|
||||||
|
target.setTargetTag(1);
|
||||||
|
this.getSpellAbility().addTarget(target);
|
||||||
|
|
||||||
|
FilterCreaturePermanent filter = new FilterCreaturePermanent("Another creature: damage dealt to");
|
||||||
|
filter.add(new AnotherTargetPredicate(2));
|
||||||
|
TargetCreaturePermanent target2 = new TargetCreaturePermanent(filter);
|
||||||
|
target2.setTargetTag(2);
|
||||||
|
this.getSpellAbility().addTarget(target2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FallOfTheHammer(final FallOfTheHammer card) {
|
public FallOfTheHammer(final FallOfTheHammer card) {
|
||||||
|
@ -108,28 +116,3 @@ class FallOfTheHammerDamageEffect extends OneShotEffect {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class FallOfTheHammerTargetCreaturePermanent extends TargetCreaturePermanent {
|
|
||||||
|
|
||||||
public FallOfTheHammerTargetCreaturePermanent(FilterCreaturePermanent filter) {
|
|
||||||
super(filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canTarget(UUID id, Ability source, Game game) {
|
|
||||||
if (source.getTargets().getFirstTarget().equals(id)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return super.canTarget(id, source, game);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
|
|
||||||
if (source.getTargets().getFirstTarget().equals(id)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return super.canTarget(controllerId, id, source, game);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -50,16 +50,7 @@ public class BloodFeud extends CardImpl {
|
||||||
|
|
||||||
// Target creature fights another target creature.
|
// Target creature fights another target creature.
|
||||||
this.getSpellAbility().addEffect(new FightTargetsEffect());
|
this.getSpellAbility().addEffect(new FightTargetsEffect());
|
||||||
|
this.getSpellAbility().addTarget(new TargetCreaturePermanent(2));
|
||||||
TargetCreaturePermanent target = new TargetCreaturePermanent();
|
|
||||||
target.setTargetTag(1);
|
|
||||||
this.getSpellAbility().addTarget(target);
|
|
||||||
|
|
||||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("another creature to fight");
|
|
||||||
filter.add(new AnotherTargetPredicate(2));
|
|
||||||
TargetCreaturePermanent target2 = new TargetCreaturePermanent(filter);
|
|
||||||
target2.setTargetTag(2);
|
|
||||||
this.getSpellAbility().addTarget(target2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public BloodFeud(final BloodFeud card) {
|
public BloodFeud(final BloodFeud card) {
|
||||||
|
|
|
@ -51,6 +51,8 @@ import mage.constants.Rarity;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.filter.FilterPermanent;
|
import mage.filter.FilterPermanent;
|
||||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||||
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
|
import mage.filter.predicate.mageobject.AnotherTargetPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.command.Emblem;
|
import mage.game.command.Emblem;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
@ -75,8 +77,15 @@ public class DomriRade extends CardImpl {
|
||||||
|
|
||||||
// -2: Target creature you control fights another target creature.
|
// -2: Target creature you control fights another target creature.
|
||||||
LoyaltyAbility ability2 = new LoyaltyAbility(new FightTargetsEffect(), -2);
|
LoyaltyAbility ability2 = new LoyaltyAbility(new FightTargetsEffect(), -2);
|
||||||
ability2.addTarget(new TargetControlledCreaturePermanent());
|
TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent();
|
||||||
ability2.addTarget(new DomriRadeTargetOtherCreaturePermanent());
|
target.setTargetTag(1);
|
||||||
|
ability2.addTarget(target);
|
||||||
|
|
||||||
|
FilterCreaturePermanent filter = new FilterCreaturePermanent("another creature to fight");
|
||||||
|
filter.add(new AnotherTargetPredicate(2));
|
||||||
|
TargetCreaturePermanent target2 = new TargetCreaturePermanent(filter);
|
||||||
|
target2.setTargetTag(2);
|
||||||
|
ability2.addTarget(target2);
|
||||||
this.addAbility(ability2);
|
this.addAbility(ability2);
|
||||||
|
|
||||||
// -7: You get an emblem with "Creatures you control have double strike, trample, hexproof and haste."
|
// -7: You get an emblem with "Creatures you control have double strike, trample, hexproof and haste."
|
||||||
|
@ -150,28 +159,3 @@ class DomriRadeEmblem extends Emblem {
|
||||||
this.getAbilities().add(ability);
|
this.getAbilities().add(ability);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class DomriRadeTargetOtherCreaturePermanent extends TargetCreaturePermanent {
|
|
||||||
|
|
||||||
public DomriRadeTargetOtherCreaturePermanent() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public DomriRadeTargetOtherCreaturePermanent(final DomriRadeTargetOtherCreaturePermanent target) {
|
|
||||||
super(target);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
|
|
||||||
if (source.getTargets().get(0).getTargets().contains(id)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return super.canTarget(controllerId, id, source, game);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DomriRadeTargetOtherCreaturePermanent copy() {
|
|
||||||
return new DomriRadeTargetOtherCreaturePermanent(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -33,6 +33,8 @@ import mage.constants.Rarity;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.common.FightTargetsEffect;
|
import mage.abilities.effects.common.FightTargetsEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
|
import mage.filter.predicate.mageobject.AnotherTargetPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.target.common.TargetControlledCreaturePermanent;
|
import mage.target.common.TargetControlledCreaturePermanent;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
@ -50,8 +52,15 @@ public class PitFight extends CardImpl {
|
||||||
|
|
||||||
// Target creature you control fights another target creature.
|
// Target creature you control fights another target creature.
|
||||||
this.getSpellAbility().addEffect(new FightTargetsEffect());
|
this.getSpellAbility().addEffect(new FightTargetsEffect());
|
||||||
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent());
|
TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent();
|
||||||
this.getSpellAbility().addTarget(new TargetOtherCreaturePermanent());
|
target.setTargetTag(1);
|
||||||
|
this.getSpellAbility().addTarget(target);
|
||||||
|
|
||||||
|
FilterCreaturePermanent filter = new FilterCreaturePermanent("another creature to fight");
|
||||||
|
filter.add(new AnotherTargetPredicate(2));
|
||||||
|
TargetCreaturePermanent target2 = new TargetCreaturePermanent(filter);
|
||||||
|
target2.setTargetTag(2);
|
||||||
|
this.getSpellAbility().addTarget(target2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PitFight(final PitFight card) {
|
public PitFight(final PitFight card) {
|
||||||
|
@ -63,29 +72,3 @@ public class PitFight extends CardImpl {
|
||||||
return new PitFight(this);
|
return new PitFight(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class TargetOtherCreaturePermanent extends TargetCreaturePermanent {
|
|
||||||
|
|
||||||
public TargetOtherCreaturePermanent() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public TargetOtherCreaturePermanent(final TargetOtherCreaturePermanent target) {
|
|
||||||
super(target);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
|
|
||||||
if (source.getTargets().get(0).getTargets().contains(id)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return super.canTarget(controllerId, id, source, game);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TargetOtherCreaturePermanent copy() {
|
|
||||||
return new TargetOtherCreaturePermanent(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -75,7 +75,8 @@ public class RushingRiver extends CardImpl {
|
||||||
@Override
|
@Override
|
||||||
public void adjustTargets(Ability ability, Game game) {
|
public void adjustTargets(Ability ability, Game game) {
|
||||||
if (ability instanceof SpellAbility && KickedCondition.getInstance().apply(game, ability)) {
|
if (ability instanceof SpellAbility && KickedCondition.getInstance().apply(game, ability)) {
|
||||||
ability.addTarget(new TargetOtherNonlandPermanent(new FilterNonlandPermanent("another target nonland permanent")));
|
ability.getTargets().clear();
|
||||||
|
ability.addTarget(new TargetNonlandPermanent(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -89,27 +90,3 @@ public class RushingRiver extends CardImpl {
|
||||||
return new RushingRiver(this);
|
return new RushingRiver(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class TargetOtherNonlandPermanent extends TargetNonlandPermanent {
|
|
||||||
|
|
||||||
public TargetOtherNonlandPermanent(FilterNonlandPermanent filter) {
|
|
||||||
super(filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
public TargetOtherNonlandPermanent(final TargetOtherNonlandPermanent target) {
|
|
||||||
super(target);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
|
|
||||||
if (source.getTargets().get(0).getTargets().contains(id)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return super.canTarget(controllerId, id, source, game);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TargetOtherNonlandPermanent copy() {
|
|
||||||
return new TargetOtherNonlandPermanent(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -56,8 +56,7 @@ public class DissensionInTheRanks extends CardImpl {
|
||||||
|
|
||||||
// Target blocking creature fights another target blocking creature.
|
// Target blocking creature fights another target blocking creature.
|
||||||
this.getSpellAbility().addEffect(new FightTargetsEffect());
|
this.getSpellAbility().addEffect(new FightTargetsEffect());
|
||||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter));
|
this.getSpellAbility().addTarget(new TargetCreaturePermanent(2, 2, filter, false));
|
||||||
this.getSpellAbility().addTarget(new DissensionInTheRanksTarget(filter));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,28 +69,3 @@ public class DissensionInTheRanks extends CardImpl {
|
||||||
return new DissensionInTheRanks(this);
|
return new DissensionInTheRanks(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class DissensionInTheRanksTarget extends TargetCreaturePermanent {
|
|
||||||
|
|
||||||
public DissensionInTheRanksTarget(FilterCreaturePermanent filter) {
|
|
||||||
super(1, 1, filter, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public DissensionInTheRanksTarget(final DissensionInTheRanksTarget target) {
|
|
||||||
super(target);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
|
|
||||||
if (source.getTargets().get(0).getTargets().contains(id)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return super.canTarget(controllerId, id, source, game);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DissensionInTheRanksTarget copy() {
|
|
||||||
return new DissensionInTheRanksTarget(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
package mage.sets.tempest;
|
package mage.sets.tempest;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.MageItem;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.common.continuous.ExchangeControlTargetEffect;
|
import mage.abilities.effects.common.continuous.ExchangeControlTargetEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
@ -35,10 +36,14 @@ import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.filter.FilterPermanent;
|
import mage.filter.FilterPermanent;
|
||||||
|
import mage.filter.predicate.ObjectSourcePlayer;
|
||||||
|
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||||
import mage.filter.predicate.Predicates;
|
import mage.filter.predicate.Predicates;
|
||||||
|
import mage.filter.predicate.mageobject.AnotherTargetPredicate;
|
||||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.game.stack.StackObject;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,9 +52,12 @@ import mage.target.TargetPermanent;
|
||||||
*/
|
*/
|
||||||
public class Legerdemain extends CardImpl {
|
public class Legerdemain extends CardImpl {
|
||||||
|
|
||||||
private static final FilterPermanent filter = new FilterPermanent("artifact or creature");
|
private static final FilterPermanent firstFilter = new FilterPermanent("artifact or creature");
|
||||||
|
private static final FilterPermanent secondFilter = new FilterPermanent("another permanent that shares the type of artifact or creature");
|
||||||
static {
|
static {
|
||||||
filter.add(Predicates.or(new CardTypePredicate(CardType.ARTIFACT), new CardTypePredicate(CardType.CREATURE)));
|
firstFilter.add(Predicates.or(new CardTypePredicate(CardType.ARTIFACT), new CardTypePredicate(CardType.CREATURE)));
|
||||||
|
secondFilter.add(new AnotherTargetPredicate(2));
|
||||||
|
secondFilter.add(new SharesTypePredicate());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Legerdemain(UUID ownerId) {
|
public Legerdemain(UUID ownerId) {
|
||||||
|
@ -58,8 +66,12 @@ public class Legerdemain extends CardImpl {
|
||||||
|
|
||||||
// Exchange control of target artifact or creature and another target permanent that shares one of those types with it.
|
// Exchange control of target artifact or creature and another target permanent that shares one of those types with it.
|
||||||
this.getSpellAbility().addEffect(new ExchangeControlTargetEffect(Duration.EndOfGame, "Exchange control of target artifact or creature and another target permanent that shares one of those types with it", false, true));
|
this.getSpellAbility().addEffect(new ExchangeControlTargetEffect(Duration.EndOfGame, "Exchange control of target artifact or creature and another target permanent that shares one of those types with it", false, true));
|
||||||
this.getSpellAbility().addTarget(new TargetPermanent(filter));
|
TargetPermanent firstTarget = new TargetPermanent(firstFilter);
|
||||||
this.getSpellAbility().addTarget(new LegerdemainSecondTarget());
|
firstTarget.setTargetTag(1);
|
||||||
|
TargetPermanent secondTarget = new TargetPermanent(secondFilter);
|
||||||
|
secondTarget.setTargetTag(2);
|
||||||
|
this.getSpellAbility().addTarget(firstTarget);
|
||||||
|
this.getSpellAbility().addTarget(secondTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Legerdemain(final Legerdemain card) {
|
public Legerdemain(final Legerdemain card) {
|
||||||
|
@ -72,21 +84,19 @@ public class Legerdemain extends CardImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class LegerdemainSecondTarget extends TargetPermanent {
|
class SharesTypePredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<MageItem>> {
|
||||||
|
|
||||||
LegerdemainSecondTarget() {
|
|
||||||
super();
|
|
||||||
this.targetName = "another permanent that shares one of those types";
|
|
||||||
}
|
|
||||||
|
|
||||||
LegerdemainSecondTarget(final LegerdemainSecondTarget target) {
|
|
||||||
super(target);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
|
public boolean apply(ObjectSourcePlayer<MageItem> input, Game game) {
|
||||||
Permanent firstPermanent = game.getPermanent(source.getTargets().getFirstTarget());
|
StackObject source = game.getStack().getStackObject(input.getSourceId());
|
||||||
Permanent secondPermanent = game.getPermanent(id);
|
if (source != null) {
|
||||||
|
if (source.getStackAbility().getTargets().isEmpty()
|
||||||
|
|| source.getStackAbility().getTargets().get(0).getTargets().isEmpty()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
Permanent firstPermanent = game.getPermanent(
|
||||||
|
source.getStackAbility().getTargets().get(0).getTargets().get(0));
|
||||||
|
Permanent secondPermanent = game.getPermanent(input.getObject().getId());
|
||||||
if (firstPermanent != null && secondPermanent != null) {
|
if (firstPermanent != null && secondPermanent != null) {
|
||||||
if (firstPermanent.getCardType().contains(CardType.CREATURE) && secondPermanent.getCardType().contains(CardType.CREATURE)) {
|
if (firstPermanent.getCardType().contains(CardType.CREATURE) && secondPermanent.getCardType().contains(CardType.CREATURE)) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -97,9 +107,12 @@ class LegerdemainSecondTarget extends TargetPermanent {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LegerdemainSecondTarget copy() {
|
public String toString() {
|
||||||
return new LegerdemainSecondTarget(this);
|
return "Target permanent that shares the type of artifact or creature";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue