From bf59d850a85faff6ff60681e2dd7a602af582bf4 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Wed, 16 Jan 2013 14:14:34 +0100 Subject: [PATCH] Fixed a bug that the copy of a Token could no more be copied because the baseValues for P/T were 0 for this copy. E.g. populate on an already populated token failed because of this bug. --- Mage/src/mage/MageInt.java | 5 +++++ Mage/src/mage/util/functions/CopyTokenFunction.java | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Mage/src/mage/MageInt.java b/Mage/src/mage/MageInt.java index 52e706ce256..3345b24ddbe 100644 --- a/Mage/src/mage/MageInt.java +++ b/Mage/src/mage/MageInt.java @@ -72,6 +72,11 @@ public class MageInt implements Serializable, Copyable { return baseValue; } + public void initValue(int value) { + this.baseValue = value; + this.cardValue = Integer.toString(value); + } + public void setValue(int value) { this.baseValue = value; } diff --git a/Mage/src/mage/util/functions/CopyTokenFunction.java b/Mage/src/mage/util/functions/CopyTokenFunction.java index 65af057b5dc..37b29b62dd7 100644 --- a/Mage/src/mage/util/functions/CopyTokenFunction.java +++ b/Mage/src/mage/util/functions/CopyTokenFunction.java @@ -75,9 +75,9 @@ public class CopyTokenFunction implements Function { ability.setSourceId(target.getId()); target.addAbility(ability); } - // Needed to do it this way because else the increased value from cards like "Intangible Virtue" will be copied. - target.getPower().setValue(Integer.parseInt(source.getPower().toString())); - target.getToughness().setValue(Integer.parseInt(source.getToughness().toString())); + // Needed to do it this way because only the cardValue does not include the increased value from cards like "Intangible Virtue" will be copied. + target.getPower().initValue(Integer.parseInt(source.getPower().toString())); + target.getToughness().initValue(Integer.parseInt(source.getToughness().toString())); return target; }