other fixes

This commit is contained in:
BetaSteward 2012-02-04 17:05:48 -05:00
parent 90c7079bfa
commit bf9e25fc34
6 changed files with 56 additions and 12 deletions

View file

@ -87,10 +87,10 @@ 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
copyFromCard(card);
copyFromCard(card, game);
super.reset(game);
}
protected void copyFromCard(Card card) {
this.name = card.getName();
this.abilities.clear();
@ -130,6 +130,45 @@ public class PermanentCard extends PermanentImpl<PermanentCard> {
}
}
protected void copyFromCard(Card card, Game game) {
this.name = card.getName();
this.abilities.clear();
this.abilities.addAll(card.getAbilities());
this.abilities.setControllerId(this.controllerId);
this.cardType.clear();
this.cardType.addAll(card.getCardType());
this.color = card.getColor().copy();
this.manaCost = card.getManaCost().copy();
this.power = card.getPower().copy();
this.toughness = card.getToughness().copy();
if (card instanceof LevelerCard) {
LevelAbility level = ((LevelerCard) card).getLevel(this.getCounters().getCount(CounterType.LEVEL));
if (level != null) {
this.power.setValue(level.getPower());
this.toughness.setValue(level.getToughness());
for (Ability ability : level.getAbilities()) {
this.addAbility(ability, game);
}
}
}
if (card instanceof PermanentCard) {
this.maxLevelCounters = ((PermanentCard) card).maxLevelCounters;
}
this.subtype.clear();
this.subtype.addAll(card.getSubtype());
this.supertype.clear();
this.supertype.addAll(card.getSupertype());
this.expansionSetCode = card.getExpansionSetCode();
this.rarity = card.getRarity();
this.cardNumber = card.getCardNumber();
canTransform = card.canTransform();
if (canTransform) {
secondSideCard = card.getSecondCardFace();
nightCard = card.isNightCard();
}
}
// public void checkPermanentOnlyTriggers(ZoneChangeEvent event, Game game) {
// // we only want to trigger abilities that are not on the underlying card ie. have been added by another effect
// // or we want to trigger abilities that only trigger on leaving the battlefield