- Fix for Turnabout

-NOTE Apparently the "TargetedPlayerCtrl" property doesn't actually work. It seems like 14 other scripts use this property
This commit is contained in:
Sol
2013-01-21 02:02:58 +00:00
parent 9106bce999
commit f9da34cbf1
2 changed files with 9 additions and 1 deletions

View File

@@ -3,7 +3,7 @@ ManaCost:2 U U
Types:Instant Types:Instant
Text:no text 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. 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:RemAIDeck:True
SVar:Rarity:Uncommon SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/turnabout.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/turnabout.jpg

View File

@@ -5,10 +5,12 @@ import java.util.List;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import forge.Card; import forge.Card;
import forge.CardLists;
import forge.Singletons; import forge.Singletons;
import forge.card.abilityfactory.AbilityFactory; import forge.card.abilityfactory.AbilityFactory;
import forge.card.abilityfactory.SpellEffect; import forge.card.abilityfactory.SpellEffect;
import forge.card.spellability.SpellAbility; import forge.card.spellability.SpellAbility;
import forge.game.player.Player;
import forge.game.zone.ZoneType; import forge.game.zone.ZoneType;
import forge.gui.GuiChoose; import forge.gui.GuiChoose;
@@ -43,11 +45,17 @@ public class TapOrUntapAllEffect extends SpellEffect {
public void resolve(SpellAbility sa) { public void resolve(SpellAbility sa) {
List<Card> validCards = getTargetCards(sa); List<Card> validCards = getTargetCards(sa);
List<Player> targetedPlayers = getTargetPlayersEmptyAsDefault(sa);
if (sa.hasParam("ValidCards")) { if (sa.hasParam("ValidCards")) {
validCards = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield); validCards = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
validCards = AbilityFactory.filterListByType(validCards, sa.getParam("ValidCards"), sa); validCards = AbilityFactory.filterListByType(validCards, sa.getParam("ValidCards"), sa);
} }
if (!targetedPlayers.isEmpty()) {
validCards = CardLists.filterControlledBy(validCards, targetedPlayers);
}
// Default to tapping for AI // Default to tapping for AI
TapOrUntap toTap = TapOrUntap.TAP; TapOrUntap toTap = TapOrUntap.TAP;
if (sa.getActivatingPlayer().isHuman()) { if (sa.getActivatingPlayer().isHuman()) {