mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
- 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:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user