From 35845448e1e0cf93118754cf77c992dd67adb3fd Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Thu, 28 Jan 2016 23:48:55 +0100 Subject: [PATCH] * Kabira Evangel - Fixed that if the triggered ability triggered multiple times during one turn, it did not work correctly for different colors. --- .../src/mage/sets/zendikar/KabiraEvangel.java | 6 +++--- .../continuous/GainAbilityAllEffect.java | 11 +++++------ .../GainProtectionFromColorAllEffect.java | 19 ++++++++++--------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Mage.Sets/src/mage/sets/zendikar/KabiraEvangel.java b/Mage.Sets/src/mage/sets/zendikar/KabiraEvangel.java index d686cc470de..20e2ccc3152 100644 --- a/Mage.Sets/src/mage/sets/zendikar/KabiraEvangel.java +++ b/Mage.Sets/src/mage/sets/zendikar/KabiraEvangel.java @@ -49,10 +49,10 @@ import mage.filter.predicate.mageobject.SubtypePredicate; */ public class KabiraEvangel extends CardImpl { - private static final FilterControlledCreaturePermanent filter1 = new FilterControlledCreaturePermanent(); + private static final FilterControlledCreaturePermanent FILTER1 = new FilterControlledCreaturePermanent(); static { - filter1.add(new SubtypePredicate("Ally")); + FILTER1.add(new SubtypePredicate("Ally")); } public KabiraEvangel(UUID ownerId) { @@ -69,7 +69,7 @@ public class KabiraEvangel extends CardImpl { filter2.add(Predicates.or(new CardIdPredicate(this.getId()), new SubtypePredicate("Ally"))); // Whenever Kabira Evangel or another Ally enters the battlefield under your control, you may choose a color. If you do, Allies you control gain protection from the chosen color until end of turn. - Effect effect = new GainProtectionFromColorAllEffect(Duration.EndOfTurn, filter1); + Effect effect = new GainProtectionFromColorAllEffect(Duration.EndOfTurn, FILTER1); effect.setText("choose a color. If you do, Allies you control gain protection from the chosen color until end of turn."); this.addAbility(new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, effect, filter2, true)); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAllEffect.java index c396066e68d..70ec50c9b2b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAllEffect.java @@ -75,7 +75,8 @@ public class GainAbilityAllEffect extends ContinuousEffectImpl { public GainAbilityAllEffect(Ability ability, Duration duration, FilterPermanent filter, boolean excludeSource, Layer layer, SubLayer subLayer) { super(duration, layer, subLayer, Outcome.AddAbility); - this.ability = ability; + this.ability = ability.copy(); + this.ability.newId(); this.filter = filter; this.excludeSource = excludeSource; } @@ -160,12 +161,10 @@ public class GainAbilityAllEffect extends ContinuousEffectImpl { } else { sb.append(" have "); } + } else if (filter.getMessage().toLowerCase().startsWith("each")) { + sb.append(" gains "); } else { - if (filter.getMessage().toLowerCase().startsWith("each")) { - sb.append(" gains "); - } else { - sb.append(" gain "); - } + sb.append(" gain "); } if (quotes) { sb.append("\""); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainProtectionFromColorAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainProtectionFromColorAllEffect.java index de153c0b625..bce7d965900 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainProtectionFromColorAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainProtectionFromColorAllEffect.java @@ -55,7 +55,7 @@ public class GainProtectionFromColorAllEffect extends GainAbilityAllEffect { public GainProtectionFromColorAllEffect(final GainProtectionFromColorAllEffect effect) { super(effect); - choice = effect.choice; + this.choice = effect.choice.copy(); } @Override @@ -65,10 +65,10 @@ public class GainProtectionFromColorAllEffect extends GainAbilityAllEffect { @Override public boolean apply(Game game, Ability source) { - FilterCard protectionFilter = (FilterCard)((ProtectionAbility)ability).getFilter(); + FilterCard protectionFilter = (FilterCard) ((ProtectionAbility) ability).getFilter(); protectionFilter.add(new ColorPredicate(choice.getColor())); protectionFilter.setMessage(choice.getChoice()); - ((ProtectionAbility)ability).setFilter(protectionFilter); + ((ProtectionAbility) ability).setFilter(protectionFilter); return super.apply(game, source); } @@ -77,22 +77,23 @@ public class GainProtectionFromColorAllEffect extends GainAbilityAllEffect { super.init(source, game); MageObject sourceObject = game.getObject(source.getSourceId()); Player controller = game.getPlayer(source.getControllerId()); - if(sourceObject != null && controller != null) { + if (sourceObject != null && controller != null) { choice.clearChoice(); - while(!choice.isChosen()) { + while (!choice.isChosen()) { controller.choose(Outcome.Protect, choice, game); - if(!controller.canRespond()) { + if (!controller.canRespond()) { return; } } - if(choice.isChosen() && !game.isSimulation()) { - game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " has chosen protection from " + choice.getChoice()); } + if (choice.isChosen() && !game.isSimulation()) { + game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " has chosen protection from " + choice.getChoice()); + } } } @Override public String getText(Mode mode) { - if(staticText != null && !staticText.isEmpty()) { + if (staticText != null && !staticText.isEmpty()) { return staticText; }