forked from External/mage
Refactor implementation of spell copies for cards like Twinning Staff as well as refactor handling of target changing (WIP) (#7662)
* refactored createCopyOnStack to be void * added new interface for modifying copied spellsspells * update implementation of Fork to use new applier * reworked epic effect * add applier to spell copy code * updated implementation of Beamsplitter Mage * updated cards which copy for each possible target * added support for additional copies having targets changed * fixed/ignored failing tests * updated target changing to prevent unnecessary choosing * added test for Twinning Staff * updated implementation of spell copy applier * added new method for choosing order of copies on stack * fixed test failures * [TSR] various text fixes * fixed a test failure * [SLD] fixed Rick, Steadfast Leader only counting Human creatures * updated test framework to handle skips without affecting starting player choice * fixed another test failure * updated copy messaging for consistency * added copy messaging to stack abilities
This commit is contained in:
parent
b51915f6e8
commit
9c56a98dc9
47 changed files with 972 additions and 1092 deletions
|
|
@ -1,6 +1,9 @@
|
|||
package mage.game.stack;
|
||||
|
||||
import mage.*;
|
||||
import mage.MageIdentifier;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.*;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostAdjuster;
|
||||
|
|
@ -27,8 +30,10 @@ import mage.players.Player;
|
|||
import mage.target.Target;
|
||||
import mage.target.Targets;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
import mage.util.CardUtil;
|
||||
import mage.util.GameLog;
|
||||
import mage.util.SubTypes;
|
||||
import mage.util.functions.SpellCopyApplier;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -593,15 +598,20 @@ public class StackAbility extends StackObjImpl implements Ability {
|
|||
}
|
||||
|
||||
@Override
|
||||
public StackObject createCopyOnStack(Game game, Ability source, UUID newControllerId, boolean chooseNewTargets) {
|
||||
return createCopyOnStack(game, source, newControllerId, chooseNewTargets, 1);
|
||||
public void createCopyOnStack(Game game, Ability source, UUID newControllerId, boolean chooseNewTargets) {
|
||||
createCopyOnStack(game, source, newControllerId, chooseNewTargets, 1);
|
||||
}
|
||||
|
||||
public StackObject createCopyOnStack(Game game, Ability source, UUID newControllerId, boolean chooseNewTargets, int amount) {
|
||||
@Override
|
||||
public void createCopyOnStack(Game game, Ability source, UUID newControllerId, boolean chooseNewTargets, int amount) {
|
||||
createCopyOnStack(game, source, newControllerId, chooseNewTargets, amount, null);
|
||||
}
|
||||
|
||||
public void createCopyOnStack(Game game, Ability source, UUID newControllerId, boolean chooseNewTargets, int amount, SpellCopyApplier applier) {
|
||||
StackAbility newStackAbility = null;
|
||||
GameEvent gameEvent = new CopyStackObjectEvent(source, this, newControllerId, amount);
|
||||
if (game.replaceEvent(gameEvent)) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < gameEvent.getAmount(); i++) {
|
||||
Ability newAbility = this.copy();
|
||||
|
|
@ -618,7 +628,13 @@ public class StackAbility extends StackObjImpl implements Ability {
|
|||
}
|
||||
game.fireEvent(new CopiedStackObjectEvent(this, newStackAbility, newControllerId));
|
||||
}
|
||||
return newStackAbility;
|
||||
Player player = game.getPlayer(newControllerId);
|
||||
if (player != null) {
|
||||
game.informPlayers(
|
||||
player.getName() + " created " + CardUtil.numberToText(gameEvent.getAmount(), "a")
|
||||
+ " cop" + (gameEvent.getAmount() == 1 ? "y" : "ies") + " of " + getIdName()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue