mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
- JOU: Added Kruphix, God of Horizons
This commit is contained in:
@@ -109,11 +109,15 @@ public class ManaPool implements Iterable<Mana> {
|
|||||||
|
|
||||||
int numRemoved = 0;
|
int numRemoved = 0;
|
||||||
boolean keepGreenMana = isEndOfPhase && this.owner.hasKeyword("Green mana doesn't empty from your mana pool as steps and phases end.");
|
boolean keepGreenMana = isEndOfPhase && this.owner.hasKeyword("Green mana doesn't empty from your mana pool as steps and phases end.");
|
||||||
|
boolean convertToColorless = owner.hasKeyword("Convert unused mana to Colorless");
|
||||||
|
|
||||||
List<Byte> keys = Lists.newArrayList(floatingMana.keySet());
|
List<Byte> keys = Lists.newArrayList(floatingMana.keySet());
|
||||||
if (keepGreenMana) {
|
if (keepGreenMana) {
|
||||||
keys.remove(Byte.valueOf(MagicColor.GREEN));
|
keys.remove(Byte.valueOf(MagicColor.GREEN));
|
||||||
}
|
}
|
||||||
|
if (convertToColorless) {
|
||||||
|
keys.remove(Byte.valueOf(MagicColor.COLORLESS));
|
||||||
|
}
|
||||||
|
|
||||||
for (Byte b : keys) {
|
for (Byte b : keys) {
|
||||||
if (isEndOfPhase && !owner.getGame().getPhaseHandler().is(PhaseType.CLEANUP)) {
|
if (isEndOfPhase && !owner.getGame().getPhaseHandler().is(PhaseType.CLEANUP)) {
|
||||||
@@ -123,19 +127,38 @@ public class ManaPool implements Iterable<Mana> {
|
|||||||
pMana.add(mana);
|
pMana.add(mana);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
numRemoved += floatingMana.get(b).size() - pMana.size();
|
if (convertToColorless) {
|
||||||
floatingMana.get(b).clear();
|
floatingMana.get(b).removeAll(pMana);
|
||||||
floatingMana.putAll(b, pMana);
|
ConvertManaColor(b, MagicColor.COLORLESS);
|
||||||
|
} else {
|
||||||
|
numRemoved += floatingMana.get(b).size() - pMana.size();
|
||||||
|
floatingMana.get(b).clear();
|
||||||
|
floatingMana.putAll(b, pMana);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
numRemoved += floatingMana.get(b).size();
|
if (convertToColorless) {
|
||||||
floatingMana.get(b).clear();
|
ConvertManaColor(b, MagicColor.COLORLESS);
|
||||||
|
} else {
|
||||||
|
numRemoved += floatingMana.get(b).size();
|
||||||
|
floatingMana.get(b).clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
owner.getGame().fireEvent(new GameEventManaPool(owner, EventValueChangeType.Cleared, null));
|
owner.getGame().fireEvent(new GameEventManaPool(owner, EventValueChangeType.Cleared, null));
|
||||||
return numRemoved;
|
return numRemoved;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ConvertManaColor(final byte originalColor, final byte toColor) {
|
||||||
|
List<Mana> convert = new ArrayList<Mana>();
|
||||||
|
for (Mana m : floatingMana.get(originalColor)) {
|
||||||
|
convert.add(new Mana(toColor, m.getSourceCard(), m.getManaAbility()));
|
||||||
|
}
|
||||||
|
floatingMana.get(originalColor).clear();
|
||||||
|
floatingMana.putAll(toColor, convert);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* removeManaFrom.
|
* removeManaFrom.
|
||||||
|
|||||||
Reference in New Issue
Block a user