mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
* Fixed some cards where effects for put into play tokens were not applied to all tokens if multiple tokens (e.g. caused by Doubling Season) were put into play.
This commit is contained in:
parent
78071ce0a3
commit
cc93840897
10 changed files with 150 additions and 112 deletions
|
@ -71,7 +71,7 @@ public class FelhideSpiritbinder extends CardImpl {
|
||||||
this.toughness = new MageInt(4);
|
this.toughness = new MageInt(4);
|
||||||
|
|
||||||
// <i>Inspired</i> - Whenever Felhide Spiritbinder becomes untapped, you may pay {1}{R}. If you do, put a token onto the battlefield that's a copy of another target creature except it's an enchantment in addition to its other types. It gains haste. Exile it at the beginning of the next end step.
|
// <i>Inspired</i> - Whenever Felhide Spiritbinder becomes untapped, you may pay {1}{R}. If you do, put a token onto the battlefield that's a copy of another target creature except it's an enchantment in addition to its other types. It gains haste. Exile it at the beginning of the next end step.
|
||||||
Ability ability = new InspiredAbility(new DoIfCostPaid(new FelhideSpiritbinderEffect(), new ManaCostsImpl("{1}{R}"),"Use effect of {source}?"));
|
Ability ability = new InspiredAbility(new DoIfCostPaid(new FelhideSpiritbinderEffect(), new ManaCostsImpl("{1}{R}"), "Use effect of {source}?"));
|
||||||
ability.addTarget(new TargetCreaturePermanent(filter));
|
ability.addTarget(new TargetCreaturePermanent(filter));
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
}
|
}
|
||||||
|
@ -108,15 +108,16 @@ class FelhideSpiritbinderEffect extends OneShotEffect {
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
PutTokenOntoBattlefieldCopyTargetEffect effect = new PutTokenOntoBattlefieldCopyTargetEffect(null, CardType.ENCHANTMENT, true);
|
PutTokenOntoBattlefieldCopyTargetEffect effect = new PutTokenOntoBattlefieldCopyTargetEffect(null, CardType.ENCHANTMENT, true);
|
||||||
effect.setTargetPointer(getTargetPointer());
|
effect.setTargetPointer(getTargetPointer());
|
||||||
if (effect.apply(game, source) && effect.getAddedPermanent() != null) {
|
if (effect.apply(game, source)) {
|
||||||
ExileTargetEffect exileEffect = new ExileTargetEffect();
|
for (Permanent tokenPermanent : effect.getAddedPermanent()) {
|
||||||
exileEffect.setTargetPointer(new FixedTarget(effect.getAddedPermanent().getId()));
|
ExileTargetEffect exileEffect = new ExileTargetEffect();
|
||||||
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
|
exileEffect.setTargetPointer(new FixedTarget(tokenPermanent, game));
|
||||||
delayedAbility.setSourceId(source.getSourceId());
|
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
|
||||||
delayedAbility.setControllerId(source.getControllerId());
|
delayedAbility.setSourceId(source.getSourceId());
|
||||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
delayedAbility.setControllerId(source.getControllerId());
|
||||||
game.addDelayedTriggeredAbility(delayedAbility);
|
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||||
|
game.addDelayedTriggeredAbility(delayedAbility);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,9 +35,10 @@ import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.costs.common.ExileSourceCost;
|
import mage.abilities.costs.common.ExileSourceCost;
|
||||||
import mage.abilities.costs.mana.GenericManaCost;
|
import mage.abilities.costs.mana.GenericManaCost;
|
||||||
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.CreateTokenEffect;
|
import mage.abilities.effects.common.CreateTokenEffect;
|
||||||
import mage.abilities.effects.common.ReturnToBattlefieldUnderYourControlSourceEffect;
|
import mage.abilities.effects.common.ReturnToBattlefieldUnderOwnerControlTargetEffect;
|
||||||
import mage.abilities.effects.common.continuous.BoostEquippedEffect;
|
import mage.abilities.effects.common.continuous.BoostEquippedEffect;
|
||||||
import mage.abilities.keyword.EquipAbility;
|
import mage.abilities.keyword.EquipAbility;
|
||||||
import mage.abilities.keyword.FlyingAbility;
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
|
@ -51,6 +52,7 @@ import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.events.GameEvent.EventType;
|
import mage.game.events.GameEvent.EventType;
|
||||||
import mage.game.events.ZoneChangeEvent;
|
import mage.game.events.ZoneChangeEvent;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
import mage.game.permanent.token.Token;
|
import mage.game.permanent.token.Token;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
|
@ -106,14 +108,21 @@ class TatsumaTheDragonsFangEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
CreateTokenEffect effect = new CreateTokenEffect(new TatsumaDragonToken());
|
CreateTokenEffect effect = new CreateTokenEffect(new TatsumaDragonToken());
|
||||||
effect.apply(game, source);
|
effect.apply(game, source);
|
||||||
FixedTarget fixedTarget = new FixedTarget(effect.getLastAddedTokenId());
|
for (UUID tokenId : effect.getLastAddedTokenIds()) { // by cards like Doubling Season multiple tokens can be added to the battlefield
|
||||||
DelayedTriggeredAbility delayedAbility = new TatsumaTheDragonsFangTriggeredAbility(fixedTarget);
|
Permanent tokenPermanent = game.getPermanent(tokenId);
|
||||||
delayedAbility.setSourceId(source.getSourceId());
|
if (tokenPermanent != null) {
|
||||||
delayedAbility.setControllerId(source.getControllerId());
|
FixedTarget fixedTarget = new FixedTarget(tokenPermanent, game);
|
||||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
Effect returnEffect = new ReturnToBattlefieldUnderOwnerControlTargetEffect();
|
||||||
game.addDelayedTriggeredAbility(delayedAbility);
|
returnEffect.setTargetPointer(new FixedTarget(source.getSourceId(), game.getState().getZoneChangeCounter(source.getSourceId())));
|
||||||
|
DelayedTriggeredAbility delayedAbility = new TatsumaTheDragonsFangTriggeredAbility(fixedTarget, returnEffect);
|
||||||
|
delayedAbility.setSourceId(source.getSourceId());
|
||||||
|
delayedAbility.setControllerId(source.getControllerId());
|
||||||
|
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||||
|
game.addDelayedTriggeredAbility(delayedAbility);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -123,8 +132,8 @@ class TatsumaTheDragonsFangTriggeredAbility extends DelayedTriggeredAbility {
|
||||||
|
|
||||||
protected FixedTarget fixedTarget;
|
protected FixedTarget fixedTarget;
|
||||||
|
|
||||||
public TatsumaTheDragonsFangTriggeredAbility(FixedTarget fixedTarget) {
|
public TatsumaTheDragonsFangTriggeredAbility(FixedTarget fixedTarget, Effect effect) {
|
||||||
super(new ReturnToBattlefieldUnderYourControlSourceEffect(), Duration.OneUse);
|
super(effect, Duration.OneUse);
|
||||||
this.fixedTarget = fixedTarget;
|
this.fixedTarget = fixedTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,11 +164,12 @@ class TatsumaTheDragonsFangTriggeredAbility extends DelayedTriggeredAbility {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRule() {
|
public String getRule() {
|
||||||
return "Return {this} to the battlefield under its owner's control when that token dies." ;
|
return "Return {this} to the battlefield under its owner's control when that token dies.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class TatsumaDragonToken extends Token {
|
class TatsumaDragonToken extends Token {
|
||||||
|
|
||||||
public TatsumaDragonToken() {
|
public TatsumaDragonToken() {
|
||||||
super("Dragon Spirit", "5/5 blue Dragon Spirit creature token with flying");
|
super("Dragon Spirit", "5/5 blue Dragon Spirit creature token with flying");
|
||||||
cardType.add(CardType.CREATURE);
|
cardType.add(CardType.CREATURE);
|
||||||
|
|
|
@ -43,6 +43,7 @@ import mage.constants.TargetController;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.filter.common.FilterCreatureCard;
|
import mage.filter.common.FilterCreatureCard;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
import mage.game.permanent.token.EmptyToken;
|
import mage.game.permanent.token.EmptyToken;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.common.TargetCardInYourGraveyard;
|
import mage.target.common.TargetCardInYourGraveyard;
|
||||||
|
@ -59,7 +60,6 @@ public class Seance extends CardImpl {
|
||||||
super(ownerId, 20, "Seance", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}{W}");
|
super(ownerId, 20, "Seance", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}{W}");
|
||||||
this.expansionSetCode = "DKA";
|
this.expansionSetCode = "DKA";
|
||||||
|
|
||||||
|
|
||||||
// At the beginning of each upkeep, you may exile target creature card from your graveyard. If you do, put a token onto the battlefield that's a copy of that card except it's a Spirit in addition to its other types. Exile it at the beginning of the next end step.
|
// At the beginning of each upkeep, you may exile target creature card from your graveyard. If you do, put a token onto the battlefield that's a copy of that card except it's a Spirit in addition to its other types. Exile it at the beginning of the next end step.
|
||||||
Ability ability = new BeginningOfUpkeepTriggeredAbility(new SeanceEffect(), TargetController.ANY, true);
|
Ability ability = new BeginningOfUpkeepTriggeredAbility(new SeanceEffect(), TargetController.ANY, true);
|
||||||
ability.addTarget(new TargetCardInYourGraveyard(new FilterCreatureCard()));
|
ability.addTarget(new TargetCardInYourGraveyard(new FilterCreatureCard()));
|
||||||
|
@ -105,14 +105,18 @@ class SeanceEffect extends OneShotEffect {
|
||||||
token.getSubtype().add("Spirit");
|
token.getSubtype().add("Spirit");
|
||||||
}
|
}
|
||||||
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
|
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
|
||||||
|
for (UUID tokenId : token.getLastAddedTokenIds()) { // by cards like Doubling Season multiple tokens can be added to the battlefield
|
||||||
ExileTargetEffect exileEffect = new ExileTargetEffect();
|
Permanent tokenPermanent = game.getPermanent(tokenId);
|
||||||
exileEffect.setTargetPointer(new FixedTarget(token.getLastAddedToken()));
|
if (tokenPermanent != null) {
|
||||||
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
|
ExileTargetEffect exileEffect = new ExileTargetEffect();
|
||||||
delayedAbility.setSourceId(source.getSourceId());
|
exileEffect.setTargetPointer(new FixedTarget(tokenPermanent, game));
|
||||||
delayedAbility.setControllerId(source.getControllerId());
|
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
|
||||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
delayedAbility.setSourceId(source.getSourceId());
|
||||||
game.addDelayedTriggeredAbility(delayedAbility);
|
delayedAbility.setControllerId(source.getControllerId());
|
||||||
|
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||||
|
game.addDelayedTriggeredAbility(delayedAbility);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -110,13 +110,18 @@ class MirrorMockeryEffect extends OneShotEffect {
|
||||||
|
|
||||||
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
|
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
|
||||||
|
|
||||||
ExileTargetEffect exileEffect = new ExileTargetEffect();
|
for (UUID tokenId : token.getLastAddedTokenIds()) { // by cards like Doubling Season multiple tokens can be added to the battlefield
|
||||||
exileEffect.setTargetPointer(new FixedTarget(token.getLastAddedToken()));
|
Permanent tokenPermanent = game.getPermanent(tokenId);
|
||||||
DelayedTriggeredAbility delayedAbility = new AtTheEndOfCombatDelayedTriggeredAbility(exileEffect);
|
if (tokenPermanent != null) {
|
||||||
delayedAbility.setSourceId(source.getSourceId());
|
ExileTargetEffect exileEffect = new ExileTargetEffect();
|
||||||
delayedAbility.setControllerId(source.getControllerId());
|
exileEffect.setTargetPointer(new FixedTarget(tokenPermanent, game));
|
||||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
DelayedTriggeredAbility delayedAbility = new AtTheEndOfCombatDelayedTriggeredAbility(exileEffect);
|
||||||
game.addDelayedTriggeredAbility(delayedAbility);
|
delayedAbility.setSourceId(source.getSourceId());
|
||||||
|
delayedAbility.setControllerId(source.getControllerId());
|
||||||
|
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||||
|
game.addDelayedTriggeredAbility(delayedAbility);
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -116,9 +116,14 @@ class FlamerushRiderEffect extends OneShotEffect {
|
||||||
EmptyToken token = new EmptyToken();
|
EmptyToken token = new EmptyToken();
|
||||||
CardUtil.copyTo(token).from(permanent);
|
CardUtil.copyTo(token).from(permanent);
|
||||||
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId(), true, true);
|
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId(), true, true);
|
||||||
Effect effect = new ExileTargetEffect();
|
for (UUID tokenId : token.getLastAddedTokenIds()) { // by cards like Doubling Season multiple tokens can be added to the battlefield
|
||||||
effect.setTargetPointer(new FixedTarget(token.getLastAddedToken()));
|
Permanent tokenPermanent = game.getPermanent(tokenId);
|
||||||
new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(effect), false).apply(game, source);
|
if (tokenPermanent != null) {
|
||||||
|
Effect effect = new ExileTargetEffect();
|
||||||
|
effect.setTargetPointer(new FixedTarget(tokenPermanent, game));
|
||||||
|
new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(effect), false).apply(game, source);
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -117,10 +117,7 @@ class HelmOfKaldraCondition implements Condition {
|
||||||
if (game.getBattlefield().count(HelmOfKaldra.filterShield, source.getSourceId(), source.getControllerId(), game) < 1) {
|
if (game.getBattlefield().count(HelmOfKaldra.filterShield, source.getSourceId(), source.getControllerId(), game) < 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (game.getBattlefield().count(HelmOfKaldra.filterShield, source.getSourceId(), source.getControllerId(), game) < 1) {
|
return game.getBattlefield().count(HelmOfKaldra.filterShield, source.getSourceId(), source.getControllerId(), game) >= 1;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -146,25 +143,27 @@ class HelmOfKaldraEffect extends OneShotEffect {
|
||||||
if (new HelmOfKaldraCondition().apply(game, source)) {
|
if (new HelmOfKaldraCondition().apply(game, source)) {
|
||||||
CreateTokenEffect effect = new CreateTokenEffect(new KaldraToken());
|
CreateTokenEffect effect = new CreateTokenEffect(new KaldraToken());
|
||||||
effect.apply(game, source);
|
effect.apply(game, source);
|
||||||
UUID kaldraId = effect.getLastAddedTokenId();
|
for (UUID tokenId : effect.getLastAddedTokenIds()) {
|
||||||
Permanent kaldra = game.getPermanent(kaldraId);
|
Permanent kaldra = game.getPermanent(tokenId);
|
||||||
if (kaldra != null) {
|
if (kaldra != null) {
|
||||||
// Attach helm to the token
|
// Attach helm to the token
|
||||||
for (Permanent kaldrasHelm : game.getBattlefield().getAllActivePermanents(HelmOfKaldra.filterHelm, source.getControllerId(), game)) {
|
for (Permanent kaldrasHelm : game.getBattlefield().getAllActivePermanents(HelmOfKaldra.filterHelm, source.getControllerId(), game)) {
|
||||||
kaldra.addAttachment(kaldrasHelm.getId(), game);
|
kaldra.addAttachment(kaldrasHelm.getId(), game);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Attach shield to the token
|
// Attach shield to the token
|
||||||
for (Permanent kaldrasShield : game.getBattlefield().getAllActivePermanents(HelmOfKaldra.filterShield, source.getControllerId(), game)) {
|
for (Permanent kaldrasShield : game.getBattlefield().getAllActivePermanents(HelmOfKaldra.filterShield, source.getControllerId(), game)) {
|
||||||
kaldra.addAttachment(kaldrasShield.getId(), game);
|
kaldra.addAttachment(kaldrasShield.getId(), game);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Attach sword to the token
|
// Attach sword to the token
|
||||||
for (Permanent kaldrasSword : game.getBattlefield().getAllActivePermanents(HelmOfKaldra.filterSword, source.getControllerId(), game)) {
|
for (Permanent kaldrasSword : game.getBattlefield().getAllActivePermanents(HelmOfKaldra.filterSword, source.getControllerId(), game)) {
|
||||||
kaldra.addAttachment(kaldrasSword.getId(), game);
|
kaldra.addAttachment(kaldrasSword.getId(), game);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class FlameshadowConjuring extends CardImpl {
|
||||||
|
|
||||||
// Whenever a nontoken creature enters the battlefield under your control, you may pay {R}. If you do, put a token onto the battlefield that's a copy of that creature. That token gains haste. Exile it at the beginning of the next end step.
|
// Whenever a nontoken creature enters the battlefield under your control, you may pay {R}. If you do, put a token onto the battlefield that's a copy of that creature. That token gains haste. Exile it at the beginning of the next end step.
|
||||||
Ability ability = new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, new FlameshadowConjuringEffect(), filterNontoken, false, SetTargetPointer.PERMANENT,
|
Ability ability = new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, new FlameshadowConjuringEffect(), filterNontoken, false, SetTargetPointer.PERMANENT,
|
||||||
"Whenever a nontoken creature enters the battlefield under your control, you may pay {R}. If you do, put a token onto the battlefield that's a copy of that creature. That token gains haste. Exile it at the beginning of the next end step");
|
"Whenever a nontoken creature enters the battlefield under your control, you may pay {R}. If you do, put a token onto the battlefield that's a copy of that creature. That token gains haste. Exile it at the beginning of the next end step");
|
||||||
ability.addCost(new ManaCostsImpl("{R}"));
|
ability.addCost(new ManaCostsImpl("{R}"));
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
}
|
}
|
||||||
|
@ -104,15 +104,16 @@ class FlameshadowConjuringEffect extends OneShotEffect {
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
PutTokenOntoBattlefieldCopyTargetEffect effect = new PutTokenOntoBattlefieldCopyTargetEffect(null, null, true);
|
PutTokenOntoBattlefieldCopyTargetEffect effect = new PutTokenOntoBattlefieldCopyTargetEffect(null, null, true);
|
||||||
effect.setTargetPointer(getTargetPointer());
|
effect.setTargetPointer(getTargetPointer());
|
||||||
if (effect.apply(game, source) && effect.getAddedPermanent() != null) {
|
if (effect.apply(game, source)) {
|
||||||
ExileTargetEffect exileEffect = new ExileTargetEffect();
|
for (Permanent tokenPermanent : effect.getAddedPermanent()) {
|
||||||
exileEffect.setTargetPointer(new FixedTarget(effect.getAddedPermanent().getId()));
|
ExileTargetEffect exileEffect = new ExileTargetEffect();
|
||||||
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
|
exileEffect.setTargetPointer(new FixedTarget(tokenPermanent, game));
|
||||||
delayedAbility.setSourceId(source.getSourceId());
|
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
|
||||||
delayedAbility.setControllerId(source.getControllerId());
|
delayedAbility.setSourceId(source.getSourceId());
|
||||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
delayedAbility.setControllerId(source.getControllerId());
|
||||||
game.addDelayedTriggeredAbility(delayedAbility);
|
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||||
|
game.addDelayedTriggeredAbility(delayedAbility);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ import mage.constants.Outcome;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
import mage.game.permanent.token.Token;
|
import mage.game.permanent.token.Token;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
@ -56,7 +57,6 @@ public class FeralLightning extends CardImpl {
|
||||||
super(ownerId, 97, "Feral Lightning", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{3}{R}{R}{R}");
|
super(ownerId, 97, "Feral Lightning", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{3}{R}{R}{R}");
|
||||||
this.expansionSetCode = "SOK";
|
this.expansionSetCode = "SOK";
|
||||||
|
|
||||||
|
|
||||||
// Put three 3/1 red Elemental creature tokens with haste onto the battlefield. Exile them at the beginning of the next end step.
|
// Put three 3/1 red Elemental creature tokens with haste onto the battlefield. Exile them at the beginning of the next end step.
|
||||||
this.getSpellAbility().addEffect(new FeralLightningEffect());
|
this.getSpellAbility().addEffect(new FeralLightningEffect());
|
||||||
|
|
||||||
|
@ -95,13 +95,16 @@ class FeralLightningEffect extends OneShotEffect {
|
||||||
CreateTokenEffect effect = new CreateTokenEffect(new FeralLightningElementalToken(), 3);
|
CreateTokenEffect effect = new CreateTokenEffect(new FeralLightningElementalToken(), 3);
|
||||||
effect.apply(game, source);
|
effect.apply(game, source);
|
||||||
for (UUID tokenId : effect.getLastAddedTokenIds()) {
|
for (UUID tokenId : effect.getLastAddedTokenIds()) {
|
||||||
ExileTargetEffect exileEffect = new ExileTargetEffect(null,"",Zone.BATTLEFIELD);
|
Permanent tokenPermanent = game.getPermanent(tokenId);
|
||||||
exileEffect.setTargetPointer(new FixedTarget(tokenId));
|
if (tokenPermanent != null) {
|
||||||
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
|
ExileTargetEffect exileEffect = new ExileTargetEffect(null, "", Zone.BATTLEFIELD);
|
||||||
delayedAbility.setSourceId(source.getSourceId());
|
exileEffect.setTargetPointer(new FixedTarget(tokenPermanent, game));
|
||||||
delayedAbility.setControllerId(source.getControllerId());
|
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
|
||||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
delayedAbility.setSourceId(source.getSourceId());
|
||||||
game.addDelayedTriggeredAbility(delayedAbility);
|
delayedAbility.setControllerId(source.getControllerId());
|
||||||
|
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||||
|
game.addDelayedTriggeredAbility(delayedAbility);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -210,13 +210,18 @@ class MimicVatCreateTokenEffect extends OneShotEffect {
|
||||||
token.addAbility(HasteAbility.getInstance());
|
token.addAbility(HasteAbility.getInstance());
|
||||||
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
|
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
|
||||||
|
|
||||||
ExileTargetEffect exileEffect = new ExileTargetEffect();
|
for (UUID tokenId : token.getLastAddedTokenIds()) { // by cards like Doubling Season multiple tokens can be added to the battlefield
|
||||||
exileEffect.setTargetPointer(new FixedTarget(token.getLastAddedToken()));
|
Permanent tokenPermanent = game.getPermanent(tokenId);
|
||||||
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
|
if (tokenPermanent != null) {
|
||||||
delayedAbility.setSourceId(source.getSourceId());
|
ExileTargetEffect exileEffect = new ExileTargetEffect();
|
||||||
delayedAbility.setControllerId(source.getControllerId());
|
exileEffect.setTargetPointer(new FixedTarget(tokenPermanent, game));
|
||||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
|
||||||
game.addDelayedTriggeredAbility(delayedAbility);
|
delayedAbility.setSourceId(source.getSourceId());
|
||||||
|
delayedAbility.setControllerId(source.getControllerId());
|
||||||
|
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||||
|
game.addDelayedTriggeredAbility(delayedAbility);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
*/
|
*/
|
||||||
package mage.abilities.effects.common;
|
package mage.abilities.effects.common;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -57,13 +59,13 @@ public class PutTokenOntoBattlefieldCopyTargetEffect extends OneShotEffect {
|
||||||
private final UUID playerId;
|
private final UUID playerId;
|
||||||
private final CardType additionalCardType;
|
private final CardType additionalCardType;
|
||||||
private boolean gainsHaste;
|
private boolean gainsHaste;
|
||||||
private Permanent addedTokenPermanent;
|
private List<Permanent> addedTokenPermanents;
|
||||||
|
|
||||||
public PutTokenOntoBattlefieldCopyTargetEffect() {
|
public PutTokenOntoBattlefieldCopyTargetEffect() {
|
||||||
super(Outcome.PutCreatureInPlay);
|
super(Outcome.PutCreatureInPlay);
|
||||||
this.playerId = null;
|
this.playerId = null;
|
||||||
this.additionalCardType = null;
|
this.additionalCardType = null;
|
||||||
this.addedTokenPermanent = null;
|
this.addedTokenPermanents = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public PutTokenOntoBattlefieldCopyTargetEffect(UUID playerId) {
|
public PutTokenOntoBattlefieldCopyTargetEffect(UUID playerId) {
|
||||||
|
@ -75,7 +77,7 @@ public class PutTokenOntoBattlefieldCopyTargetEffect extends OneShotEffect {
|
||||||
this.playerId = playerId;
|
this.playerId = playerId;
|
||||||
this.additionalCardType = additionalCardType;
|
this.additionalCardType = additionalCardType;
|
||||||
this.gainsHaste = gainsHaste;
|
this.gainsHaste = gainsHaste;
|
||||||
this.addedTokenPermanent = null;
|
this.addedTokenPermanents = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public PutTokenOntoBattlefieldCopyTargetEffect(final PutTokenOntoBattlefieldCopyTargetEffect effect) {
|
public PutTokenOntoBattlefieldCopyTargetEffect(final PutTokenOntoBattlefieldCopyTargetEffect effect) {
|
||||||
|
@ -83,7 +85,7 @@ public class PutTokenOntoBattlefieldCopyTargetEffect extends OneShotEffect {
|
||||||
this.playerId = effect.playerId;
|
this.playerId = effect.playerId;
|
||||||
this.additionalCardType = effect.additionalCardType;
|
this.additionalCardType = effect.additionalCardType;
|
||||||
this.gainsHaste = effect.gainsHaste;
|
this.gainsHaste = effect.gainsHaste;
|
||||||
this.addedTokenPermanent = effect.addedTokenPermanent;
|
this.addedTokenPermanents.addAll(effect.addedTokenPermanents);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -118,21 +120,24 @@ public class PutTokenOntoBattlefieldCopyTargetEffect extends OneShotEffect {
|
||||||
token.addAbility(HasteAbility.getInstance());
|
token.addAbility(HasteAbility.getInstance());
|
||||||
}
|
}
|
||||||
token.putOntoBattlefield(1, game, source.getSourceId(), playerId == null ? source.getControllerId() : playerId);
|
token.putOntoBattlefield(1, game, source.getSourceId(), playerId == null ? source.getControllerId() : playerId);
|
||||||
addedTokenPermanent = game.getPermanent(token.getLastAddedToken());
|
for (UUID tokenId : token.getLastAddedTokenIds()) { // by cards like Doubling Season multiple tokens can be added to the battlefield
|
||||||
if (addedTokenPermanent != null) {
|
Permanent tokenPermanent = game.getPermanent(tokenId);
|
||||||
game.copyPermanent(copyFromPermanent, addedTokenPermanent, source, applier);
|
if (tokenPermanent != null) {
|
||||||
if (additionalCardType != null) {
|
addedTokenPermanents.add(tokenPermanent);
|
||||||
ContinuousEffect effect = new AddCardTypeTargetEffect(additionalCardType, Duration.Custom);
|
game.copyPermanent(copyFromPermanent, tokenPermanent, source, applier);
|
||||||
effect.setTargetPointer(new FixedTarget(addedTokenPermanent.getId()));
|
if (additionalCardType != null) {
|
||||||
game.addEffect(effect, source);
|
ContinuousEffect effect = new AddCardTypeTargetEffect(additionalCardType, Duration.Custom);
|
||||||
|
effect.setTargetPointer(new FixedTarget(tokenPermanent, game));
|
||||||
|
game.addEffect(effect, source);
|
||||||
|
}
|
||||||
|
if (gainsHaste) {
|
||||||
|
ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom);
|
||||||
|
effect.setTargetPointer(new FixedTarget(tokenPermanent, game));
|
||||||
|
game.addEffect(effect, source);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (gainsHaste) {
|
|
||||||
ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom);
|
|
||||||
effect.setTargetPointer(new FixedTarget(addedTokenPermanent.getId()));
|
|
||||||
game.addEffect(effect, source);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -153,7 +158,7 @@ public class PutTokenOntoBattlefieldCopyTargetEffect extends OneShotEffect {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Permanent getAddedPermanent() {
|
public List<Permanent> getAddedPermanent() {
|
||||||
return addedTokenPermanent;
|
return addedTokenPermanents;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue