diff --git a/forge-game/src/main/java/forge/game/ability/effects/AttachEffect.java b/forge-game/src/main/java/forge/game/ability/effects/AttachEffect.java index 5687b3e8d8f..5398c0b277f 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/AttachEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/AttachEffect.java @@ -36,30 +36,36 @@ public class AttachEffect extends SpellAbilityEffect { } Card source = sa.getHostCard(); - Card card = sa.getHostCard(); - final List targets = getTargets(sa); + CardCollection attachments; + final List targets = getDefinedOrTargeted(sa, "Defined"); + GameObject attachTo; + + if (targets.isEmpty()) { + return; + } else { + attachTo = targets.get(0); + } final Player p = sa.getActivatingPlayer(); - String message = "Do you want to attach " + card + " to " + targets + "?"; - if ( sa.hasParam("Optional") && !p.getController().confirmAction(sa, null, message) ) - return; if (sa.hasParam("Object")) { - CardCollection lists = AbilityUtils.getDefinedCards(source, sa.getParam("Object"), sa); + attachments = AbilityUtils.getDefinedCards(source, sa.getParam("Object"), sa); if (sa.hasParam("ChooseAnObject")) { - card = p.getController().chooseSingleEntityForEffect(lists, sa, sa.getParam("ChooseAnObject")); - } else { - card = Iterables.getFirst(lists, null); - } - if (card == null) { - return; + Card c = p.getController().chooseSingleEntityForEffect(attachments, sa, sa.getParam("ChooseAnObject")); + attachments.clear(); + attachments.add(c); } + } else { + attachments = new CardCollection(source); } // If Cast Targets will be checked on the Stack - for (final Object o : targets) { - handleAttachment(card, o, sa); + for (final Card attachment : attachments) { + String message = "Do you want to attach " + attachment + " to " + attachTo + "?"; + if ( sa.hasParam("Optional") && !p.getController().confirmAction(sa, null, message) ) + continue; + handleAttachment(attachment, attachTo, sa); } } diff --git a/forge-gui/res/cardsfolder/a/armory_automaton.txt b/forge-gui/res/cardsfolder/a/armory_automaton.txt index e460bb46fa3..e6ac779a3c4 100644 --- a/forge-gui/res/cardsfolder/a/armory_automaton.txt +++ b/forge-gui/res/cardsfolder/a/armory_automaton.txt @@ -2,12 +2,10 @@ Name:Armory Automaton ManaCost:3 Types:Artifact Creature Construct PT:2/2 -T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigPump | OptionalDecider$ You | TriggerDescription$ Whenever CARDNAME enters the battlefield, you may attach any number of target Equipment to it. (Control of the Equipment doesn't change.) -T:Mode$ Attacks | ValidCard$ Card.Self | Execute$ TrigPump | TriggerZones$ Battlefield | OptionalDecider$ You | TriggerDescription$ Whenever CARDNAME attacks, you may attach any number of target Equipment to it. (Control of the Equipment doesn't change.) -SVar:TrigPump:AB$ Pump | Cost$ 0 | ValidTgts$ Equipment | TargetMin$ 0 | TargetMax$ MaxTargets | TgtPrompt$ Select target equipment | SubAbility$ DBAttachAll | StackDescription$ None +T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ DBAttach | OptionalDecider$ You | TriggerDescription$ Whenever CARDNAME enters the battlefield or attacks, you may attach any number of target Equipment to it. (Control of the Equipment doesn't change.) +T:Mode$ Attacks | ValidCard$ Card.Self | Execute$ DBAttach | TriggerZones$ Battlefield | OptionalDecider$ You | Secondary$ True | TriggerDescription$ Whenever CARDNAME attacks, you may attach any number of target Equipment to it. (Control of the Equipment doesn't change.) +SVar:DBAttach:DB$ Attach | ValidTgts$ Equipment | TargetMin$ 0 | TargetMax$ MaxTargets | Object$ Targeted | Defined$ Self SVar:MaxTargets:Count$Valid Equipment -SVar:TrigAttachAll:AB$ RepeatEach | Cost$ 0 | RepeatSubAbility$ DBAttach | RepeatCards$ ParentTarget | SpellDescription$ attach all Equipment on the battlefield to CARDNAME. -SVarDBAttach:DB$ Attach | Object$ Remembered | Defined$ Self SVar:HasAttackEffect:TRUE SVar:Picture:http://www.wizards.com/global/images/magic/general/armory_automaton.jpg Oracle:Whenever Armory Automaton enters the battlefield or attacks, you may attach any number of target Equipment to it. (Control of the Equipment doesn't change.)