From f9da34cbf19f320ce678433bfc0a5d1b0e5a6cd5 Mon Sep 17 00:00:00 2001 From: Sol Date: Mon, 21 Jan 2013 02:02:58 +0000 Subject: [PATCH] - Fix for Turnabout -NOTE Apparently the "TargetedPlayerCtrl" property doesn't actually work. It seems like 14 other scripts use this property --- res/cardsfolder/t/turnabout.txt | 2 +- .../card/abilityfactory/effects/TapOrUntapAllEffect.java | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/res/cardsfolder/t/turnabout.txt b/res/cardsfolder/t/turnabout.txt index 3fa25cb136d..c10e4227d55 100644 --- a/res/cardsfolder/t/turnabout.txt +++ b/res/cardsfolder/t/turnabout.txt @@ -3,7 +3,7 @@ ManaCost:2 U U Types:Instant Text:no text A:SP$ ChooseType | Cost$ 2 U U | Type$ Card | ValidTypes$ Artifact,Creature,Land | SubAbility$ DBTapOrUntapAll | SpellDescription$ Choose artifact, creature, or land. Tap all untapped permanents of the chosen type target player controls, or untap all tapped permanents of that type that player controls. -SVar:DBTapOrUntapAll:DB$ TapOrUntapAll | ValidTgts$ Player | ValidCards$ Card.ChosenType+TargetedPlayerCtrl | ValidMessage$ permanents of the chosen type target player controls +SVar:DBTapOrUntapAll:DB$ TapOrUntapAll | ValidTgts$ Player | ValidCards$ Card.ChosenType | ValidMessage$ permanents of the chosen type target player controls SVar:RemAIDeck:True SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/turnabout.jpg diff --git a/src/main/java/forge/card/abilityfactory/effects/TapOrUntapAllEffect.java b/src/main/java/forge/card/abilityfactory/effects/TapOrUntapAllEffect.java index dd440e951a7..34e35eef342 100644 --- a/src/main/java/forge/card/abilityfactory/effects/TapOrUntapAllEffect.java +++ b/src/main/java/forge/card/abilityfactory/effects/TapOrUntapAllEffect.java @@ -5,10 +5,12 @@ import java.util.List; import org.apache.commons.lang3.StringUtils; import forge.Card; +import forge.CardLists; import forge.Singletons; import forge.card.abilityfactory.AbilityFactory; import forge.card.abilityfactory.SpellEffect; import forge.card.spellability.SpellAbility; +import forge.game.player.Player; import forge.game.zone.ZoneType; import forge.gui.GuiChoose; @@ -42,11 +44,17 @@ public class TapOrUntapAllEffect extends SpellEffect { @Override public void resolve(SpellAbility sa) { List validCards = getTargetCards(sa); + + List targetedPlayers = getTargetPlayersEmptyAsDefault(sa); if (sa.hasParam("ValidCards")) { validCards = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield); validCards = AbilityFactory.filterListByType(validCards, sa.getParam("ValidCards"), sa); } + + if (!targetedPlayers.isEmpty()) { + validCards = CardLists.filterControlledBy(validCards, targetedPlayers); + } // Default to tapping for AI TapOrUntap toTap = TapOrUntap.TAP;