mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
*Preliminary Mana replacement
This commit is contained in:
@@ -30,6 +30,7 @@ import forge.card.MagicColor;
|
|||||||
import forge.card.mana.Mana;
|
import forge.card.mana.Mana;
|
||||||
import forge.card.mana.ManaPool;
|
import forge.card.mana.ManaPool;
|
||||||
import forge.card.trigger.TriggerType;
|
import forge.card.trigger.TriggerType;
|
||||||
|
import forge.game.GameType;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -105,6 +106,12 @@ public class AbilityManaPart implements java.io.Serializable {
|
|||||||
public final void produceMana(final String produced, final Player player, SpellAbility sa) {
|
public final void produceMana(final String produced, final Player player, SpellAbility sa) {
|
||||||
final Card source = this.getSourceCard();
|
final Card source = this.getSourceCard();
|
||||||
final ManaPool manaPool = player.getManaPool();
|
final ManaPool manaPool = player.getManaPool();
|
||||||
|
ColorSet CID = null;
|
||||||
|
|
||||||
|
if(player.getGame().getType() == GameType.Commander)
|
||||||
|
{
|
||||||
|
CID = player.getCommander().getRules().getColorIdentity();
|
||||||
|
}
|
||||||
|
|
||||||
//clear lastProduced
|
//clear lastProduced
|
||||||
this.lastManaProduced.clear();
|
this.lastManaProduced.clear();
|
||||||
@@ -116,7 +123,17 @@ public class AbilityManaPart implements java.io.Serializable {
|
|||||||
this.lastManaProduced.add(new Mana(MagicColor.COLORLESS, source, this));
|
this.lastManaProduced.add(new Mana(MagicColor.COLORLESS, source, this));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
this.lastManaProduced.add(new Mana(MagicColor.fromName(c), source, this));
|
{
|
||||||
|
byte attemptedMana = MagicColor.fromName(c);
|
||||||
|
if(CID != null)
|
||||||
|
{
|
||||||
|
if(!CID.hasAnyColor(attemptedMana)) {
|
||||||
|
attemptedMana = MagicColor.COLORLESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.lastManaProduced.add(new Mana(attemptedMana, source, this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// add the mana produced to the mana pool
|
// add the mana produced to the mana pool
|
||||||
|
|||||||
Reference in New Issue
Block a user