From 66a5027e942ab8f266f5b34db83537437daa1a42 Mon Sep 17 00:00:00 2001 From: BetaSteward Date: Tue, 15 Mar 2011 13:52:56 -0400 Subject: [PATCH] rolled back Permanent optimizations - were causing RMI exceptions --- .../mage/game/permanent/PermanentCard.java | 32 +++++++------------ .../mage/game/permanent/PermanentToken.java | 24 ++++++-------- 2 files changed, 21 insertions(+), 35 deletions(-) diff --git a/Mage/src/mage/game/permanent/PermanentCard.java b/Mage/src/mage/game/permanent/PermanentCard.java index b3e54f45b88..bfd47a74b21 100644 --- a/Mage/src/mage/game/permanent/PermanentCard.java +++ b/Mage/src/mage/game/permanent/PermanentCard.java @@ -83,32 +83,20 @@ public class PermanentCard extends PermanentImpl { 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 { } } } + this.subtype = card.getSubtype(); + this.supertype = card.getSupertype(); this.art = card.getArt(); this.expansionSetCode = card.getExpansionSetCode(); this.rarity = card.getRarity(); diff --git a/Mage/src/mage/game/permanent/PermanentToken.java b/Mage/src/mage/game/permanent/PermanentToken.java index a4c31648eba..c73099b531a 100644 --- a/Mage/src/mage/game/permanent/PermanentToken.java +++ b/Mage/src/mage/game/permanent/PermanentToken.java @@ -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 { @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