- Added support for Attaching to Players on Auras ETB Indirectly.

This commit is contained in:
Sol
2011-09-21 00:37:12 +00:00
parent 0f6fbfe728
commit ffe83b0af3

View File

@@ -775,15 +775,33 @@ public class AbilityFactory_Attach {
Target tgt = aura.getTarget(); Target tgt = aura.getTarget();
if (source.getController().isHuman()){ if (source.getController().isHuman()){
if (tgt.canTgtPlayer()){
ArrayList<Player> players = new ArrayList<Player>();
// 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()); CardList list = AllZoneUtil.getCardsIn(tgt.getZone());
list = list.getValidCards(tgt.getValidTgts(), aura.getActivatingPlayer(), source); list = list.getValidCards(tgt.getValidTgts(), aura.getActivatingPlayer(), source);
Object o = GuiUtils.getChoice(source + " - Select a card to attach to.", list.toArray()); Object o = GuiUtils.getChoice(source + " - Select a card to attach to.", list.toArray());
if (o instanceof Card){ if (o instanceof Card) {
source.enchantEntity((Card)o); source.enchantEntity((Card) o);
return true; return true;
} }
} }
}
else if (AbilityFactory_Attach.attachPreference(af, aura, af.getMapParams(), tgt, true)){ else if (AbilityFactory_Attach.attachPreference(af, aura, af.getMapParams(), tgt, true)){
Object o = aura.getTarget().getTargets().get(0); Object o = aura.getTarget().getTargets().get(0);
@@ -791,9 +809,10 @@ public class AbilityFactory_Attach {
source.enchantEntity((Card)o); source.enchantEntity((Card)o);
return true; return true;
} }
else if (o instanceof Player) else if (o instanceof Player){
; // c.enchantPlayer((Player)o) source.enchantEntity((Player)o);
return true;
}
} }
return false; return false;