enable multiple added subtypes in CreateTokenCopyTargetEffect (#11181)

fix #11176
This commit is contained in:
xenohedron 2023-09-19 01:41:40 -04:00 committed by GitHub
parent 8eb29c8af1
commit 0ad678ff56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 25 additions and 67 deletions

View file

@ -42,7 +42,7 @@ public final class AstralDragon extends CardImpl {
false, null, 3, 3, true);
effect.setText("create two tokens that are copies of target noncreature permanent, " +
"except they're 3/3 Dragon creatures in addition to their other types, and they have flying");
effect.setAdditionalSubType(SubType.DRAGON);
effect.withAdditionalSubType(SubType.DRAGON);
Ability ability = new EntersBattlefieldTriggeredAbility(effect);
ability.addTarget(new TargetPermanent(filter));
this.addAbility(ability.withFlavorWord("Project Image"));

View file

@ -106,8 +106,8 @@ class BrenardGingerSculptorEffect extends OneShotEffect {
);
effect.setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game) + 1));
effect.setBecomesArtifact(true);
effect.setAdditionalSubType(SubType.FOOD);
effect.setAdditionalSubType(SubType.GOLEM);
effect.withAdditionalSubType(SubType.FOOD);
effect.withAdditionalSubType(SubType.GOLEM);
effect.addAdditionalAbilities(new FoodAbility(false));
player.moveCards(card, Zone.EXILED, source, game);

View file

@ -90,7 +90,7 @@ class DollhouseOfHorrorsEffect extends OneShotEffect {
false, null, 0, 0, false
);
effect.setSavedPermanent(new PermanentCard(CardUtil.getDefaultCardSideForBattlefield(game, card), source.getControllerId(), game));
effect.setAdditionalSubType(SubType.CONSTRUCT);
effect.withAdditionalSubType(SubType.CONSTRUCT);
effect.addAdditionalAbilities(new SimpleStaticAbility(new BoostSourceEffect(
xValue,
xValue,

View file

@ -73,7 +73,7 @@ class ForceProjectionEffect extends OneShotEffect {
effect.setTargetPointer(new FixedTarget(permanent, game));
// except that it is an Illusion in addition to its other types
effect.setAdditionalSubType(SubType.SPIRIT);
effect.withAdditionalSubType(SubType.SPIRIT);
// and gains "When this creature becomes the target of a spell, sacrifice it."
effect.addAdditionalAbilities(new SourceBecomesTargetTriggeredAbility(new SacrificeSourceEffect(), new FilterSpell()));

View file

@ -2,7 +2,6 @@ package mage.cards.g;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.common.DiesCreatureTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
@ -13,18 +12,14 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.DefendingPlayerControlsSourceAttackingPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
@ -73,44 +68,6 @@ public final class GenestealerPatriarch extends CardImpl {
}
}
class GenestealerPatriarchTriggeredAbility extends TriggeredAbilityImpl {
public GenestealerPatriarchTriggeredAbility() {
super(Zone.BATTLEFIELD, new GenestealerPatriarchCloneEffect());
setTriggerPhrase("Whenever a creature with an infection counter on it dies, ");
;
}
private GenestealerPatriarchTriggeredAbility(final GenestealerPatriarchTriggeredAbility ability) {
super(ability);
}
@Override
public GenestealerPatriarchTriggeredAbility copy() {
return new GenestealerPatriarchTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ZONE_CHANGE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.isDiesEvent()) {
Permanent permanent = game.getPermanentOrLKIBattlefield(zEvent.getTargetId());
if (permanent != null
&& permanent.isCreature(game)
&& permanent.getCounters(game).containsKey(CounterType.INFECTION)) {
this.getEffects().setTargetPointer(new FixedTarget(event.getTargetId(), game));
return true;
}
}
return false;
}
}
class GenestealerPatriarchCloneEffect extends OneShotEffect {
public GenestealerPatriarchCloneEffect() {
@ -137,7 +94,7 @@ class GenestealerPatriarchCloneEffect extends OneShotEffect {
}
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(source.getControllerId());
effect.setSavedPermanent(creature);
effect.setAdditionalSubType(SubType.TYRANID);
effect.withAdditionalSubType(SubType.TYRANID);
return effect.apply(game, source);
}
}

View file

@ -88,7 +88,7 @@ class GhastlyMimicryEffect extends OneShotEffect {
return false;
}
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect();
effect.setAdditionalSubType(SubType.SPIRIT);
effect.withAdditionalSubType(SubType.SPIRIT);
return effect.setTargetPointer(new FixedTarget(attached, game)).apply(game, source);
}
}

View file

@ -86,7 +86,7 @@ class HauntingImitationEffect extends OneShotEffect {
source.getControllerId(), null, false, 1, false,
false, null, 1, 1, true
);
effect.setAdditionalSubType(SubType.SPIRIT);
effect.withAdditionalSubType(SubType.SPIRIT);
for (Card card : cards.getCards(game)) {
effect.setSavedPermanent(new PermanentCard(CardUtil.getDefaultCardSideForBattlefield(game, card), source.getControllerId(), game));
effect.apply(game, source);

View file

@ -109,7 +109,7 @@ class HofriGhostforgeEffect extends OneShotEffect {
player.moveCards(card, Zone.EXILED, source, game);
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(source.getControllerId());
effect.setTargetPointer(new FixedTarget(card, game));
effect.setAdditionalSubType(SubType.SPIRIT);
effect.withAdditionalSubType(SubType.SPIRIT);
effect.addAdditionalAbilities(new ZoneChangeTriggeredAbility(
Zone.ALL, Zone.BATTLEFIELD, null, new HofriGhostforgeReturnEffect(card, game),
"When this creature leaves the battlefield, ", false

View file

@ -134,7 +134,7 @@ class KayaIntangibleSlayerExileEffect extends OneShotEffect {
);
effect.setSavedPermanent(permanent);
effect.setOnlyColor(ObjectColor.WHITE);
effect.setAdditionalSubType(SubType.SPIRIT);
effect.withAdditionalSubType(SubType.SPIRIT);
effect.apply(game, source);
return true;
}

View file

@ -91,9 +91,9 @@ class NightmareShepherdEffect extends OneShotEffect {
false, null, 1, 1, false
);
effect.setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game) + 1));
effect.setAdditionalSubType(SubType.NIGHTMARE);
effect.withAdditionalSubType(SubType.NIGHTMARE);
player.moveCards(card, Zone.EXILED, source, game);
effect.apply(game, source);
return true;
}
}
}

