CardFactory getCloneStates set PT for Vehicle (#2713)

* Update CardFactory.java

Set PT should also be done for vehicle

* Update CardFactory.java

* Clean up

* Clean up

---------

Co-authored-by: tool4EvEr <tool4EvEr@192.168.0.59>
This commit is contained in:
Hans Mackowiak
2023-03-29 04:53:26 +02:00
committed by GitHub
parent 4329e2b0c8
commit 03924a4044
4 changed files with 15 additions and 15 deletions

View File

@@ -3934,38 +3934,32 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
currentState.setBaseLoyalty(Integer.toString(n)); currentState.setBaseLoyalty(Integer.toString(n));
} }
// values that are printed on card
public final int getBasePower() { public final int getBasePower() {
return currentState.getBasePower(); return currentState.getBasePower();
} }
public final int getBaseToughness() { public final int getBaseToughness() {
return currentState.getBaseToughness(); return currentState.getBaseToughness();
} }
// values that are printed on card
public final void setBasePower(final int n) { public final void setBasePower(final int n) {
currentState.setBasePower(n); currentState.setBasePower(n);
} }
public final void setBaseToughness(final int n) { public final void setBaseToughness(final int n) {
currentState.setBaseToughness(n); currentState.setBaseToughness(n);
} }
// values that are printed on card // values that are printed on card
public final String getBasePowerString() { public final String getBasePowerString() {
return currentState.getBasePowerString(); return (null == currentState.getBasePowerString()) ? String.valueOf(getBasePower()) : currentState.getBasePowerString();
} }
public final String getBaseToughnessString() { public final String getBaseToughnessString() {
return currentState.getBaseToughnessString(); return (null == currentState.getBaseToughnessString()) ? String.valueOf(getBaseToughness()) : currentState.getBaseToughnessString();
} }
// values that are printed on card // values that are printed on card
public final void setBasePowerString(final String s) { public final void setBasePowerString(final String s) {
currentState.setBasePowerString(s); currentState.setBasePowerString(s);
} }
public final void setBaseToughnessString(final String s) { public final void setBaseToughnessString(final String s) {
currentState.setBaseToughnessString(s); currentState.setBaseToughnessString(s);
} }

View File

@@ -568,7 +568,7 @@ public class CardFactory {
c.setRules(in.getRules()); c.setRules(in.getRules());
return c; return c;
} // copyStats() }
/** /**
* Copy characteristics of a particular state of one card to those of a * Copy characteristics of a particular state of one card to those of a
@@ -764,12 +764,14 @@ public class CardFactory {
state.removeIntrinsicKeyword(kw); state.removeIntrinsicKeyword(kw);
} }
if (state.getType().isCreature()) { // CR 208.3 A noncreature object not on the battlefield has power or toughness only if it has a power and toughness printed on it.
// currently only LKI can be trusted?
if (state.getType().isCreature() || in.getOriginalState(originalState.getStateName()).getBasePowerString() != null) {
if (sa.hasParam("SetPower")) { if (sa.hasParam("SetPower")) {
state.setBasePower(AbilityUtils.calculateAmount(sa.getHostCard(), sa.getParam("SetPower"), sa)); state.setBasePower(AbilityUtils.calculateAmount(host, sa.getParam("SetPower"), sa));
} }
if (sa.hasParam("SetToughness")) { if (sa.hasParam("SetToughness")) {
state.setBaseToughness(AbilityUtils.calculateAmount(sa.getHostCard(), sa.getParam("SetToughness"), sa)); state.setBaseToughness(AbilityUtils.calculateAmount(host, sa.getParam("SetToughness"), sa));
} }
} }

View File

@@ -202,10 +202,10 @@ public class CardState extends GameObject implements IHasSVars {
// values that are printed on card // values that are printed on card
public final String getBasePowerString() { public final String getBasePowerString() {
return (null == basePowerString) ? "" + getBasePower() : basePowerString; return basePowerString;
} }
public final String getBaseToughnessString() { public final String getBaseToughnessString() {
return (null == baseToughnessString) ? "" + getBaseToughness() : baseToughnessString; return baseToughnessString;
} }
// values that are printed on card // values that are printed on card

View File

@@ -222,7 +222,7 @@ public final class CardUtil {
newCopy.addAlternateState(CardStateName.Cloner, false); newCopy.addAlternateState(CardStateName.Cloner, false);
newCopy.getState(CardStateName.Cloner).copyFrom(in.getState(CardStateName.Cloner), true); newCopy.getState(CardStateName.Cloner).copyFrom(in.getState(CardStateName.Cloner), true);
} }
//*/ */
newCopy.setToken(in.isToken()); newCopy.setToken(in.isToken());
newCopy.setCopiedSpell(in.isCopiedSpell()); newCopy.setCopiedSpell(in.isCopiedSpell());
@@ -233,6 +233,10 @@ public final class CardUtil {
newCopy.setBasePower(in.getCurrentPower()); newCopy.setBasePower(in.getCurrentPower());
newCopy.setBaseToughness(in.getCurrentToughness()); newCopy.setBaseToughness(in.getCurrentToughness());
// printed P/T
newCopy.setBasePowerString(in.getCurrentState().getBasePowerString());
newCopy.setBaseToughnessString(in.getCurrentState().getBaseToughnessString());
// extra copy PT boost // extra copy PT boost
newCopy.setPTBoost(in.getPTBoostTable()); newCopy.setPTBoost(in.getPTBoostTable());