Merge pull request #2318 from cg5-/aetherborn-marauder-fix

Fix Aetherborn Marauder's ETB ability
This commit is contained in:
LevelX2 2016-09-19 07:13:50 +02:00 committed by GitHub
commit 8f836f8cda

View file

@ -101,7 +101,7 @@ class AetherbornMarauderEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
Permanent sourceObject = game.getPermanent(source.getSourceId()); Permanent sourceObject = game.getPermanent(source.getSourceId());
if (controller != null && sourceObject != null) { if (controller != null && sourceObject != null) {
FilterControlledPermanent filter = new FilterControlledPermanent("permanent you control from where you like to remove +1/+1 counters"); FilterControlledPermanent filter = new FilterControlledPermanent("permanent you control to remove +1/+1 counters from");
filter.add(new AnotherPredicate()); filter.add(new AnotherPredicate());
filter.add(new CounterPredicate(CounterType.P1P1)); filter.add(new CounterPredicate(CounterType.P1P1));
boolean firstRun = true; boolean firstRun = true;
@ -109,16 +109,19 @@ class AetherbornMarauderEffect extends OneShotEffect {
if (controller.chooseUse(outcome, "Move " + (firstRun ? "any" : "more") + " +1/+1 counters from other permanents you control to " + sourceObject.getLogName() + "?", source, game)) { if (controller.chooseUse(outcome, "Move " + (firstRun ? "any" : "more") + " +1/+1 counters from other permanents you control to " + sourceObject.getLogName() + "?", source, game)) {
firstRun = false; firstRun = false;
TargetControlledPermanent target = new TargetControlledPermanent(filter); TargetControlledPermanent target = new TargetControlledPermanent(filter);
Permanent fromPermanent = game.getPermanent(target.getFirstTarget()); target.setNotTarget(true);
if (fromPermanent != null) { if (target.choose(Outcome.Neutral, source.getControllerId(), source.getSourceId(), game)) {
int numberOfCounters = fromPermanent.getCounters(game).getCount(CounterType.P1P1); Permanent fromPermanent = game.getPermanent(target.getFirstTarget());
int numberToMove = 1; if (fromPermanent != null) {
if (numberOfCounters > 1) { int numberOfCounters = fromPermanent.getCounters(game).getCount(CounterType.P1P1);
numberToMove = controller.getAmount(0, numberOfCounters, "How many +1/+1 counters do you want to move?", game); int numberToMove = 1;
} if (numberOfCounters > 1) {
if (numberToMove > 0) { numberToMove = controller.getAmount(0, numberOfCounters, "How many +1/+1 counters do you want to move?", game);
fromPermanent.removeCounters(CounterType.P1P1.createInstance(numberToMove), game); }
sourceObject.addCounters(CounterType.P1P1.createInstance(numberToMove), game); if (numberToMove > 0) {
fromPermanent.removeCounters(CounterType.P1P1.createInstance(numberToMove), game);
sourceObject.addCounters(CounterType.P1P1.createInstance(numberToMove), game);
}
} }
} }
} else { } else {