Added framework method for copying a StackAbility without casting it.

Modified the effects doing so with the new method.
This commit is contained in:
emerald000 2016-04-17 23:55:11 -04:00
parent b9ab16d945
commit 8823839a42
34 changed files with 158 additions and 313 deletions

View file

@ -34,6 +34,7 @@ import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.game.stack.StackObject;
import mage.players.Player;
/**
@ -57,16 +58,16 @@ public class CopyTargetSpellEffect extends OneShotEffect {
spell = (Spell) game.getLastKnownInformation(targetPointer.getFirst(game, source), Zone.STACK);
}
if (spell != null) {
Spell copy = spell.copySpell(source.getControllerId());;
game.getStack().push(copy);
copy.chooseNewTargets(game, source.getControllerId());
StackObject newStackObject = spell.createCopyOnStack(game, source, source.getControllerId(), true);
Player player = game.getPlayer(source.getControllerId());
String activateMessage = copy.getActivatedMessage(game);
if (activateMessage.startsWith(" casts ")) {
activateMessage = activateMessage.substring(6);
}
if (!game.isSimulation()) {
game.informPlayers(player.getLogName() + activateMessage);
if (player != null && newStackObject != null && newStackObject instanceof Spell) {
String activateMessage = ((Spell) newStackObject).getActivatedMessage(game);
if (activateMessage.startsWith(" casts ")) {
activateMessage = activateMessage.substring(6);
}
if (!game.isSimulation()) {
game.informPlayers(player.getLogName() + activateMessage);
}
}
return true;
}