Merge pull request #6693 from 18ths/force_mirrormade

#6618 - Creatures get +1/+1 when we cancel the cast of a spell.
This commit is contained in:
LevelX2 2020-06-24 08:03:57 +02:00 committed by GitHub
commit 8b5f4f28f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 1 deletions

View file

@ -0,0 +1,38 @@
package org.mage.test.rollback;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
public class CopyAnthemEffectTest extends CardTestPlayerBase {
// Addresses issue #6618 - Creatures get +1/+1 when we cancel the cast of a spell
// Creatures of one player get +1/+1 every time someone cancel the cast of a spell.
// Looks like the repeating effect was Force Of Virtue's static ability
// There was also a Mirrormade cast to copy Force of Virtue
// Further investigation shown that the problem could be also reduced to any anthem effect copied by other permanent, then rollbacking
@Test
public void copyAnthemEffect() {
addCard(Zone.BATTLEFIELD, playerA, "Runeclaw Bear"); // 2/2 vanilla creature
addCard(Zone.BATTLEFIELD, playerA, "Glorious Anthem"); // creatures you control have +1/+1
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
addCard(Zone.HAND, playerA, "Copy Enchantment");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Copy Enchantment");
setChoice(playerA, "Yes");
setChoice(playerA, "Glorious Anthem");
rollbackTurns(3, PhaseStep.UPKEEP, playerA, 0);
setStopAt(3, PhaseStep.BEGIN_COMBAT);
execute();
assertAllCommandsUsed();
assertPowerToughness(playerA, "Runeclaw Bear", 4, 4);
}
}

View file

@ -210,7 +210,7 @@ public class ContinuousEffectsList<T extends ContinuousEffect> extends ArrayList
public void removeEffects(UUID effectIdToRemove, Set<Ability> abilitiesToRemove) {
Set<Ability> abilities = effectAbilityMap.get(effectIdToRemove);
if (abilitiesToRemove != null && abilities != null) {
abilities.removeAll(abilitiesToRemove);
abilities.removeIf(ability -> abilitiesToRemove.stream().anyMatch(a -> a.isSameInstance(ability)));
}
if (abilities == null || abilities.isEmpty()) {
for (Iterator<T> iterator = this.iterator(); iterator.hasNext();) {