diff --git a/Mage.Sets/src/mage/cards/a/AetherGust.java b/Mage.Sets/src/mage/cards/a/AetherGust.java index 438586ef456..a12817aa909 100644 --- a/Mage.Sets/src/mage/cards/a/AetherGust.java +++ b/Mage.Sets/src/mage/cards/a/AetherGust.java @@ -35,7 +35,7 @@ public final class AetherGust extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}"); // Choose target spell or permanent that's red or green. Its owner puts it on the top or bottom of their library. - this.getSpellAbility().addEffect(new PutOnTopOrBottomLibraryTargetEffect( + this.getSpellAbility().addEffect(new PutOnTopOrBottomLibraryTargetEffect(true).setText( "choose target spell or permanent that's red or green. " + "Its owner puts it on the top or bottom of their library" )); diff --git a/Mage.Sets/src/mage/cards/d/Desynchronize.java b/Mage.Sets/src/mage/cards/d/Desynchronize.java index 72c77cf2c77..9fbd37230c1 100644 --- a/Mage.Sets/src/mage/cards/d/Desynchronize.java +++ b/Mage.Sets/src/mage/cards/d/Desynchronize.java @@ -18,9 +18,7 @@ public final class Desynchronize extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{4}{U}"); // Target nonland permanent's owner puts it on the top or bottom of their library. Scry 2. - this.getSpellAbility().addEffect(new PutOnTopOrBottomLibraryTargetEffect( - "target nonland permanent's owner puts it on the top or bottom of their library" - )); + this.getSpellAbility().addEffect(new PutOnTopOrBottomLibraryTargetEffect(false)); this.getSpellAbility().addEffect(new ScryEffect(2, false)); this.getSpellAbility().addTarget(new TargetNonlandPermanent()); } diff --git a/Mage.Sets/src/mage/cards/d/DiverSkaab.java b/Mage.Sets/src/mage/cards/d/DiverSkaab.java index 9995fe173fe..cc0359c9e5a 100644 --- a/Mage.Sets/src/mage/cards/d/DiverSkaab.java +++ b/Mage.Sets/src/mage/cards/d/DiverSkaab.java @@ -29,9 +29,7 @@ public final class DiverSkaab extends CardImpl { this.addAbility(new ExploitAbility()); // When Diver Skaab exploits a creature, target creature's owner puts it on the top or bottom of their library. - Ability ability = new ExploitCreatureTriggeredAbility(new PutOnTopOrBottomLibraryTargetEffect( - "target creature's owner puts it on the top or bottom of their library" - )); + Ability ability = new ExploitCreatureTriggeredAbility(new PutOnTopOrBottomLibraryTargetEffect(false)); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/e/EndlessDetour.java b/Mage.Sets/src/mage/cards/e/EndlessDetour.java index 1a06a8cc9ce..5ef1d66c465 100644 --- a/Mage.Sets/src/mage/cards/e/EndlessDetour.java +++ b/Mage.Sets/src/mage/cards/e/EndlessDetour.java @@ -18,7 +18,7 @@ public final class EndlessDetour extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{G}{W}{U}"); // The owner of target spell, nonland permanent, or card in a graveyard puts it on the top or bottom of their library. - this.getSpellAbility().addEffect(new PutOnTopOrBottomLibraryTargetEffect()); + this.getSpellAbility().addEffect(new PutOnTopOrBottomLibraryTargetEffect(true)); this.getSpellAbility().addTarget(new TargetCardInGraveyardBattlefieldOrStack( 1, 1, StaticFilters.FILTER_CARD, StaticFilters.FILTER_PERMANENT_NON_LAND, StaticFilters.FILTER_SPELL, "spell, nonland permanent, or card in a graveyard" diff --git a/Mage.Sets/src/mage/cards/h/HornedLochWhale.java b/Mage.Sets/src/mage/cards/h/HornedLochWhale.java index b8557446860..7d1b39df152 100644 --- a/Mage.Sets/src/mage/cards/h/HornedLochWhale.java +++ b/Mage.Sets/src/mage/cards/h/HornedLochWhale.java @@ -52,7 +52,7 @@ public final class HornedLochWhale extends AdventureCard { // Lagoon Breach // The owner of target attacking creature you don't control puts it on the top or bottom of their library. - this.getSpellCard().getSpellAbility().addEffect(new PutOnTopOrBottomLibraryTargetEffect()); + this.getSpellCard().getSpellAbility().addEffect(new PutOnTopOrBottomLibraryTargetEffect(true)); this.getSpellCard().getSpellAbility().addTarget(new TargetPermanent(filter)); this.finalizeAdventure(); diff --git a/Mage.Sets/src/mage/cards/m/MisleadingMotes.java b/Mage.Sets/src/mage/cards/m/MisleadingMotes.java index 59f9a89eb28..8297c6eb9a1 100644 --- a/Mage.Sets/src/mage/cards/m/MisleadingMotes.java +++ b/Mage.Sets/src/mage/cards/m/MisleadingMotes.java @@ -17,9 +17,7 @@ public final class MisleadingMotes extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{U}"); // Target creature's owner puts it on the top or bottom of their library. - this.getSpellAbility().addEffect(new PutOnTopOrBottomLibraryTargetEffect( - "target creature's owner puts it on the top or bottom of their library" - )); + this.getSpellAbility().addEffect(new PutOnTopOrBottomLibraryTargetEffect(false)); this.getSpellAbility().addTarget(new TargetCreaturePermanent()); } diff --git a/Mage.Sets/src/mage/cards/m/MoonsnarePrototype.java b/Mage.Sets/src/mage/cards/m/MoonsnarePrototype.java index a13956b1090..220a949e9ca 100644 --- a/Mage.Sets/src/mage/cards/m/MoonsnarePrototype.java +++ b/Mage.Sets/src/mage/cards/m/MoonsnarePrototype.java @@ -41,7 +41,7 @@ public final class MoonsnarePrototype extends CardImpl { this.addAbility(ability); // Channel — {4}{U}, Discard Moonsnare Prototype: The owner of target nonland permanent puts it on the top or bottom of their library. - ability = new ChannelAbility("{4}{U}", new PutOnTopOrBottomLibraryTargetEffect()); + ability = new ChannelAbility("{4}{U}", new PutOnTopOrBottomLibraryTargetEffect(true)); ability.addTarget(new TargetNonlandPermanent()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/p/PowerOfPersuasion.java b/Mage.Sets/src/mage/cards/p/PowerOfPersuasion.java index b0570f7680e..55b363389a0 100644 --- a/Mage.Sets/src/mage/cards/p/PowerOfPersuasion.java +++ b/Mage.Sets/src/mage/cards/p/PowerOfPersuasion.java @@ -31,7 +31,7 @@ public final class PowerOfPersuasion extends CardImpl { effect.addTableEntry(1, 9, new ReturnToHandTargetEffect().setText("return it to its owner's hand")); // 10-19 | Its owner puts it on the top of bottom of their library. - effect.addTableEntry(10, 19, new PutOnTopOrBottomLibraryTargetEffect( + effect.addTableEntry(10, 19, new PutOnTopOrBottomLibraryTargetEffect(false).setText( "its owner puts it on the top or bottom of their library" )); diff --git a/Mage.Sets/src/mage/cards/r/RevengeOfTheDrowned.java b/Mage.Sets/src/mage/cards/r/RevengeOfTheDrowned.java index c33b254f0a3..49a21400433 100644 --- a/Mage.Sets/src/mage/cards/r/RevengeOfTheDrowned.java +++ b/Mage.Sets/src/mage/cards/r/RevengeOfTheDrowned.java @@ -19,9 +19,7 @@ public final class RevengeOfTheDrowned extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{U}"); // Target creature's owner puts it on the top or bottom of their library. You create a 2/2 black Zombie creature token with decayed. - this.getSpellAbility().addEffect(new PutOnTopOrBottomLibraryTargetEffect( - "target creature's owner puts it on the top or bottom of their library" - )); + this.getSpellAbility().addEffect(new PutOnTopOrBottomLibraryTargetEffect(false)); this.getSpellAbility().addEffect(new CreateTokenEffect(new ZombieDecayedToken()).concatBy("You")); this.getSpellAbility().addTarget(new TargetCreaturePermanent()); } diff --git a/Mage.Sets/src/mage/cards/r/RunAshore.java b/Mage.Sets/src/mage/cards/r/RunAshore.java index 15252e271f3..9f4f495285d 100644 --- a/Mage.Sets/src/mage/cards/r/RunAshore.java +++ b/Mage.Sets/src/mage/cards/r/RunAshore.java @@ -23,7 +23,7 @@ public final class RunAshore extends CardImpl { this.getSpellAbility().getModes().setMaxModes(2); // • The owner of target nonland permanent puts it on the top or bottom of their library. - this.getSpellAbility().addEffect(new PutOnTopOrBottomLibraryTargetEffect()); + this.getSpellAbility().addEffect(new PutOnTopOrBottomLibraryTargetEffect(true)); this.getSpellAbility().addTarget(new TargetNonlandPermanent()); // • Return target nonland permanent to its owner's hand. diff --git a/Mage.Sets/src/mage/cards/r/RunOutOfTown.java b/Mage.Sets/src/mage/cards/r/RunOutOfTown.java index 5f5942a0d08..bf6d750f52a 100644 --- a/Mage.Sets/src/mage/cards/r/RunOutOfTown.java +++ b/Mage.Sets/src/mage/cards/r/RunOutOfTown.java @@ -17,7 +17,7 @@ public final class RunOutOfTown extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{U}"); // The owner of target nonland permanent puts it on the top or bottom of their library. - this.getSpellAbility().addEffect(new PutOnTopOrBottomLibraryTargetEffect()); + this.getSpellAbility().addEffect(new PutOnTopOrBottomLibraryTargetEffect(true)); this.getSpellAbility().addTarget(new TargetNonlandPermanent()); } diff --git a/Mage.Sets/src/mage/cards/s/Subtlety.java b/Mage.Sets/src/mage/cards/s/Subtlety.java index bdb8052ea8d..f21bc3726cc 100644 --- a/Mage.Sets/src/mage/cards/s/Subtlety.java +++ b/Mage.Sets/src/mage/cards/s/Subtlety.java @@ -53,7 +53,7 @@ public final class Subtlety extends CardImpl { this.addAbility(FlyingAbility.getInstance()); // When Subtlety enters the battlefield, choose up to one target creature spell or planeswalker spell. Its owner puts it on the top or bottom of their library. - Ability ability = new EntersBattlefieldTriggeredAbility(new PutOnTopOrBottomLibraryTargetEffect( + Ability ability = new EntersBattlefieldTriggeredAbility(new PutOnTopOrBottomLibraryTargetEffect(false).setText( "choose up to one target creature spell or planeswalker spell. " + "Its owner puts it on the top or bottom of their library" )); diff --git a/Mage.Sets/src/mage/cards/u/UnluckyDrop.java b/Mage.Sets/src/mage/cards/u/UnluckyDrop.java index c57f1449d92..81c968a1388 100644 --- a/Mage.Sets/src/mage/cards/u/UnluckyDrop.java +++ b/Mage.Sets/src/mage/cards/u/UnluckyDrop.java @@ -18,9 +18,7 @@ public final class UnluckyDrop extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{U}"); // Target artifact or creature's owner puts it on the top or bottom of their library. - this.getSpellAbility().addEffect(new PutOnTopOrBottomLibraryTargetEffect( - "target artifact or creature's owner puts it on the top or bottom of their library" - )); + this.getSpellAbility().addEffect(new PutOnTopOrBottomLibraryTargetEffect(false)); this.getSpellAbility().addTarget(new TargetPermanent(StaticFilters.FILTER_PERMANENT_ARTIFACT_OR_CREATURE)); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DamageWithPowerFromSourceToAnotherTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DamageWithPowerFromSourceToAnotherTargetEffect.java index 555f36a4f8f..8e6189aa337 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DamageWithPowerFromSourceToAnotherTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DamageWithPowerFromSourceToAnotherTargetEffect.java @@ -15,10 +15,6 @@ public class DamageWithPowerFromSourceToAnotherTargetEffect extends OneShotEffec String sourceTargetName; - public DamageWithPowerFromSourceToAnotherTargetEffect() { - this("It"); - } - public DamageWithPowerFromSourceToAnotherTargetEffect(String sourceTargetName) { super(Outcome.Damage); this.sourceTargetName = sourceTargetName; @@ -36,8 +32,8 @@ public class DamageWithPowerFromSourceToAnotherTargetEffect extends OneShotEffec } Permanent myPermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); - Permanent anotherPermanent = game.getPermanent(source.getTargets().get(0).getFirstTarget()); - Player anotherPlayer = game.getPlayer(source.getTargets().get(0).getFirstTarget()); + Permanent anotherPermanent = game.getPermanent(source.getFirstTarget()); + Player anotherPlayer = game.getPlayer(source.getFirstTarget()); if (myPermanent != null && anotherPermanent != null) { anotherPermanent.damage(myPermanent.getPower().getValue(), myPermanent.getId(), source, game, false, true); @@ -65,6 +61,7 @@ public class DamageWithPowerFromSourceToAnotherTargetEffect extends OneShotEffec } // It deals damage equal to its power to target creature you don't control - return this.sourceTargetName + " deals damage equal to its power to target " + mode.getTargets().get(0).getTargetName(); + return sourceTargetName + " deals damage equal to its power to " + + getTargetPointer().describeTargets(mode.getTargets(), "that creature"); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/FightTargetSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/FightTargetSourceEffect.java index 1503bec8492..911dc996556 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/FightTargetSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/FightTargetSourceEffect.java @@ -1,13 +1,11 @@ package mage.abilities.effects.common; -import mage.MageObject; import mage.abilities.Ability; import mage.abilities.Mode; import mage.abilities.effects.OneShotEffect; import mage.constants.Outcome; import mage.game.Game; import mage.game.permanent.Permanent; -import mage.target.Target; /** * @author LevelX2 @@ -24,21 +22,14 @@ public class FightTargetSourceEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - MageObject sourceObject = source.getSourceObject(game); - if (sourceObject != null) { - Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game); - Permanent creature1 = game.getPermanent(getTargetPointer().getFirst(game, source)); - // 20110930 - 701.10 - if (creature1 != null && sourcePermanent != null) { - if (creature1.isCreature(game) && sourcePermanent.isCreature(game)) { - return sourcePermanent.fight(creature1, source, game); - } - } - if (!game.isSimulation()) { - game.informPlayers(sourceObject.getLogName() + ": Fighting effect has been fizzled."); - } + // 701.12 + Permanent sourceCreature = source.getSourcePermanentIfItStillExists(game); + Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source)); + if (sourceCreature == null || !sourceCreature.isCreature(game) + || targetCreature == null || !targetCreature.isCreature(game)) { + return false; } - return false; + return sourceCreature.fight(targetCreature, source, game); } @Override @@ -51,15 +42,6 @@ public class FightTargetSourceEffect extends OneShotEffect { if (staticText != null && !staticText.isEmpty()) { return staticText; } - Target target = mode.getTargets().get(0); - StringBuilder sb = new StringBuilder("{this} fights "); - if (target.getMinNumberOfTargets() == 0 && target.getMaxNumberOfTargets() == 1) { - sb.append("up to one "); - } - if (!target.getTargetName().contains("other")) { - sb.append("target "); - } - sb.append(target.getTargetName()); - return sb.toString(); + return "{this} fights " + getTargetPointer().describeTargets(mode.getTargets(), "that creature"); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/PutOnTopOrBottomLibraryTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PutOnTopOrBottomLibraryTargetEffect.java index 4878d28e1db..73497ca3158 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PutOnTopOrBottomLibraryTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PutOnTopOrBottomLibraryTargetEffect.java @@ -12,17 +12,16 @@ import mage.players.Player; */ public class PutOnTopOrBottomLibraryTargetEffect extends OneShotEffect { - public PutOnTopOrBottomLibraryTargetEffect() { - this(""); - } + private final boolean textOwnerOf; - public PutOnTopOrBottomLibraryTargetEffect(String text) { - super(Outcome.Benefit); - staticText = text; + public PutOnTopOrBottomLibraryTargetEffect(boolean textOwnerOf) { + super(Outcome.ReturnToHand); + this.textOwnerOf = textOwnerOf; } private PutOnTopOrBottomLibraryTargetEffect(final PutOnTopOrBottomLibraryTargetEffect effect) { super(effect); + this.textOwnerOf = effect.textOwnerOf; } @Override @@ -48,7 +47,8 @@ public class PutOnTopOrBottomLibraryTargetEffect extends OneShotEffect { if (staticText != null && !staticText.isEmpty()) { return staticText; } - return "the owner of target " + mode.getTargets().get(0).getTargetName() + + String targetText = getTargetPointer().describeTargets(mode.getTargets(), "that permanent"); + return (textOwnerOf ? "the owner of " + targetText : targetText + "'s owner") + " puts it on the top or bottom of their library"; } }