From ffe83b0af3beec86dc4e94f56abaee29cdb06d56 Mon Sep 17 00:00:00 2001 From: Sol Date: Wed, 21 Sep 2011 00:37:12 +0000 Subject: [PATCH] - Added support for Attaching to Players on Auras ETB Indirectly. --- .../abilityFactory/AbilityFactory_Attach.java | 41 ++++++++++++++----- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/src/main/java/forge/card/abilityFactory/AbilityFactory_Attach.java b/src/main/java/forge/card/abilityFactory/AbilityFactory_Attach.java index 69b70fdb705..15bf4c575fc 100644 --- a/src/main/java/forge/card/abilityFactory/AbilityFactory_Attach.java +++ b/src/main/java/forge/card/abilityFactory/AbilityFactory_Attach.java @@ -775,14 +775,32 @@ public class AbilityFactory_Attach { Target tgt = aura.getTarget(); if (source.getController().isHuman()){ - CardList list = AllZoneUtil.getCardsIn(tgt.getZone()); - list = list.getValidCards(tgt.getValidTgts(), aura.getActivatingPlayer(), source); - - Object o = GuiUtils.getChoice(source + " - Select a card to attach to.", list.toArray()); - if (o instanceof Card){ - source.enchantEntity((Card)o); - return true; - } + if (tgt.canTgtPlayer()){ + ArrayList players = new ArrayList(); + + // TODO Once Player's are gaining Protection we need to add a check here + + players.add(AllZone.getComputerPlayer()); + if (!tgt.canOnlyTgtOpponent()){ + players.add(AllZone.getHumanPlayer()); + } + + Object o = GuiUtils.getChoice(source + " - Select a player to attach to.", players.toArray()); + if (o instanceof Player) { + source.enchantEntity((Player) o); + return true; + } + } + else{ + CardList list = AllZoneUtil.getCardsIn(tgt.getZone()); + list = list.getValidCards(tgt.getValidTgts(), aura.getActivatingPlayer(), source); + + Object o = GuiUtils.getChoice(source + " - Select a card to attach to.", list.toArray()); + if (o instanceof Card) { + source.enchantEntity((Card) o); + return true; + } + } } else if (AbilityFactory_Attach.attachPreference(af, aura, af.getMapParams(), tgt, true)){ @@ -791,9 +809,10 @@ public class AbilityFactory_Attach { source.enchantEntity((Card)o); return true; } - else if (o instanceof Player) - ; // c.enchantPlayer((Player)o) - + else if (o instanceof Player){ + source.enchantEntity((Player)o); + return true; + } } return false;