From c7bdc5719d2fa04d007d2055f65c5832c69f4fcc Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 23 Apr 2013 23:08:19 +0200 Subject: [PATCH] Fixed #208. Assemble the Legion's effect works also when it has lost the battlefield meanwhile using last known information. --- .../sets/gatecrash/AssembleTheLegion.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Mage.Sets/src/mage/sets/gatecrash/AssembleTheLegion.java b/Mage.Sets/src/mage/sets/gatecrash/AssembleTheLegion.java index 5b2ea47551..c8b2b3b18b 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/AssembleTheLegion.java +++ b/Mage.Sets/src/mage/sets/gatecrash/AssembleTheLegion.java @@ -32,6 +32,7 @@ import mage.Constants.CardType; import mage.Constants.Outcome; import mage.Constants.Rarity; import mage.Constants.TargetController; +import mage.Constants.Zone; import mage.abilities.Ability; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.effects.OneShotEffect; @@ -87,10 +88,24 @@ class AssembleTheLegionEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { + /* 1/24/2013: If Assemble the Legion isn’t on the battlefield when its ability resolves, + * use the number of muster counters it had when it was last on the battlefield to + * determine how many Soldier tokens to put onto the battlefield. + */ + Permanent sourcePermanent = game.getPermanent(source.getSourceId()); - if (sourcePermanent != null) { + int amountCounters = 0; + if (sourcePermanent == null) { + Permanent lki = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); + if (lki != null) { + amountCounters = lki.getCounters().getCount("Muster"); + } + } else { new AddCountersSourceEffect(new MusterCounter(),false).apply(game, source); - int amountCounters = sourcePermanent.getCounters().getCount("Muster"); + amountCounters = sourcePermanent.getCounters().getCount("Muster"); + + } + if (amountCounters > 0) { return new CreateTokenEffect(new SoldierToken(), amountCounters).apply(game, source); } return false;