From 2a31e8063b0886f888f1cb4ad68d14c213bfc1c4 Mon Sep 17 00:00:00 2001 From: LevelX2 <ludwig.hirth@online.de> Date: Thu, 2 Jul 2020 17:23:00 +0200 Subject: [PATCH] * Spells with multiple modes resolve in the order the modes are added on the card (fixes #6771). --- Mage/src/main/java/mage/game/stack/Spell.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Mage/src/main/java/mage/game/stack/Spell.java b/Mage/src/main/java/mage/game/stack/Spell.java index bfc7d4b24f..4757c51e62 100644 --- a/Mage/src/main/java/mage/game/stack/Spell.java +++ b/Mage/src/main/java/mage/game/stack/Spell.java @@ -35,6 +35,7 @@ import mage.util.SubTypeList; import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.Map.Entry; import java.util.Set; import java.util.UUID; @@ -222,12 +223,14 @@ public class Spell extends StackObjImpl implements Card { for (SpellAbility spellAbility : this.spellAbilities) { // legality of targets is checked only as the spell begins to resolve, not in between modes (spliced spells handeled correctly?) if (spellAbilityCheckTargetsAndDeactivateModes(spellAbility, game)) { - for (UUID modeId : spellAbility.getModes().getSelectedModes()) { - spellAbility.getModes().setActiveMode(modeId); - if (spellAbility.getSpellAbilityType() != SpellAbilityType.SPLICE) { - updateOptionalCosts(index); + for (Mode mode : spellAbility.getModes().values()) { + if (spellAbility.getModes().getSelectedModes().contains(mode.getId())) { + spellAbility.getModes().setActiveMode(mode.getId()); + if (spellAbility.getSpellAbilityType() != SpellAbilityType.SPLICE) { + updateOptionalCosts(index); + } + result |= spellAbility.resolve(game); } - result |= spellAbility.resolve(game); } index++; } @@ -319,9 +322,10 @@ public class Spell extends StackObjImpl implements Card { } /** - * Legality of the targets of all modes are only checked as the spell begins to resolve - * A mode without any legal target (if it has targets at all) won't resolve. - * So modes with targets without legal targets are unselected. + * Legality of the targets of all modes are only checked as the spell begins + * to resolve A mode without any legal target (if it has targets at all) + * won't resolve. So modes with targets without legal targets are + * unselected. * * @param spellAbility * @param game