From aa0122cff977b08872a63673e8082c5d50911c27 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sat, 23 Mar 2013 16:45:07 +0100 Subject: [PATCH] Fixed a bug that multiple protection effects of Kabira Evangel had alway sall the last chosen color. --- Mage.Sets/src/mage/sets/zendikar/KabiraEvangel.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Mage.Sets/src/mage/sets/zendikar/KabiraEvangel.java b/Mage.Sets/src/mage/sets/zendikar/KabiraEvangel.java index 15c17dab91..836cc3cbd2 100644 --- a/Mage.Sets/src/mage/sets/zendikar/KabiraEvangel.java +++ b/Mage.Sets/src/mage/sets/zendikar/KabiraEvangel.java @@ -109,8 +109,7 @@ class ChooseColorEffect extends OneShotEffect { ChoiceColor colorChoice = new ChoiceColor(); if (player.choose(Constants.Outcome.Benefit, colorChoice, game)) { game.informPlayers(perm.getName() + ": " + player.getName() + " has chosen " + colorChoice.getChoice()); - game.getState().setValue(perm.getId() + "_color", colorChoice.getColor()); - game.addEffect(new GainProtectionFromChosenColorEffect(), source); + game.addEffect(new GainProtectionFromChosenColorEffect(colorChoice.getColor()), source); } } return false; @@ -131,15 +130,18 @@ class GainProtectionFromChosenColorEffect extends GainAbilityControlledEffect { filter1.add(new SubtypePredicate("Ally")); } private FilterCard filter2; + private ObjectColor chosenColor; - public GainProtectionFromChosenColorEffect() { + public GainProtectionFromChosenColorEffect(ObjectColor chosenColor) { super(new ProtectionAbility(new FilterCard()), Duration.EndOfTurn, filter1); filter2 = (FilterCard) ((ProtectionAbility) getFirstAbility()).getFilter(); + this.chosenColor = chosenColor; } public GainProtectionFromChosenColorEffect(final GainProtectionFromChosenColorEffect effect) { super(effect); this.filter2 = effect.filter2.copy(); + this.chosenColor = effect.chosenColor; } @Override @@ -149,7 +151,6 @@ class GainProtectionFromChosenColorEffect extends GainAbilityControlledEffect { @Override public boolean apply(Game game, Ability source) { - ObjectColor chosenColor = (ObjectColor) game.getState().getValue(source.getSourceId() + "_color"); filter2.add(new ColorPredicate(chosenColor)); filter2.setMessage(chosenColor.getDescription()); setAbility(new ProtectionAbility(new FilterCard(filter2)));