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,7 @@
|
|||
|
||||
package mage.game.command;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Abilities;
|
||||
import mage.abilities.AbilitiesImpl;
|
||||
|
|
@ -24,9 +21,15 @@ import mage.game.events.ZoneChangeEvent;
|
|||
import mage.util.GameLog;
|
||||
import mage.util.SubTypeList;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Commander implements CommandObject {
|
||||
|
||||
private final Card sourceObject;
|
||||
private boolean copy;
|
||||
private MageObject copyFrom; // copied card INFO (used to call original adjusters)
|
||||
private final Abilities<Ability> abilities = new AbilitiesImpl<>();
|
||||
|
||||
public Commander(Card card) {
|
||||
|
|
@ -40,8 +43,10 @@ public class Commander implements CommandObject {
|
|||
}
|
||||
}
|
||||
|
||||
private Commander(Commander copy) {
|
||||
this.sourceObject = copy.sourceObject;
|
||||
private Commander(final Commander commander) {
|
||||
this.sourceObject = commander.sourceObject;
|
||||
this.copy = commander.copy;
|
||||
this.copyFrom = (commander.copyFrom != null ? commander.copyFrom.copy() : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -68,6 +73,22 @@ public class Commander implements CommandObject {
|
|||
return new Commander(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCopy(boolean isCopy, MageObject copyFrom) {
|
||||
this.copy = isCopy;
|
||||
this.copyFrom = (copyFrom != null ? copyFrom.copy() : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCopy() {
|
||||
return this.copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MageObject getCopyFrom() {
|
||||
return this.copyFrom;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return sourceObject.getName();
|
||||
|
|
@ -170,15 +191,6 @@ public class Commander implements CommandObject {
|
|||
public void adjustTargets(Ability ability, Game game) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCopy(boolean isCopy) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCopy() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getId() {
|
||||
return sourceObject.getId();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue