* Archetype cards - Fixed layer to interact correctly with ability adding/removing continuous effects.

This commit is contained in:
LevelX2 2020-08-07 22:52:45 +02:00
parent 2abeb43449
commit fcf27e55d6
2 changed files with 95 additions and 3 deletions

View file

@ -0,0 +1,90 @@
package org.mage.test.cards.single.iko;
import mage.ObjectColor;
import mage.abilities.keyword.FlyingAbility;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class SkycatSovereignTest extends CardTestPlayerBase {
@Test
public void test_BoostFromFlyers() {
setStrictChooseMode(true);
// Flying
// Skycat Sovereign gets +1/+1 for each other creature you control with flying.
// {2}{W}{U}: Create a 1/1 white Cat Bird creature token with flying.
addCard(Zone.BATTLEFIELD, playerA, "Skycat Sovereign"); // Creature {W}{U} (1/1)
// Flying, vigilance
addCard(Zone.BATTLEFIELD, playerA, "Abbey Griffin", 2); // Creature Griffin (2/2)
setStopAt(1, PhaseStep.PRECOMBAT_MAIN);
execute();
assertAllCommandsUsed();
assertPowerToughness(playerA, "Skycat Sovereign", 3, 3);
}
/**
* Skycat Sovereign still gets +1/+1 for each creature that is supposed to have flying when there's an opposing Archetype of Imagination.
*/
@Test
public void test_NoBoostIfFlyingLost() {
setStrictChooseMode(true);
// Flying
// Skycat Sovereign gets +1/+1 for each other creature you control with flying.
// {2}{W}{U}: Create a 1/1 white Cat Bird creature token with flying.
addCard(Zone.BATTLEFIELD, playerA, "Skycat Sovereign"); // Creature {W}{U} (1/1)
// Flying, vigilance
addCard(Zone.BATTLEFIELD, playerA, "Abbey Griffin", 2); // Creature Griffin (2/2)
// Creatures you control have flying.
// Creatures your opponents control lose flying and can't have or gain flying.
addCard(Zone.BATTLEFIELD, playerB, "Archetype of Imagination"); //
setStopAt(1, PhaseStep.PRECOMBAT_MAIN);
execute();
assertAllCommandsUsed();
assertPowerToughness(playerA, "Skycat Sovereign", 1, 1);
}
@Test
public void test_BoostFromToken() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, "Plains");
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
// Flying
// Skycat Sovereign gets +1/+1 for each other creature you control with flying.
// {2}{W}{U}: Create a 1/1 white Cat Bird creature token with flying.
addCard(Zone.BATTLEFIELD, playerA, "Skycat Sovereign"); // Creature {W}{U} (1/1)
// Flying, vigilance
addCard(Zone.BATTLEFIELD, playerA, "Abbey Griffin", 2); // Creature Griffin (2/2)
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2}{W}{U}: Create");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerA, "Cat Bird", 1);
assertColor(playerA, "Cat Bird", ObjectColor.WHITE, true);
assertColor(playerA, "Cat Bird", ObjectColor.BLUE, false);
assertAbility(playerA, "Cat Bird", FlyingAbility.getInstance(), true);
assertPowerToughness(playerA, "Skycat Sovereign", 4, 4);
}
}

View file

@ -3,6 +3,7 @@ package mage.abilities.effects.common.continuous;
import mage.abilities.Ability;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.constants.DependencyType;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
@ -18,14 +19,15 @@ import mage.players.Player;
*/
public class CreaturesCantGetOrHaveAbilityEffect extends ContinuousEffectImpl {
private Ability ability;
private FilterCreaturePermanent filter;
private final Ability ability;
private final FilterCreaturePermanent filter;
public CreaturesCantGetOrHaveAbilityEffect(Ability ability, Duration duration, FilterCreaturePermanent filter) {
super(duration, Outcome.Detriment);
this.ability = ability;
this.filter = filter;
setText();
addDependedToType(DependencyType.AddingAbility);
}
public CreaturesCantGetOrHaveAbilityEffect(final CreaturesCantGetOrHaveAbilityEffect effect) {
@ -61,7 +63,7 @@ public class CreaturesCantGetOrHaveAbilityEffect extends ContinuousEffectImpl {
@Override
public boolean hasLayer(Layer layer) {
return layer == Layer.RulesEffects;
return layer == Layer.AbilityAddingRemovingEffects_6;
}
private void setText() {