use of mage.Mana in project mage by magefree.
the class PulseOfLlanowarReplacementEffect method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
ManaEvent manaEvent = (ManaEvent) event;
Mana mana = manaEvent.getMana();
new AddManaOfAnyColorEffect(mana.count()).apply(game, source);
mana.setToMana(new Mana(0, 0, 0, 0, 0, 0, 0, 0));
return true;
}
use of mage.Mana in project mage by magefree.
the class SquanderedResourcesEffect method getNetMana.
@Override
public List<Mana> getNetMana(Game game, Ability source) {
if (game != null && game.inCheckPlayableState()) {
// add color combinations of available mana
ManaOptions allPossibleMana = new ManaOptions();
for (Permanent land : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_LAND, source.getControllerId(), game)) {
ManaOptions currentPossibleMana = new ManaOptions();
Set<ManaType> manaTypes = AnyColorLandsProduceManaAbility.getManaTypesFromPermanent(land, game);
if (manaTypes.size() == 5 && !manaTypes.contains(ManaType.COLORLESS) || manaTypes.size() == 6) {
currentPossibleMana.add(Mana.AnyMana(1));
if (manaTypes.contains(ManaType.COLORLESS)) {
currentPossibleMana.add(new Mana(ManaType.COLORLESS));
}
} else {
for (ManaType manaType : manaTypes) {
currentPossibleMana.add(new Mana(manaType));
}
}
allPossibleMana.addMana(currentPossibleMana);
}
allPossibleMana.removeDuplicated();
return allPossibleMana.stream().collect(Collectors.toList());
}
return ManaType.getManaListFromManaTypes(getManaTypesFromSacrificedPermanent(game, source), false);
}
use of mage.Mana in project mage by magefree.
the class ConditionalManaEffect method produceMana.
@Override
public Mana produceMana(Game game, Ability source) {
Mana mana = new Mana();
if (game == null) {
return mana;
}
if (condition.apply(game, source)) {
mana = effect.getManaTemplate().copy();
} else if (otherwiseEffect != null) {
mana = otherwiseEffect.getManaTemplate().copy();
}
if (mana.getAny() > 0) {
int amount = mana.getAny();
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return mana;
}
ChoiceColor choice = new ChoiceColor(true);
if (controller.choose(outcome, choice, game)) {
mana.setAny(0);
mana.add(choice.getMana(amount));
}
}
return mana;
}
use of mage.Mana in project mage by magefree.
the class DampingSphereIncreasementAllEffect method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
ManaEvent manaEvent = (ManaEvent) event;
Mana mana = manaEvent.getMana();
mana.setToMana(Mana.ColorlessMana(1));
return false;
}
use of mage.Mana in project mage by magefree.
the class DomriAnarchOfBolasEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Mana mana = new Mana();
if (player.chooseUse(outcome, "Choose a color of mana to add", null, "Red", "Green", source, game)) {
mana.increaseRed();
} else {
mana.increaseGreen();
}
player.getManaPool().addMana(mana, game, source);
game.addEffect(new CantBeCounteredControlledEffect(StaticFilters.FILTER_SPELL_A_CREATURE, Duration.EndOfTurn), source);
return true;
}
Aggregations