rolled back Permanent optimizations - were causing RMI exceptions

This commit is contained in:
BetaSteward 2011-03-15 13:52:56 -04:00
parent 86d2086b70
commit 66a5027e94
2 changed files with 21 additions and 35 deletions

View file

@ -83,32 +83,20 @@ public class PermanentCard extends PermanentImpl<PermanentCard> {
public void reset(Game game) {
// when the permanent is reset copy all original values from the card
// must copy card each reset so that the original values don't get modified
// Card copy = game.getCard(objectId).copy();
copyFromCard(game.getCard(objectId));
Card copy = game.getCard(objectId).copy();
copyFromCard(copy);
super.reset(game);
}
protected void copyFromCard(Card card) {
this.name = card.getName();
this.manaCost = card.getManaCost().copy();
this.color = card.getColor().copy();
this.power = card.getPower().copy();
this.toughness = card.getToughness().copy();
this.loyalty = card.getLoyalty().copy();
this.abilities = card.getAbilities().copy();
this.abilities.setControllerId(controllerId);
this.cardType.clear();
for (CardType cType: card.getCardType()) {
this.cardType.add(cType);
}
this.subtype.clear();
for (String subType: card.getSubtype()) {
this.subtype.add(subType);
}
this.supertype.clear();
for (String superType: card.getSupertype()) {
this.supertype.add(superType);
}
this.abilities = card.getAbilities();
this.abilities.setControllerId(this.controllerId);
this.cardType = card.getCardType();
this.color = card.getColor();
this.manaCost = card.getManaCost();
this.power = card.getPower();
this.toughness = card.getToughness();
if (card instanceof LevelerCard) {
LevelAbility level = ((LevelerCard)card).getLevel(this.getCounters().getCount("Level"));
if (level != null) {
@ -119,6 +107,8 @@ public class PermanentCard extends PermanentImpl<PermanentCard> {
}
}
}
this.subtype = card.getSubtype();
this.supertype = card.getSupertype();
this.art = card.getArt();
this.expansionSetCode = card.getExpansionSetCode();
this.rarity = card.getRarity();

View file

@ -30,7 +30,6 @@ package mage.game.permanent;
import mage.game.permanent.token.Token;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.game.Game;
@ -57,25 +56,22 @@ public class PermanentToken extends PermanentImpl<PermanentToken> {
@Override
public void reset(Game game) {
// Token copy = token.copy();
copyFromToken(token);
Token copy = token.copy();
copyFromToken(copy);
super.reset(game);
}
protected void copyFromToken(Token token) {
this.name = token.getName();
this.abilities = token.getAbilities().copy();
this.cardType.clear();
for (CardType cType: token.getCardType()) {
this.cardType.add(cType);
this.abilities.clear();
for (Ability ability: token.getAbilities()) {
this.addAbility(ability);
}
this.subtype.clear();
for (String subType: token.getSubtype()) {
this.subtype.add(subType);
}
this.color = token.getColor().copy();
this.power = token.getPower().copy();
this.toughness = token.getToughness().copy();
this.cardType = token.getCardType();
this.color = token.getColor();
this.power = token.getPower();
this.toughness = token.getToughness();
this.subtype = token.getSubtype();
}
@Override