use of mage.Mana in project mage by magefree.
the class ManaOptions method addTriggeredMana.
private void addTriggeredMana(Game game, Ability ability) {
List<List<Mana>> netManaList = getSimulatedTriggeredManaFromPlayer(game, ability);
for (List<Mana> triggeredNetMana : netManaList) {
if (triggeredNetMana.size() == 1) {
addMana(triggeredNetMana.get(0));
} else if (triggeredNetMana.size() > 1) {
// Add variations
List<Mana> copy = copy();
this.clear();
for (Mana triggeredMana : triggeredNetMana) {
for (Mana mana : copy) {
Mana newMana = new Mana();
newMana.add(mana);
newMana.add(triggeredMana);
this.add(newMana);
}
}
}
}
forceManaDeduplication();
}
use of mage.Mana in project mage by magefree.
the class AnyColorLandsProduceManaEffect method getManaTypes.
private Mana getManaTypes(Game game, Ability source) {
Mana types = new Mana();
if (game == null || game.getPhase() == null) {
return types;
}
if (inManaTypeCalculation) {
return types;
}
inManaTypeCalculation = true;
List<Permanent> lands = game.getBattlefield().getActivePermanents(StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND, source.getControllerId(), source.getSourceId(), game);
for (Permanent land : lands) {
Abilities<ActivatedManaAbilityImpl> mana = land.getAbilities().getActivatedManaAbilities(Zone.BATTLEFIELD);
for (ActivatedManaAbilityImpl ability : mana) {
if (!ability.equals(source) && ability.definesMana(game)) {
for (Mana netMana : ability.getNetMana(game)) {
types.add(netMana);
}
}
}
}
inManaTypeCalculation = false;
return types;
}
use of mage.Mana in project mage by magefree.
the class AnyColorLandsProduceManaEffect method getNetMana.
@Override
public List<Mana> getNetMana(Game game, Ability source) {
int manaAmount = getManaAmount(game, source);
List<Mana> netManas = new ArrayList<>();
Mana types = getManaTypes(game, source);
if (types.getRed() > 0) {
netManas.add(Mana.RedMana(manaAmount));
}
if (types.getGreen() > 0) {
netManas.add(Mana.GreenMana(manaAmount));
}
if (types.getBlue() > 0) {
netManas.add(Mana.BlueMana(manaAmount));
}
if (types.getWhite() > 0) {
netManas.add(Mana.WhiteMana(manaAmount));
}
if (types.getBlack() > 0) {
netManas.add(Mana.BlackMana(manaAmount));
}
if (types.getColorless() > 0) {
netManas.add(Mana.ColorlessMana(manaAmount));
}
if (types.getAny() > 0) {
netManas.add(Mana.AnyMana(manaAmount));
}
return netManas;
}
use of mage.Mana in project mage by magefree.
the class KessigNaturalistEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Mana mana = player.chooseUse(Outcome.Neutral, "Choose red or green", null, "Red", "Green", source, game) ? Mana.RedMana(1) : Mana.GreenMana(1);
player.getManaPool().addMana(mana, game, source, true);
return true;
}
use of mage.Mana in project mage by magefree.
the class LordOfTheUlvenwaldEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Mana mana = player.chooseUse(Outcome.Neutral, "Choose red or green", null, "Red", "Green", source, game) ? Mana.RedMana(1) : Mana.GreenMana(1);
player.getManaPool().addMana(mana, game, source, true);
return true;
}
Aggregations