mirror of
https://github.com/correl/mage.git
synced 2024-11-28 19:19:55 +00:00
Better changeling token workaround; add additional test (fixes #8766)
This commit is contained in:
parent
82832046b3
commit
9af399eadb
2 changed files with 24 additions and 12 deletions
|
@ -108,4 +108,24 @@ public class ChangelingTest extends CardTestPlayerBase {
|
|||
assertCounterCount(playerA, cohort, CounterType.P1P1, 1);
|
||||
assertCounterCount(playerA, "Shapeshifter", CounterType.P1P1, 1);
|
||||
}
|
||||
|
||||
private static final String amoeboid = "Amoeboid Changeling";
|
||||
|
||||
@Test
|
||||
public void testTokensCanLoseTypes() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Wizened Cenn");
|
||||
addCard(Zone.BATTLEFIELD, playerA, amoeboid);
|
||||
addCard(Zone.HAND, playerA, cohort);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, cohort);
|
||||
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{T}: Target creature loses", "Shapeshifter");
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertTapped(amoeboid, true);
|
||||
assertPowerToughness(playerA, "Shapeshifter", 2, 2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,8 +6,6 @@ import mage.abilities.costs.mana.ManaCost;
|
|||
import mage.abilities.keyword.ChangelingAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.EmptyNames;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SubTypeSet;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.game.permanent.token.Token;
|
||||
|
@ -90,6 +88,10 @@ public class PermanentToken extends PermanentImpl {
|
|||
this.subtype.copyFrom(token.getSubtype(game));
|
||||
this.tokenDescriptor = token.getTokenDescriptor();
|
||||
this.startingLoyalty = token.getStartingLoyalty();
|
||||
// workaround for entersTheBattlefield replacement effects
|
||||
if (this.abilities.containsClass(ChangelingAbility.class)) {
|
||||
this.subtype.setIsAllCreatureTypes(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -119,14 +121,4 @@ public class PermanentToken extends PermanentImpl {
|
|||
// token don't have game card, so return itself
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSubtype(SubType value, Game game) {
|
||||
if (super.hasSubtype(value, game)) {
|
||||
return true;
|
||||
}
|
||||
return this.isCreature(game)
|
||||
&& value.getSubTypeSet() == SubTypeSet.CreatureType
|
||||
&& this.getAbilities(game).containsClass(ChangelingAbility.class);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue