Better changeling token workaround; add additional test (fixes #8766)

This commit is contained in:
Alex W. Jackson 2022-03-14 02:43:12 -04:00
parent 82832046b3
commit 9af399eadb
2 changed files with 24 additions and 12 deletions

View file

@ -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);
}
}