View file

@ -99,7 +99,7 @@ class RatadrabikOfUrborgEffect extends OneShotEffect {
return false;
}
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(controller.getId(), null, false,1,false,false,null,2,2,false);
effect.setAdditionalSubType(SubType.ZOMBIE);
effect.withAdditionalSubType(SubType.ZOMBIE);
effect.setIsntLegendary(true);
effect.setTargetPointer(new FixedTarget(copyFrom.getId(),game));
ObjectColor colors = copyFrom.getColor();

View file

@ -72,7 +72,7 @@ class SeanceEffect extends OneShotEffect {
controller.moveCards(card, Zone.EXILED, source, game); // Also if the move to exile is replaced, the copy takes place
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(source.getControllerId(), null, false);
effect.setTargetPointer(new FixedTarget(card, game));
effect.setAdditionalSubType(SubType.SPIRIT);
effect.withAdditionalSubType(SubType.SPIRIT);
effect.apply(game, source);
ExileTargetEffect exileEffect = new ExileTargetEffect();
exileEffect.setTargetPointer(new FixedTargets(effect.getAddedPermanents(), game));

View file

@ -41,7 +41,7 @@ public final class SoulSeparator extends CardImpl {
// create those tokens.
CreateTokenCopyTargetEffect copyEffect = new CreateTokenCopyTargetEffect(null, null, false, 1, false, false, null, 1, 1, true);
copyEffect.setAdditionalSubType(SubType.SPIRIT);
copyEffect.withAdditionalSubType(SubType.SPIRIT);
copyEffect.setText("Exile target creature card from your graveyard. Create a token that's a copy of that card, except it's 1/1, it's a Spirit in addition to its other types, and it has flying");
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, copyEffect, new ManaCostsImpl<>("{5}"));
ability.addCost(new TapSourceCost());

View file

@ -10,7 +10,6 @@ import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SagaChapter;
import mage.constants.SubType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.ObjectSourcePlayer;
@ -49,7 +48,7 @@ public final class TheApprenticesFolly extends CardImpl {
sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_I, SagaChapter.CHAPTER_II,
new CreateTokenCopyTargetEffect(null, null, true, 1)
.setIsntLegendary(true)
.setAdditionalSubType(SubType.REFLECTION)
.withAdditionalSubType(SubType.REFLECTION)
.setText("choose target nontoken creature you control that doesn't have the same name as a "
+ "token you control. Create a token that's a copy of it, except it isn't legendary, "
+ "is a Reflection in addition to its other types, and has haste"),

View file

@ -42,7 +42,7 @@ public final class UrzaPrinceOfKroog extends CardImpl {
Ability ability = new SimpleActivatedAbility(new CreateTokenCopyTargetEffect(
null, CardType.CREATURE, false, 1, false,
false, null, 1, 1, false
).setAdditionalSubType(SubType.SOLDIER).setText("create a token that's a copy of target artifact you control, " +
).withAdditionalSubType(SubType.SOLDIER).setText("create a token that's a copy of target artifact you control, " +
"except it's a 1/1 Soldier creature in addition to its other types"), new GenericManaCost(6));
ability.addTarget(new TargetPermanent(StaticFilters.FILTER_CONTROLLED_PERMANENT_ARTIFACT));
this.addAbility(ability);

View file

@ -40,7 +40,7 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
private final List<Permanent> addedTokenPermanents;
private final List<Ability> additionalAbilities;
private final CardType additionalCardType;
private SubType additionalSubType;
private final List<SubType> additionalSubTypes = new ArrayList<>();
private final UUID attackedPlayer;
private UUID attachedTo = null;
private final boolean attacking;
@ -133,7 +133,7 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
this.addedTokenPermanents = new ArrayList<>(effect.addedTokenPermanents);
this.additionalAbilities = new ArrayList<>(effect.additionalAbilities);
this.additionalCardType = effect.additionalCardType;
this.additionalSubType = effect.additionalSubType;
this.additionalSubTypes.addAll(effect.additionalSubTypes);
this.attackedPlayer = effect.attackedPlayer;
this.attachedTo = effect.attachedTo;
this.attacking = effect.attacking;
@ -236,8 +236,10 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
token.removeAllCreatureTypes();
token.addSubType(onlySubType);
}
if (additionalSubType != null) {
token.addSubType(additionalSubType);
if (!additionalSubTypes.isEmpty()) {
for (SubType additionalSubType : additionalSubTypes) {
token.addSubType(additionalSubType);
}
}
if (color != null) {
token.setColor(color);
@ -322,8 +324,8 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
return addedTokenPermanents;
}
public CreateTokenCopyTargetEffect setAdditionalSubType(SubType additionalSubType) {
this.additionalSubType = additionalSubType;
public CreateTokenCopyTargetEffect withAdditionalSubType(SubType additionalSubType) {
this.additionalSubTypes.add(additionalSubType);
return this;
}