mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +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 boolean isMandatory = false;
|
||||
|
||||
// Primarily used for Summoning Sickness awareness
|
||||
private boolean tapCost = false;
|
||||
|
||||
public final boolean hasTapCost() {
|
||||
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() {
|
||||
return this.getCostMana() == null;
|
||||
}
|
||||
@@ -508,6 +519,7 @@ public class Cost implements Serializable {
|
||||
for (CostPart cp : this.costParts) {
|
||||
toRet.costParts.add(cp.copy());
|
||||
}
|
||||
toRet.cacheTapCost();
|
||||
return toRet;
|
||||
}
|
||||
|
||||
@@ -518,12 +530,14 @@ public class Cost implements Serializable {
|
||||
if (!(cp instanceof CostPartMana))
|
||||
toRet.costParts.add(cp.copy());
|
||||
}
|
||||
toRet.cacheTapCost();
|
||||
return toRet;
|
||||
}
|
||||
|
||||
public final Cost copyWithDefinedMana(String manaCost) {
|
||||
Cost toRet = copyWithNoMana();
|
||||
toRet.costParts.add(new CostPartMana(new ManaCost(new ManaCostParser(manaCost)), null));
|
||||
toRet.cacheTapCost();
|
||||
return toRet;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user