forked from External/mage
Refactor: added copyFrom info for all objects (original card used for copy, copy of copy and etc);
This commit is contained in:
parent
28ac95cb10
commit
59bda7f1d5
25 changed files with 269 additions and 220 deletions
|
|
@ -1,10 +1,5 @@
|
|||
|
||||
package mage.game.stack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.Mana;
|
||||
|
|
@ -39,8 +34,12 @@ import mage.players.Player;
|
|||
import mage.util.GameLog;
|
||||
import mage.util.SubTypeList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class Spell extends StackObjImpl implements Card {
|
||||
|
|
@ -63,7 +62,8 @@ public class Spell extends StackObjImpl implements Card {
|
|||
private final UUID id;
|
||||
|
||||
private UUID controllerId;
|
||||
private boolean copiedSpell;
|
||||
private boolean copy;
|
||||
private MageObject copyFrom; // copied card INFO (used to call original adjusters)
|
||||
private boolean faceDown;
|
||||
private boolean countered;
|
||||
private boolean resolving = false;
|
||||
|
|
@ -118,7 +118,8 @@ public class Spell extends StackObjImpl implements Card {
|
|||
this.frameStyle = spell.frameStyle;
|
||||
|
||||
this.controllerId = spell.controllerId;
|
||||
this.copiedSpell = spell.copiedSpell;
|
||||
this.copy = spell.copy;
|
||||
this.copyFrom = (spell.copyFrom != null ? spell.copyFrom.copy() : null);
|
||||
this.faceDown = spell.faceDown;
|
||||
this.countered = spell.countered;
|
||||
this.resolving = spell.resolving;
|
||||
|
|
@ -155,7 +156,7 @@ public class Spell extends StackObjImpl implements Card {
|
|||
|
||||
public String getActivatedMessage(Game game) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (isCopiedSpell()) {
|
||||
if (isCopy()) {
|
||||
sb.append(" copies ");
|
||||
} else {
|
||||
sb.append(" casts ");
|
||||
|
|
@ -362,7 +363,7 @@ public class Spell extends StackObjImpl implements Card {
|
|||
@Override
|
||||
public void counter(UUID sourceId, Game game, Zone zone, boolean owner, ZoneDetail zoneDetail) {
|
||||
this.countered = true;
|
||||
if (!isCopiedSpell()) {
|
||||
if (!isCopy()) {
|
||||
Player player = game.getPlayer(game.getControllerId(sourceId));
|
||||
if (player == null) {
|
||||
player = game.getPlayer(getControllerId());
|
||||
|
|
@ -706,7 +707,7 @@ public class Spell extends StackObjImpl implements Card {
|
|||
newAbility.newId();
|
||||
copy.addSpellAbility(newAbility);
|
||||
}
|
||||
copy.setCopy(true);
|
||||
copy.setCopy(true, this);
|
||||
copy.setControllerId(newController);
|
||||
return copy;
|
||||
}
|
||||
|
|
@ -740,7 +741,7 @@ public class Spell extends StackObjImpl implements Card {
|
|||
// 706.10a If a copy of a spell is in a zone other than the stack, it ceases to exist.
|
||||
// If a copy of a card is in any zone other than the stack or the battlefield, it ceases to exist.
|
||||
// These are state-based actions. See rule 704.
|
||||
if (this.isCopiedSpell() && zone != Zone.STACK) {
|
||||
if (this.isCopy() && zone != Zone.STACK) {
|
||||
return true;
|
||||
}
|
||||
return card.moveToZone(zone, sourceId, game, flag, appliedEffects);
|
||||
|
|
@ -753,7 +754,7 @@ public class Spell extends StackObjImpl implements Card {
|
|||
|
||||
@Override
|
||||
public boolean moveToExile(UUID exileId, String name, UUID sourceId, Game game, List<UUID> appliedEffects) {
|
||||
if (this.isCopiedSpell()) {
|
||||
if (this.isCopy()) {
|
||||
game.getStack().remove(this, game);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -835,26 +836,24 @@ public class Spell extends StackObjImpl implements Card {
|
|||
// do nothing
|
||||
}
|
||||
|
||||
public void setCopiedSpell(boolean isCopied) {
|
||||
this.copiedSpell = isCopied;
|
||||
}
|
||||
|
||||
public boolean isCopiedSpell() {
|
||||
return this.copiedSpell;
|
||||
}
|
||||
|
||||
public Zone getFromZone() {
|
||||
return this.fromZone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCopy(boolean isCopy) {
|
||||
setCopiedSpell(isCopy);
|
||||
public void setCopy(boolean isCopy, MageObject copyFrom) {
|
||||
this.copy = isCopy;
|
||||
this.copyFrom = (copyFrom != null ? copyFrom.copy() : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCopy() {
|
||||
return isCopiedSpell();
|
||||
return this.copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MageObject getCopyFrom() {
|
||||
return this.copyFrom;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue