- Added some basic handling for tokens to the copyCard function (looks like it's used in places where this is necessary).

This commit is contained in:
Sloth
2013-08-21 08:23:28 +00:00
parent 9fe331d11a
commit 5bcea269de
2 changed files with 23 additions and 8 deletions

View File

@@ -153,9 +153,6 @@ public class CopyPermanentEffect extends SpellAbilityEffect {
copy = CardFactory.getCard(CardDb.getCard(c), sa.getActivatingPlayer());
// when copying something stolen:
copy.setController(controller, 0);
copy.setToken(true);
copy.setCopiedToken(true);
} else { // isToken()
@@ -164,8 +161,6 @@ public class CopyPermanentEffect extends SpellAbilityEffect {
copy.setName(c.getName());
copy.setImageKey(c.getImageKey());
copy.setController(controller, 0);
copy.setManaCost(c.getManaCost());
copy.setColor(c.getColor());
copy.setToken(true);
@@ -181,6 +176,9 @@ public class CopyPermanentEffect extends SpellAbilityEffect {
}
}
// when copying something stolen:
copy.setController(controller, 0);
// add keywords from sa
for (final String kw : keywords) {
copy.addIntrinsicKeyword(kw);

View File

@@ -87,9 +87,26 @@ public class CardFactory {
alternate = true;
in.setState(CardCharacteristicName.Original);
}
final Card out = assignNewId
? getCard(CardDb.getCard(in), in.getOwner())
: getCard(CardDb.getCard(in), in.getOwner(), in.getUniqueNumber());
Card out = null;
if (!in.isToken() || in.isCopiedToken()) {
out = assignNewId ? getCard(CardDb.getCard(in), in.getOwner()) : getCard(CardDb.getCard(in), in.getOwner(), in.getUniqueNumber());
} else { // token
out = assignNewId ? new Card(in.getGame().nextCardId()) : new Card(in.getUniqueNumber());
out = CardFactory.copyStats(in, in.getController());
out.setName(in.getName());
out.setImageKey(in.getImageKey());
out.setManaCost(in.getManaCost());
out.setColor(in.getColor());
out.setType(in.getType());
out.setBaseAttack(in.getBaseAttack());
out.setBaseDefense(in.getBaseDefense());
CardFactoryUtil.addAbilityFactoryAbilities(out);
for (String s : out.getStaticAbilityStrings()) {
out.addStaticAbility(s);
}
}
CardFactory.copyCharacteristics(in, out);