mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 19:41:59 -08:00
* Fixed a bug of spell copy that caused that added spliced spells were not copied.
This commit is contained in:
parent
1835671f3d
commit
6726f48669
25 changed files with 198 additions and 199 deletions
|
|
@ -64,9 +64,6 @@ public class ClovenCasting extends CardImpl {
|
|||
super(ownerId, 86, "Cloven Casting", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{5}{U}{R}");
|
||||
this.expansionSetCode = "ARB";
|
||||
|
||||
|
||||
|
||||
|
||||
// Whenever you cast a multicolored instant or sorcery spell, you may pay {1}. If you do, copy that spell. You may choose new targets for the copy.
|
||||
this.addAbility(new SpellCastControllerTriggeredAbility(new DoIfCostPaid(new ClovenCastingEffect(), new GenericManaCost(1)), filter, true, true));
|
||||
|
||||
|
|
@ -97,9 +94,7 @@ class ClovenCastingEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
|
||||
if (spell != null) {
|
||||
Spell copy = spell.copySpell();
|
||||
copy.setControllerId(source.getControllerId());
|
||||
copy.setCopiedSpell(true);
|
||||
Spell copy = spell.copySpell(source.getControllerId());
|
||||
game.getStack().push(copy);
|
||||
copy.chooseNewTargets(game, source.getControllerId());
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
|
|
|
|||
|
|
@ -44,11 +44,11 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
|
|||
*/
|
||||
public class KorCastigator extends CardImpl {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Eldrazi Scions");
|
||||
private static final FilterCreaturePermanent FILTER = new FilterCreaturePermanent("Eldrazi Scions");
|
||||
|
||||
static {
|
||||
filter.add(new SubtypePredicate("Eldrazi"));
|
||||
filter.add(new SubtypePredicate("Scion"));
|
||||
FILTER.add(new SubtypePredicate("Eldrazi"));
|
||||
FILTER.add(new SubtypePredicate("Scion"));
|
||||
}
|
||||
|
||||
public KorCastigator(UUID ownerId) {
|
||||
|
|
@ -61,7 +61,7 @@ public class KorCastigator extends CardImpl {
|
|||
this.toughness = new MageInt(1);
|
||||
|
||||
// Kor Castigator can't be blocked by Eldrazi Scions.
|
||||
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
|
||||
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(FILTER, Duration.WhileOnBattlefield)));
|
||||
}
|
||||
|
||||
public KorCastigator(final KorCastigator card) {
|
||||
|
|
|
|||
|
|
@ -103,8 +103,10 @@ class ZadaHedronGrinderTriggeredAbility extends TriggeredAbilityImpl {
|
|||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
if (isControlledInstantOrSorcery(spell)) {
|
||||
boolean targetsSource = false;
|
||||
for (Mode mode : spell.getSpellAbility().getModes().getSelectedModes()) {
|
||||
for (Ability ability : spell.getSpellAbilities()) {
|
||||
for (Mode mode : ability.getModes().getSelectedModes()) {
|
||||
for (Target target : mode.getTargets()) {
|
||||
if (!target.isNotTarget()) {
|
||||
for (UUID targetId : target.getTargets()) {
|
||||
if (targetId.equals(getSourceId())) {
|
||||
targetsSource = true;
|
||||
|
|
@ -114,6 +116,8 @@ class ZadaHedronGrinderTriggeredAbility extends TriggeredAbilityImpl {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (targetsSource) {
|
||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(spell.getId()));
|
||||
return true;
|
||||
|
|
@ -159,23 +163,26 @@ class ZadaHedronGrinderEffect extends OneShotEffect {
|
|||
}
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (spell != null && controller != null) {
|
||||
// search the target that targets source
|
||||
Target usedTarget = null;
|
||||
setUsedTarget:
|
||||
for (Mode mode : spell.getSpellAbility().getModes().getSelectedModes()) {
|
||||
for (Ability ability : spell.getSpellAbilities()) {
|
||||
for (Mode mode : ability.getModes().getSelectedModes()) {
|
||||
for (Target target : mode.getTargets()) {
|
||||
if (target.getFirstTarget().equals(source.getSourceId())) {
|
||||
if (!target.isNotTarget() && target.getFirstTarget().equals(source.getSourceId())) {
|
||||
usedTarget = target.copy();
|
||||
usedTarget.clearChosen();
|
||||
break setUsedTarget;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (usedTarget == null) {
|
||||
return false;
|
||||
}
|
||||
for (Permanent creature : game.getState().getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game)) {
|
||||
if (!creature.getId().equals(source.getSourceId()) && usedTarget.canTarget(source.getControllerId(), creature.getId(), source, game)) {
|
||||
Spell copy = spell.copySpell();
|
||||
Spell copy = spell.copySpell(source.getControllerId());
|
||||
setTarget:
|
||||
for (Mode mode : spell.getSpellAbility().getModes().getSelectedModes()) {
|
||||
for (Target target : mode.getTargets()) {
|
||||
|
|
@ -188,8 +195,6 @@ class ZadaHedronGrinderEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
}
|
||||
copy.setControllerId(source.getControllerId());
|
||||
copy.setCopiedSpell(true);
|
||||
game.getStack().push(copy);
|
||||
String activateMessage = copy.getActivatedMessage(game);
|
||||
if (activateMessage.startsWith(" casts ")) {
|
||||
|
|
|
|||
|
|
@ -116,9 +116,7 @@ class RikuOfTwoReflectionsCopyEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
|
||||
if (spell != null) {
|
||||
Spell copy = spell.copySpell();
|
||||
copy.setControllerId(source.getControllerId());
|
||||
copy.setCopiedSpell(true);
|
||||
Spell copy = spell.copySpell(source.getControllerId());;
|
||||
game.getStack().push(copy);
|
||||
copy.chooseNewTargets(game, source.getControllerId());
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@ public class WildRicochet extends CardImpl {
|
|||
super(ownerId, 139, "Wild Ricochet", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{2}{R}{R}");
|
||||
this.expansionSetCode = "CMD";
|
||||
|
||||
|
||||
// You may choose new targets for target instant or sorcery spell. Then copy that spell. You may choose new targets for the copy.
|
||||
this.getSpellAbility().addEffect(new WildRicochetEffect());
|
||||
this.getSpellAbility().addTarget(new TargetStackObject(filter));
|
||||
|
|
@ -96,9 +95,7 @@ class WildRicochetEffect extends OneShotEffect {
|
|||
spell.chooseNewTargets(game, you.getId());
|
||||
}
|
||||
if (spell != null) {
|
||||
Spell copy = spell.copySpell();
|
||||
copy.setControllerId(source.getControllerId());
|
||||
copy.setCopiedSpell(true);
|
||||
Spell copy = spell.copySpell(source.getControllerId());;
|
||||
game.getStack().push(copy);
|
||||
if (you != null && you.chooseUse(Outcome.Benefit, "Do you wish to choose new targets for the copied " + spell.getName() + "?", source, game)) {
|
||||
return copy.chooseNewTargets(game, you.getId());
|
||||
|
|
|
|||
|
|
@ -30,18 +30,14 @@ package mage.sets.commander2014;
|
|||
import java.util.UUID;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.DelayedTriggeredAbility;
|
||||
import mage.abilities.common.delayed.AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility;
|
||||
import mage.abilities.condition.LockedInCondition;
|
||||
import mage.abilities.condition.common.MorbidCondition;
|
||||
import mage.abilities.decorator.ConditionalTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CastSourceTriggeredAbility;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
|
|
@ -49,7 +45,6 @@ import mage.filter.predicate.Predicates;
|
|||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.game.stack.StackObject;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
|
|
@ -69,7 +64,6 @@ public class MaliciousAffliction extends CardImpl {
|
|||
super(ownerId, 25, "Malicious Affliction", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{B}{B}");
|
||||
this.expansionSetCode = "C14";
|
||||
|
||||
|
||||
// Morbid - When you cast Malicious Affliction, if a creature died this turn, you may copy Malicious Affliction and may choose a new target for the copy.
|
||||
Ability ability = new ConditionalTriggeredAbility(
|
||||
new CastSourceTriggeredAbility(new CopySourceSpellEffect(), true),
|
||||
|
|
@ -112,9 +106,7 @@ class CopySourceSpellEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
Spell spell = game.getStack().getSpell(source.getSourceId());
|
||||
if (spell != null) {
|
||||
Spell spellCopy = spell.copySpell();
|
||||
spellCopy.setCopiedSpell(true);
|
||||
spellCopy.setControllerId(source.getControllerId());
|
||||
Spell spellCopy = spell.copySpell(source.getControllerId());;
|
||||
game.getStack().push(spellCopy);
|
||||
spellCopy.chooseNewTargets(game, controller.getId());
|
||||
String activateMessage = spellCopy.getActivatedMessage(game);
|
||||
|
|
|
|||
|
|
@ -28,9 +28,6 @@
|
|||
package mage.sets.darkascension;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
|
|
@ -38,7 +35,9 @@ import mage.abilities.effects.OneShotEffect;
|
|||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.predicate.Predicates;
|
||||
|
|
@ -63,7 +62,6 @@ public class CurseOfEchoes extends CardImpl {
|
|||
this.subtype.add("Aura");
|
||||
this.subtype.add("Curse");
|
||||
|
||||
|
||||
// Enchant player
|
||||
TargetPlayer auraTarget = new TargetPlayer();
|
||||
this.getSpellAbility().addTarget(auraTarget);
|
||||
|
|
@ -153,9 +151,7 @@ class CurseOfEchoesEffect extends OneShotEffect {
|
|||
if (!playerId.equals(spell.getControllerId())) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player.chooseUse(Outcome.Copy, chooseMessage, source, game)) {
|
||||
Spell copy = spell.copySpell();
|
||||
copy.setControllerId(playerId);
|
||||
copy.setCopiedSpell(true);
|
||||
Spell copy = spell.copySpell(source.getControllerId());;
|
||||
game.getStack().push(copy);
|
||||
copy.chooseNewTargets(game, playerId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,13 +28,12 @@
|
|||
package mage.sets.darkascension;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.*;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.keyword.FlashbackAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
|
|
@ -64,7 +63,6 @@ public class IncreasingVengeance extends CardImpl {
|
|||
super(ownerId, 95, "Increasing Vengeance", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{R}{R}");
|
||||
this.expansionSetCode = "DKA";
|
||||
|
||||
|
||||
// Copy target instant or sorcery spell you control. If Increasing Vengeance was cast from a graveyard, copy that spell twice instead. You may choose new targets for the copies.
|
||||
this.getSpellAbility().addEffect(new IncreasingVengeanceEffect());
|
||||
Target target = new TargetSpell(filter);
|
||||
|
|
@ -101,18 +99,14 @@ class IncreasingVengeanceEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
|
||||
if (spell != null) {
|
||||
Spell copy = spell.copySpell();
|
||||
copy.setControllerId(source.getControllerId());
|
||||
copy.setCopiedSpell(true);
|
||||
Spell copy = spell.copySpell(source.getControllerId());
|
||||
game.getStack().push(copy);
|
||||
copy.chooseNewTargets(game, source.getControllerId());
|
||||
game.informPlayers(new StringBuilder(controller.getLogName()).append(copy.getActivatedMessage(game)).toString());
|
||||
Spell sourceSpell = (Spell) game.getStack().getStackObject(source.getSourceId());
|
||||
if (sourceSpell != null) {
|
||||
if (sourceSpell.getFromZone() == Zone.GRAVEYARD) {
|
||||
copy = spell.copySpell();
|
||||
copy.setControllerId(source.getControllerId());
|
||||
copy.setCopiedSpell(true);
|
||||
copy = spell.copySpell(source.getControllerId());
|
||||
game.getStack().push(copy);
|
||||
copy.chooseNewTargets(game, source.getControllerId());
|
||||
game.informPlayers(new StringBuilder(controller.getLogName()).append(copy.getActivatedMessage(game)).toString());
|
||||
|
|
|
|||
|
|
@ -52,11 +52,12 @@ import mage.target.TargetSpell;
|
|||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
|
||||
*
|
||||
*/
|
||||
public class MirrorSheen extends CardImpl {
|
||||
|
||||
private static final FilterSpell filter = new FilterSpell();
|
||||
|
||||
static {
|
||||
filter.add(Predicates.or(new CardTypePredicate(CardType.INSTANT), new CardTypePredicate(CardType.SORCERY)));
|
||||
filter.add(new TargetYouPredicate());
|
||||
|
|
@ -66,7 +67,6 @@ public class MirrorSheen extends CardImpl {
|
|||
super(ownerId, 105, "Mirror Sheen", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{1}{U/R}{U/R}");
|
||||
this.expansionSetCode = "EVE";
|
||||
|
||||
|
||||
// {1}{UR}{UR}: Copy target instant or sorcery spell that targets you. You may choose new targets for the copy.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new MirrorSheenEffect(), new ManaCostsImpl("{1}{U/R}{U/R}"));
|
||||
ability.addTarget(new TargetSpell(filter));
|
||||
|
|
@ -99,9 +99,7 @@ class MirrorSheenEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Spell spell = game.getStack().getSpell(source.getFirstTarget());
|
||||
if (spell != null) {
|
||||
Spell copy = spell.copySpell();
|
||||
copy.setControllerId(source.getControllerId());
|
||||
copy.setCopiedSpell(true);
|
||||
Spell copy = spell.copySpell(source.getControllerId());
|
||||
game.getStack().push(copy);
|
||||
copy.chooseNewTargets(game, source.getControllerId());
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ public class ChainLightning extends CardImpl {
|
|||
super(ownerId, 137, "Chain Lightning", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{R}");
|
||||
this.expansionSetCode = "LEG";
|
||||
|
||||
|
||||
// Chain Lightning deals 3 damage to target creature or player. Then that player or that creature's controller may pay {R}{R}. If the player does, he or she may copy this spell and may choose a new target for that copy.
|
||||
this.getSpellAbility().addEffect(new ChainLightningEffect());
|
||||
this.getSpellAbility().addTarget(new TargetCreatureOrPlayer());
|
||||
|
|
@ -94,8 +93,7 @@ class ChainLightningEffect extends OneShotEffect {
|
|||
if (player != null) {
|
||||
player.damage(3, source.getSourceId(), game, false, true);
|
||||
affectedPlayer = player;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
if (permanent != null) {
|
||||
permanent.damage(3, source.getSourceId(), game, false, true);
|
||||
|
|
@ -108,9 +106,7 @@ class ChainLightningEffect extends OneShotEffect {
|
|||
if (cost.pay(source, game, source.getSourceId(), affectedPlayer.getId(), false, null)) {
|
||||
Spell spell = game.getStack().getSpell(source.getSourceId());
|
||||
if (spell != null) {
|
||||
Spell copy = spell.copySpell();
|
||||
copy.setControllerId(affectedPlayer.getId());
|
||||
copy.setCopiedSpell(true);
|
||||
Spell copy = spell.copySpell(affectedPlayer.getId());
|
||||
game.getStack().push(copy);
|
||||
copy.chooseNewTargets(game, affectedPlayer.getId());
|
||||
game.informPlayers(affectedPlayer.getLogName() + " copies " + copy.getName() + ".");
|
||||
|
|
|
|||
|
|
@ -92,10 +92,8 @@ class ForkEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
|
||||
if (spell != null) {
|
||||
Spell copy = spell.copySpell();
|
||||
Spell copy = spell.copySpell(source.getControllerId());
|
||||
copy.getColor(game).setRed(true);
|
||||
copy.setControllerId(controller.getId());
|
||||
copy.setCopiedSpell(true);
|
||||
game.getStack().push(copy);
|
||||
copy.chooseNewTargets(game, controller.getId());
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -135,9 +135,7 @@ class HiveMindEffect extends OneShotEffect {
|
|||
if (spell != null && player != null) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(player.getId(), game)) {
|
||||
if (!playerId.equals(spell.getControllerId())) {
|
||||
Spell copy = spell.copySpell();
|
||||
copy.setControllerId(playerId);
|
||||
copy.setCopiedSpell(true);
|
||||
Spell copy = spell.copySpell(playerId);
|
||||
game.getStack().push(copy);
|
||||
copy.chooseNewTargets(game, playerId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,9 +111,7 @@ class PsychicRebuttalEffect extends OneShotEffect {
|
|||
if (SpellMasteryCondition.getInstance().apply(game, source)
|
||||
&& controller.chooseUse(Outcome.PlayForFree, "Copy " + stackObject.getName() + " (you may choose new targets for the copy)?", source, game)) {
|
||||
|
||||
Spell copy = ((Spell) stackObject).copySpell();
|
||||
copy.setControllerId(source.getControllerId());
|
||||
copy.setCopiedSpell(true);
|
||||
Spell copy = ((Spell) stackObject).copySpell(source.getControllerId());
|
||||
game.getStack().push(copy);
|
||||
copy.chooseNewTargets(game, source.getControllerId());
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ class ChainOfVaporEffect extends OneShotEffect {
|
|||
}
|
||||
Permanent permanent = game.getPermanent(source.getFirstTarget());
|
||||
if (permanent != null) {
|
||||
controller.moveCards(permanent, null, Zone.HAND, source, game);
|
||||
controller.moveCards(permanent, Zone.HAND, source, game);
|
||||
Player player = game.getPlayer(permanent.getControllerId());
|
||||
TargetControlledPermanent target = new TargetControlledPermanent(0, 1, new FilterControlledLandPermanent("a land to sacrifice (to be able to copy " + sourceObject.getName() + ")"), true);
|
||||
if (player.chooseTarget(Outcome.Sacrifice, target, source, game)) {
|
||||
|
|
@ -103,9 +103,7 @@ class ChainOfVaporEffect extends OneShotEffect {
|
|||
if (player.chooseUse(outcome, "Copy the spell?", source, game)) {
|
||||
Spell spell = game.getStack().getSpell(source.getSourceId());
|
||||
if (spell != null) {
|
||||
Spell copy = spell.copySpell();
|
||||
copy.setControllerId(player.getId());
|
||||
copy.setCopiedSpell(true);
|
||||
Spell copy = spell.copySpell(player.getId());
|
||||
game.getStack().push(copy);
|
||||
copy.chooseNewTargets(game, player.getId());
|
||||
String activateMessage = copy.getActivatedMessage(game);
|
||||
|
|
|
|||
|
|
@ -28,10 +28,6 @@
|
|||
package mage.sets.riseoftheeldrazi;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Abilities;
|
||||
import mage.abilities.AbilitiesImpl;
|
||||
|
|
@ -43,8 +39,11 @@ import mage.abilities.effects.OneShotEffect;
|
|||
import mage.abilities.effects.common.CopyTargetSpellEffect;
|
||||
import mage.abilities.keyword.LevelUpAbility;
|
||||
import mage.abilities.keyword.LevelerCardBuilder;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.LevelerCard;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
|
|
@ -132,9 +131,7 @@ class EchoMageEffect extends OneShotEffect {
|
|||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
|
||||
if (spell != null) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
Spell copy = spell.copySpell();
|
||||
copy.setControllerId(source.getControllerId());
|
||||
copy.setCopiedSpell(true);
|
||||
Spell copy = spell.copySpell(source.getControllerId());
|
||||
game.getStack().push(copy);
|
||||
copy.chooseNewTargets(game, source.getControllerId());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ import mage.target.TargetSpell;
|
|||
public class MeletisCharlatan extends CardImpl {
|
||||
|
||||
private static final FilterSpell filter = new FilterSpell("instant or sorcery spell");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.or(
|
||||
new CardTypePredicate(CardType.INSTANT),
|
||||
|
|
@ -103,9 +104,7 @@ class MeletisCharlatanCopyTargetSpellEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
|
||||
if (spell != null) {
|
||||
Spell copy = spell.copySpell();
|
||||
copy.setControllerId(spell.getControllerId());
|
||||
copy.setCopiedSpell(true);
|
||||
Spell copy = spell.copySpell(source.getControllerId());
|
||||
game.getStack().push(copy);
|
||||
copy.chooseNewTargets(game, spell.getControllerId());
|
||||
Player player = game.getPlayer(spell.getControllerId());
|
||||
|
|
|
|||
|
|
@ -119,4 +119,58 @@ public class CopySpellTest extends CardTestPlayerBase {
|
|||
assertPermanentCount(playerA, "Pillarfield Ox", 0);
|
||||
assertHandCount(playerA, 4); // 2 draw + 2 creatures returned to hand
|
||||
}
|
||||
|
||||
/**
|
||||
* Not to be a bother, but I posted earlier about how Zada, Hedron Grinder
|
||||
* 's interaction with splice is broken. I didn't get a response on whether
|
||||
* or not the problem was being looked at. Zada SHOULD copy spliced effects
|
||||
* (and currently doesn't) because spliced effects are put onto the spell
|
||||
* before it is cast and therefore before Zada's ability triggers, e.g.
|
||||
* Desperate Ritual spliced onto Into the Fray should generate 3 red mana
|
||||
* for every creature i control.
|
||||
*
|
||||
* 702.46a Splice is a static ability that functions while a card is in your
|
||||
* hand. “Splice onto [subtype] [cost]” means “You may reveal this card from
|
||||
* your hand as you cast a [subtype] spell. If you do, copy this card’s text
|
||||
* box onto that spell and pay [cost] as an additional cost to cast that
|
||||
* spell.” Paying a card’s splice cost follows the rules for paying
|
||||
* additional costs in rules 601.2b and 601.2e–g. 601.2b If the spell is
|
||||
* modal the player announces the mode choice (see rule 700.2). If the
|
||||
* player wishes to splice any cards onto the spell (see rule 702.46), he or
|
||||
* she reveals those cards in his or her hand. 706.10. To copy a spell,
|
||||
* activated ability, or triggered ability means to put a copy of it onto
|
||||
* the stack; a copy of a spell isn’t cast and a copy of an activated
|
||||
* ability isn’t activated. A copy of a spell or ability copies both the
|
||||
* characteristics of the spell or ability and all decisions made for it,
|
||||
* including modes, targets, the value of X, and additional or alternative
|
||||
* costs. (See rule 601, “Casting Spells.”)
|
||||
*/
|
||||
@Test
|
||||
public void ZadaHedronGrinderAndSplicedSpell() {
|
||||
// Draw a card.
|
||||
// Splice onto Arcane {1}{U}
|
||||
addCard(Zone.HAND, playerA, "Evermind", 1); // no costs
|
||||
// Target creature attacks this turn if able.
|
||||
// Splice onto Arcane {R}
|
||||
addCard(Zone.HAND, playerA, "Into the Fray", 1); // Instant - Arcane - {U}
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
|
||||
|
||||
// Whenever you cast an instant or sorcery spell that targets only Zada, Hedron Grinder,
|
||||
// copy that spell for each other creature you control that the spell could target.
|
||||
// Each copy targets a different one of those creatures.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Zada, Hedron Grinder", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Pillarfield Ox", 1);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Into the Fray", "Zada, Hedron Grinder");
|
||||
setChoice(playerA, "Yes");
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerA, "Into the Fray", 1);
|
||||
assertHandCount(playerA, "Evermind", 1);
|
||||
assertHandCount(playerA, 3); // Evermind + 1 card from Evermind spliced on cast Into the fray and 1 from the copied spell with splice
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -54,6 +53,7 @@ import mage.util.TargetAddress;
|
|||
|
||||
/**
|
||||
* @author duncant
|
||||
* @param <T>
|
||||
*/
|
||||
public abstract class CopySpellForEachItCouldTargetEffect<T extends MageItem> extends OneShotEffect {
|
||||
|
||||
|
|
@ -71,7 +71,9 @@ public abstract class CopySpellForEachItCouldTargetEffect<T extends MageItem> ex
|
|||
}
|
||||
|
||||
protected abstract Spell getSpell(Game game, Ability source);
|
||||
|
||||
protected abstract boolean changeTarget(Target target, Game game, Ability source);
|
||||
|
||||
protected abstract void modifyCopy(Spell copy, Game game, Ability source);
|
||||
|
||||
protected void modifyCopy(Spell copy, T newTarget, Game game, Ability source) {
|
||||
|
|
@ -103,8 +105,7 @@ public abstract class CopySpellForEachItCouldTargetEffect<T extends MageItem> ex
|
|||
}
|
||||
|
||||
// collect objects that can be targeted
|
||||
Spell copy = spell.copySpell();
|
||||
copy.setCopiedSpell(true);
|
||||
Spell copy = spell.copySpell(source.getControllerId());
|
||||
modifyCopy(copy, game, source);
|
||||
Target sampleTarget = targetsToBeChanged.iterator().next().getTarget(copy);
|
||||
sampleTarget.setNotTarget(true);
|
||||
|
|
@ -116,9 +117,7 @@ public abstract class CopySpellForEachItCouldTargetEffect<T extends MageItem> ex
|
|||
obj = game.getPlayer(objId);
|
||||
}
|
||||
if (obj != null) {
|
||||
copy = spell.copySpell();
|
||||
copy.setCopiedSpell(true);
|
||||
|
||||
copy = spell.copySpell(source.getControllerId());
|
||||
try {
|
||||
modifyCopy(copy, (T) obj, game, source);
|
||||
if (!filter.match((T) obj, game)) {
|
||||
|
|
@ -205,8 +204,6 @@ public abstract class CopySpellForEachItCouldTargetEffect<T extends MageItem> ex
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
class CompoundFilter<T extends MageItem> extends FilterImpl<T> implements FilterInPlay<T> {
|
||||
|
||||
protected final FilterInPlay<T> filterA;
|
||||
|
|
@ -248,7 +245,6 @@ class CompoundFilter<T extends MageItem> extends FilterImpl<T> implements Filter
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
class TargetWithAdditionalFilter<T extends MageItem> extends TargetImpl {
|
||||
|
||||
protected final FilterInPlay<T> additionalFilter;
|
||||
|
|
@ -315,7 +311,6 @@ class TargetWithAdditionalFilter<T extends MageItem> extends TargetImpl {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canTarget(UUID id, Ability source, Game game) {
|
||||
MageItem obj = game.getObject(id);
|
||||
|
|
@ -332,7 +327,6 @@ class TargetWithAdditionalFilter<T extends MageItem> extends TargetImpl {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
|
||||
MageItem obj = game.getObject(id);
|
||||
|
|
@ -349,13 +343,11 @@ class TargetWithAdditionalFilter<T extends MageItem> extends TargetImpl {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public FilterInPlay<T> getFilter() {
|
||||
return new CompoundFilter((FilterInPlay<T>) originalTarget.getFilter(), additionalFilter, originalTarget.getFilter().getMessage());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||
int remainingTargets = getNumberOfTargets() - targets.size();
|
||||
|
|
@ -378,12 +370,12 @@ class TargetWithAdditionalFilter<T extends MageItem> extends TargetImpl {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
} catch (ClassCastException e) {}
|
||||
} catch (ClassCastException e) {
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canChoose(UUID sourceControllerId, Game game) {
|
||||
int remainingTargets = getNumberOfTargets() - targets.size();
|
||||
|
|
@ -406,12 +398,12 @@ class TargetWithAdditionalFilter<T extends MageItem> extends TargetImpl {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
} catch (ClassCastException e) {}
|
||||
} catch (ClassCastException e) {
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||
Set<UUID> ret = new HashSet<>();
|
||||
|
|
@ -425,12 +417,12 @@ class TargetWithAdditionalFilter<T extends MageItem> extends TargetImpl {
|
|||
&& additionalFilter.match((T) obj, sourceId, sourceControllerId, game)) {
|
||||
ret.add(id);
|
||||
}
|
||||
} catch (ClassCastException e) {}
|
||||
} catch (ClassCastException e) {
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Set<UUID> possibleTargets(UUID sourceControllerId, Game game) {
|
||||
Set<UUID> ret = new HashSet<>();
|
||||
|
|
@ -444,12 +436,12 @@ class TargetWithAdditionalFilter<T extends MageItem> extends TargetImpl {
|
|||
&& additionalFilter.match((T) obj, game)) {
|
||||
ret.add(id);
|
||||
}
|
||||
} catch (ClassCastException e) {}
|
||||
} catch (ClassCastException e) {
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TargetWithAdditionalFilter copy() {
|
||||
return new TargetWithAdditionalFilter(this);
|
||||
|
|
|
|||
|
|
@ -57,9 +57,7 @@ public class CopyTargetSpellEffect extends OneShotEffect {
|
|||
spell = (Spell) game.getLastKnownInformation(targetPointer.getFirst(game, source), Zone.STACK);
|
||||
}
|
||||
if (spell != null) {
|
||||
Spell copy = spell.copySpell();
|
||||
copy.setControllerId(source.getControllerId());
|
||||
copy.setCopiedSpell(true);
|
||||
Spell copy = spell.copySpell(source.getControllerId());;
|
||||
game.getStack().push(copy);
|
||||
copy.chooseNewTargets(game, source.getControllerId());
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
|
|
|
|||
|
|
@ -51,9 +51,7 @@ public class EpicEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
StackObject stackObject = game.getStack().getStackObject(source.getId());
|
||||
Spell spell = (Spell) stackObject;
|
||||
spell = spell.copySpell();
|
||||
spell.setCopiedSpell(true);
|
||||
spell.setControllerId(source.getControllerId());
|
||||
spell = spell.copySpell(source.getControllerId());
|
||||
// Remove Epic effect from the spell
|
||||
Effect epicEffect = null;
|
||||
for (Effect effect : spell.getSpellAbility().getEffects()) {
|
||||
|
|
|
|||
|
|
@ -292,9 +292,7 @@ class ConspireEffect extends OneShotEffect {
|
|||
if (controller != null && conspiredSpell != null) {
|
||||
Card card = game.getCard(conspiredSpell.getSourceId());
|
||||
if (card != null) {
|
||||
Spell copy = conspiredSpell.copySpell();
|
||||
copy.setControllerId(source.getControllerId());
|
||||
copy.setCopiedSpell(true);
|
||||
Spell copy = conspiredSpell.copySpell(source.getControllerId());
|
||||
game.getStack().push(copy);
|
||||
copy.chooseNewTargets(game, source.getControllerId());
|
||||
if (!game.isSimulation()) {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.abilities.keyword;
|
||||
|
||||
import mage.MageObjectReference;
|
||||
|
|
@ -42,8 +41,6 @@ import mage.game.stack.Spell;
|
|||
import mage.game.stack.StackObject;
|
||||
import mage.watchers.common.GravestormWatcher;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author emerald000
|
||||
|
|
@ -57,6 +54,7 @@ public class GravestormAbility extends TriggeredAbilityImpl {
|
|||
private GravestormAbility(final GravestormAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GravestormAbility copy() {
|
||||
return new GravestormAbility(this);
|
||||
|
|
@ -111,9 +109,7 @@ class GravestormEffect extends OneShotEffect {
|
|||
game.informPlayers("Gravestorm: " + spell.getName() + " will be copied " + gravestormCount + " time" + (gravestormCount > 1 ? "s" : ""));
|
||||
}
|
||||
for (int i = 0; i < gravestormCount; i++) {
|
||||
Spell copy = spell.copySpell();
|
||||
copy.setControllerId(source.getControllerId());
|
||||
copy.setCopiedSpell(true);
|
||||
Spell copy = spell.copySpell(source.getControllerId());
|
||||
game.getStack().push(copy);
|
||||
copy.chooseNewTargets(game, source.getControllerId());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -247,9 +247,7 @@ class ReplicateCopyEffect extends OneShotEffect {
|
|||
}
|
||||
// create the copies
|
||||
for (int i = 0; i < replicateCount; i++) {
|
||||
Spell copy = spell.copySpell();
|
||||
copy.setControllerId(source.getControllerId());
|
||||
copy.setCopiedSpell(true);
|
||||
Spell copy = spell.copySpell(source.getControllerId());
|
||||
game.getStack().push(copy);
|
||||
copy.chooseNewTargets(game, source.getControllerId());
|
||||
if (!game.isSimulation()) {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.abilities.keyword;
|
||||
|
||||
import mage.MageObjectReference;
|
||||
|
|
@ -42,8 +41,6 @@ import mage.game.stack.Spell;
|
|||
import mage.game.stack.StackObject;
|
||||
import mage.watchers.common.CastSpellLastTurnWatcher;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Plopman
|
||||
|
|
@ -57,6 +54,7 @@ public class StormAbility extends TriggeredAbilityImpl {
|
|||
private StormAbility(final StormAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StormAbility copy() {
|
||||
return new StormAbility(this);
|
||||
|
|
@ -111,9 +109,7 @@ class StormEffect extends OneShotEffect {
|
|||
game.informPlayers("Storm: " + spell.getLogName() + " will be copied " + stormCount + " time" + (stormCount > 1 ? "s" : ""));
|
||||
}
|
||||
for (int i = 0; i < stormCount; i++) {
|
||||
Spell copy = spell.copySpell();
|
||||
copy.setControllerId(source.getControllerId());
|
||||
copy.setCopiedSpell(true);
|
||||
Spell copy = spell.copySpell(source.getControllerId());
|
||||
game.getStack().push(copy);
|
||||
copy.chooseNewTargets(game, source.getControllerId());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,12 +139,10 @@ public class Spell extends StackObjImpl implements Card {
|
|||
payNoMana |= spellAbility.getSpellAbilityType().equals(SpellAbilityType.SPLICE);
|
||||
if (ignoreAbility) {
|
||||
ignoreAbility = false;
|
||||
} else {
|
||||
if (!spellAbility.activate(game, payNoMana)) {
|
||||
} else if (!spellAbility.activate(game, payNoMana)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -630,9 +628,21 @@ public class Spell extends StackObjImpl implements Card {
|
|||
return new Spell(this);
|
||||
}
|
||||
|
||||
public Spell copySpell() {
|
||||
// replaced card.copy by copy (card content should no longer be changed)
|
||||
return new Spell(this.card, this.ability.copySpell(), this.controllerId, this.fromZone);
|
||||
public Spell copySpell(UUID newController) {
|
||||
Spell copy = new Spell(this.card, this.ability.copySpell(), this.controllerId, this.fromZone);
|
||||
boolean firstDone = false;
|
||||
for (SpellAbility spellAbility : this.getSpellAbilities()) {
|
||||
if (!firstDone) {
|
||||
firstDone = true;
|
||||
continue;
|
||||
}
|
||||
SpellAbility newAbility = spellAbility.copy(); // e.g. spliced spell
|
||||
newAbility.newId();
|
||||
copy.addSpellAbility(newAbility);
|
||||
}
|
||||
copy.setCopy(true);
|
||||
copy.setControllerId(newController);
|
||||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue