* Fixed Identity Thief copying creature with +1/+1 counter gets P/T boost from it, but not counter (fixes #2131).

This commit is contained in:
LevelX2 2016-08-05 21:15:07 +02:00
parent d1c25b0662
commit d0db2d51ed
33 changed files with 407 additions and 385 deletions

View file

@ -61,6 +61,8 @@ public class PermanentCard extends PermanentImpl {
}
private void init(Card card, Game game) {
power = card.getPower().copy();
toughness = card.getToughness().copy();
copyFromCard(card);
// if temporary added abilities to the spell/card exist, you need to add it to the permanent derived from that card
Abilities<Ability> otherAbilities = game.getState().getAllOtherAbilities(card.getId());
@ -94,6 +96,8 @@ public class PermanentCard extends PermanentImpl {
// 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);
power.resetToBaseValue();
toughness.resetToBaseValue();
super.reset(game);
}
@ -115,8 +119,6 @@ public class PermanentCard extends PermanentImpl {
this.cardType.addAll(card.getCardType());
this.color = card.getColor(null).copy();
this.manaCost = card.getManaCost().copy();
this.power = card.getPower().copy();
this.toughness = card.getToughness().copy();
if (card instanceof PermanentCard) {
this.maxLevelCounters = ((PermanentCard) card).maxLevelCounters;
}
@ -232,6 +234,8 @@ public class PermanentCard extends PermanentImpl {
@Override
public boolean turnFaceUp(Game game, UUID playerId) {
if (super.turnFaceUp(game, playerId)) {
power.modifyBaseValue(power.getBaseValue());
toughness.modifyBaseValue(toughness.getBaseValue());
setManifested(false);
setMorphed(false);
return true;
@ -241,7 +245,7 @@ public class PermanentCard extends PermanentImpl {
@Override
public void adjustTargets(Ability ability, Game game) {
if (this.isTransformed()) {
if (this.isTransformed() && card.getSecondCardFace() != null) {
card.getSecondCardFace().adjustTargets(ability, game);
} else {
card.adjustTargets(ability, game);
@ -250,7 +254,7 @@ public class PermanentCard extends PermanentImpl {
@Override
public void adjustCosts(Ability ability, Game game) {
if (this.isTransformed()) {
if (this.isTransformed() && card.getSecondCardFace() != null) {
card.getSecondCardFace().adjustCosts(ability, game);
} else {
card.adjustCosts(ability, game);

View file

@ -82,8 +82,8 @@ public class PermanentToken extends PermanentImpl {
}
this.cardType = token.getCardType();
this.color = token.getColor(game).copy();
this.power.initValue(token.getPower().getValue());
this.toughness.initValue(token.getToughness().getValue());
this.power.modifyBaseValue(token.getPower().getBaseValueModified());
this.toughness.modifyBaseValue(token.getToughness().getBaseValueModified());
this.supertype = token.getSupertype();
this.subtype = token.getSubtype();
}

View file

@ -81,11 +81,11 @@ public class Token extends MageObjectImpl {
this.name = name;
this.description = description;
}
public Token(String name, String description, int power, int toughness) {
this(name, description);
this.power.setValue(power);
this.toughness.setValue(toughness);
this.power.modifyBaseValue(power);
this.toughness.modifyBaseValue(toughness);
}
public Token(String name, String description, ObjectColor color, List<String> subtype, int power, int toughness, Abilities<Ability> abilities) {
@ -93,8 +93,8 @@ public class Token extends MageObjectImpl {
this.cardType.add(CardType.CREATURE);
this.color = color.copy();
this.subtype = subtype;
this.power.setValue(power);
this.toughness.setValue(toughness);
this.power.modifyBaseValue(power);
this.toughness.modifyBaseValue(toughness);
if (abilities != null) {
this.abilities = abilities.copy();
}
@ -217,11 +217,11 @@ public class Token extends MageObjectImpl {
}
return false;
}
public void setPower(int power) {
this.power.setValue(power);
}
public void setToughness(int toughness) {
this.toughness.setValue(toughness);
}
@ -264,17 +264,13 @@ public class Token extends MageObjectImpl {
if (availableImageSetCodes.size() > 0) {
if (availableImageSetCodes.contains(code)) {
setOriginalExpansionSetCode(code);
} else {
// we should not set random set if appropriate set is already used
if (getOriginalExpansionSetCode() == null || getOriginalExpansionSetCode().isEmpty()
|| !availableImageSetCodes.contains(getOriginalExpansionSetCode())) {
setOriginalExpansionSetCode(availableImageSetCodes.get(new Random().nextInt(availableImageSetCodes.size())));
}
}
} else {
if (getOriginalExpansionSetCode() == null || getOriginalExpansionSetCode().isEmpty()) {
setOriginalExpansionSetCode(code);
} else // we should not set random set if appropriate set is already used
if (getOriginalExpansionSetCode() == null || getOriginalExpansionSetCode().isEmpty()
|| !availableImageSetCodes.contains(getOriginalExpansionSetCode())) {
setOriginalExpansionSetCode(availableImageSetCodes.get(new Random().nextInt(availableImageSetCodes.size())));
}
} else if (getOriginalExpansionSetCode() == null || getOriginalExpansionSetCode().isEmpty()) {
setOriginalExpansionSetCode(code);
}
}