* Fixed a problem with token P/T reset (fixes the problem with Tree of Perdition and Soul Separator).

This commit is contained in:
LevelX2 2016-09-08 17:15:40 +02:00
parent 0af7871804
commit 21baa14404
4 changed files with 10 additions and 9 deletions

View file

@ -85,7 +85,7 @@ class SoulSeparatorEffect extends OneShotEffect {
public SoulSeparatorEffect() { public SoulSeparatorEffect() {
super(Outcome.PutCreatureInPlay); super(Outcome.PutCreatureInPlay);
this.staticText = "Put a black Zombie creature token onto the battlefield with power equal to that card's power and toughness equal that card's toughness."; this.staticText = "Put a black Zombie creature token onto the battlefield with power equal to that card's power and toughness equal that card's toughness";
} }
public SoulSeparatorEffect(final SoulSeparatorEffect effect) { public SoulSeparatorEffect(final SoulSeparatorEffect effect) {

View file

@ -193,10 +193,10 @@ public class PutTokenOntoBattlefieldCopyTargetEffect extends OneShotEffect {
token.addAbility(FlyingAbility.getInstance()); token.addAbility(FlyingAbility.getInstance());
} }
if (tokenPower != Integer.MIN_VALUE) { if (tokenPower != Integer.MIN_VALUE) {
token.setPower(tokenPower); token.getPower().modifyBaseValue(tokenPower);
} }
if (tokenToughness != Integer.MIN_VALUE) { if (tokenToughness != Integer.MIN_VALUE) {
token.setToughness(tokenToughness); token.getToughness().modifyBaseValue(tokenToughness);
} }
if (additionalSubType != null && !token.getSubtype(game).contains(additionalSubType)) { if (additionalSubType != null && !token.getSubtype(game).contains(additionalSubType)) {
token.getSubtype(game).add(additionalSubType); token.getSubtype(game).add(additionalSubType);

View file

@ -49,6 +49,8 @@ public class PermanentToken extends PermanentImpl {
this.token = token.copy(); this.token = token.copy();
this.token.getAbilities().newId(); // neccessary if token has ability like DevourAbility() this.token.getAbilities().newId(); // neccessary if token has ability like DevourAbility()
this.token.getAbilities().setSourceId(objectId); this.token.getAbilities().setSourceId(objectId);
this.power.modifyBaseValue(token.getPower().getBaseValueModified());
this.toughness.modifyBaseValue(token.getToughness().getBaseValueModified());
this.copyFromToken(this.token, game, false); // needed to have at this time (e.g. for subtypes for entersTheBattlefield replacement effects) this.copyFromToken(this.token, game, false); // needed to have at this time (e.g. for subtypes for entersTheBattlefield replacement effects)
} }
@ -62,6 +64,9 @@ public class PermanentToken extends PermanentImpl {
public void reset(Game game) { public void reset(Game game) {
copyFromToken(token, game, true); copyFromToken(token, game, true);
super.reset(game); super.reset(game);
// Because the P/T objects have there own base value for reset we have to take it from there instead of from the basic token object
this.power.resetToBaseValue();
this.toughness.resetToBaseValue();
} }
private void copyFromToken(Token token, Game game, boolean reset) { private void copyFromToken(Token token, Game game, boolean reset) {
@ -84,8 +89,6 @@ public class PermanentToken extends PermanentImpl {
this.color = token.getColor(game).copy(); this.color = token.getColor(game).copy();
this.frameColor = token.getFrameColor(game); this.frameColor = token.getFrameColor(game);
this.frameStyle = token.getFrameStyle(); this.frameStyle = token.getFrameStyle();
this.power.modifyBaseValue(token.getPower().getBaseValueModified());
this.toughness.modifyBaseValue(token.getToughness().getBaseValueModified());
this.supertype = token.getSupertype(); this.supertype = token.getSupertype();
this.subtype = token.getSubtype(game); this.subtype = token.getSubtype(game);
this.tokenDescriptor = token.getTokenDescriptor(); this.tokenDescriptor = token.getTokenDescriptor();

View file

@ -38,7 +38,6 @@ import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Random;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import mage.cards.Card; import mage.cards.Card;
@ -53,7 +52,6 @@ import mage.util.RandomUtil;
*/ */
public class Library implements Serializable { public class Library implements Serializable {
private boolean emptyDraw; private boolean emptyDraw;
private final Deque<UUID> library = new ArrayDeque<>(); private final Deque<UUID> library = new ArrayDeque<>();
private final UUID playerId; private final UUID playerId;