mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
Merge branch 'fix-fertile-ground-on-nonbasics' into 'master'
When copying costs, make sure to recache the TapCost state. See merge request core-developers/forge!315
This commit is contained in:
@@ -51,12 +51,23 @@ public class Cost implements Serializable {
|
|||||||
private final List<CostPart> costParts = Lists.newArrayList();
|
private final List<CostPart> costParts = Lists.newArrayList();
|
||||||
private boolean isMandatory = false;
|
private boolean isMandatory = false;
|
||||||
|
|
||||||
|
// Primarily used for Summoning Sickness awareness
|
||||||
private boolean tapCost = false;
|
private boolean tapCost = false;
|
||||||
|
|
||||||
public final boolean hasTapCost() {
|
public final boolean hasTapCost() {
|
||||||
return this.tapCost;
|
return this.tapCost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void cacheTapCost() {
|
||||||
|
tapCost = false;
|
||||||
|
for (CostPart p : getCostParts()) {
|
||||||
|
if (p instanceof CostTap || p instanceof CostUntap) {
|
||||||
|
tapCost = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public final boolean hasNoManaCost() {
|
public final boolean hasNoManaCost() {
|
||||||
return this.getCostMana() == null;
|
return this.getCostMana() == null;
|
||||||
}
|
}
|
||||||
@@ -508,6 +519,7 @@ public class Cost implements Serializable {
|
|||||||
for (CostPart cp : this.costParts) {
|
for (CostPart cp : this.costParts) {
|
||||||
toRet.costParts.add(cp.copy());
|
toRet.costParts.add(cp.copy());
|
||||||
}
|
}
|
||||||
|
toRet.cacheTapCost();
|
||||||
return toRet;
|
return toRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -518,12 +530,14 @@ public class Cost implements Serializable {
|
|||||||
if (!(cp instanceof CostPartMana))
|
if (!(cp instanceof CostPartMana))
|
||||||
toRet.costParts.add(cp.copy());
|
toRet.costParts.add(cp.copy());
|
||||||
}
|
}
|
||||||
|
toRet.cacheTapCost();
|
||||||
return toRet;
|
return toRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Cost copyWithDefinedMana(String manaCost) {
|
public final Cost copyWithDefinedMana(String manaCost) {
|
||||||
Cost toRet = copyWithNoMana();
|
Cost toRet = copyWithNoMana();
|
||||||
toRet.costParts.add(new CostPartMana(new ManaCost(new ManaCostParser(manaCost)), null));
|
toRet.costParts.add(new CostPartMana(new ManaCost(new ManaCostParser(manaCost)), null));
|
||||||
|
toRet.cacheTapCost();
|
||||||
return toRet;
|
return toRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user