mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Merge branch 'draugr' into 'master'
add MayPlaySnowIgnoreColor for Draugr Necromancer See merge request core-developers/forge!3724
This commit is contained in:
@@ -54,11 +54,15 @@ public final class CardPlayOption {
|
||||
public boolean isIgnoreManaCostColor() {
|
||||
return sta.hasParam("MayPlayIgnoreColor");
|
||||
}
|
||||
|
||||
|
||||
public boolean isIgnoreManaCostType() {
|
||||
return sta.hasParam("MayPlayIgnoreType");
|
||||
}
|
||||
|
||||
|
||||
public boolean isIgnoreSnowSourceManaCostColor() {
|
||||
return sta.hasParam("MayPlaySnowIgnoreColor");
|
||||
}
|
||||
|
||||
public boolean isWithFlash() {
|
||||
return withFlash;
|
||||
}
|
||||
|
||||
@@ -7,8 +7,28 @@ public class ManaConversionMatrix {
|
||||
|
||||
// Conversion matrix ORs byte values to make mana more payable
|
||||
// Restrictive matrix ANDs byte values to make mana less payable
|
||||
byte[] colorConversionMatrix = new byte[ManaAtom.MANATYPES.length];
|
||||
byte[] colorRestrictionMatrix = new byte[ManaAtom.MANATYPES.length];
|
||||
protected byte[] colorConversionMatrix = new byte[ManaAtom.MANATYPES.length];
|
||||
protected byte[] colorRestrictionMatrix = new byte[ManaAtom.MANATYPES.length];
|
||||
|
||||
protected boolean snowForColor = false;
|
||||
|
||||
public boolean isSnowForColor() {
|
||||
return snowForColor;
|
||||
}
|
||||
|
||||
public void setSnowForColor(boolean value) {
|
||||
snowForColor = value;
|
||||
}
|
||||
|
||||
public byte getPossibleColorUses(byte color) {
|
||||
// Take the current conversion value, AND with restrictions to get mana usage
|
||||
int rowIdx = ManaAtom.getIndexOfFirstManaType(color);
|
||||
int matrixIdx = rowIdx < 0 ? identityMatrix.length - 1 : rowIdx;
|
||||
|
||||
byte colorUse = colorConversionMatrix[matrixIdx];
|
||||
colorUse &= colorRestrictionMatrix[matrixIdx];
|
||||
return colorUse;
|
||||
}
|
||||
|
||||
public void adjustColorReplacement(byte originalColor, byte replacementColor, boolean additive) {
|
||||
// Fix the index without hardcodes
|
||||
@@ -30,6 +50,7 @@ public class ManaConversionMatrix {
|
||||
for (int i = 0; i < colorRestrictionMatrix.length; i++) {
|
||||
colorRestrictionMatrix[i] &= extraMatrix.colorRestrictionMatrix[i];
|
||||
}
|
||||
setSnowForColor(extraMatrix.isSnowForColor());
|
||||
}
|
||||
|
||||
public void restoreColorReplacements() {
|
||||
@@ -41,5 +62,6 @@ public class ManaConversionMatrix {
|
||||
for (int i = 0; i < colorRestrictionMatrix.length; i++) {
|
||||
colorRestrictionMatrix[i] = ManaAtom.ALL_MANA_TYPES;
|
||||
}
|
||||
snowForColor = false;
|
||||
}
|
||||
}
|
||||
@@ -547,6 +547,11 @@ public class ManaCostBeingPaid {
|
||||
return false;
|
||||
}
|
||||
|
||||
// snow can be paid for any color
|
||||
if (shard.getColorMask() != 0 && mana.isSnow() && pool.isSnowForColor()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
byte color = mana.getColor();
|
||||
return pool.canPayForShardWithColor(shard, color);
|
||||
}
|
||||
|
||||
@@ -298,16 +298,6 @@ public class ManaPool extends ManaConversionMatrix implements Iterable<Mana> {
|
||||
p.getGame().fireEvent(new GameEventZone(ZoneType.Battlefield, p, EventValueChangeType.ComplexUpdate, null));
|
||||
}
|
||||
|
||||
public byte getPossibleColorUses(byte color) {
|
||||
// Take the current conversion value, AND with restrictions to get mana usage
|
||||
int rowIdx = ManaAtom.getIndexOfFirstManaType(color);
|
||||
int matrixIdx = rowIdx < 0 ? identityMatrix.length - 1 : rowIdx;
|
||||
|
||||
byte colorUse = colorConversionMatrix[matrixIdx];
|
||||
colorUse &= colorRestrictionMatrix[matrixIdx];
|
||||
return colorUse;
|
||||
}
|
||||
|
||||
public boolean canPayForShardWithColor(ManaCostShard shard, byte color) {
|
||||
if (shard.isOfKind(ManaAtom.COLORLESS) && color == ManaAtom.GENERIC) {
|
||||
return false; // FIXME: testing Colorless against Generic is a recipe for disaster, but probably there should be a better fix.
|
||||
|
||||
Reference in New Issue
Block a user