use of mage.Mana in project mage by magefree.
the class TheBloodskyMassacreEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
int berserkers = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game);
player.getManaPool().addMana(new Mana(ManaType.RED, berserkers), game, source, true);
return true;
}
use of mage.Mana in project mage by magefree.
the class BirgiGodOfStorytellingManaEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
player.getManaPool().addMana(new Mana(ManaType.RED, 1), game, source, true);
return true;
}
use of mage.Mana in project mage by magefree.
the class CadaverousBloomManaEffect method getNetMana.
@Override
public List<Mana> getNetMana(Game game, Ability source) {
if (game != null && game.inCheckPlayableState()) {
List<Mana> netMana = new ArrayList<>();
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
int count = player.getHand().size();
if (count > 0) {
Mana mana = new Mana(getManaTemplate().getWhite() * count, getManaTemplate().getBlue() * count, getManaTemplate().getBlack() * count, getManaTemplate().getRed() * count, getManaTemplate().getGreen() * count, getManaTemplate().getGeneric() * count, getManaTemplate().getAny() * count, getManaTemplate().getColorless() * count);
netMana.add(mana);
}
}
return netMana;
}
return super.getNetMana(game, source);
}
use of mage.Mana in project mage by magefree.
the class DeepWaterReplacementEffect method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
ManaEvent manaEvent = (ManaEvent) event;
Mana mana = manaEvent.getMana();
mana.setToMana(Mana.BlueMana(mana.count()));
return false;
}
use of mage.Mana in project mage by magefree.
the class GrandWarlordRadhaEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
CreaturesAttackedWatcher watcher = game.getState().getWatcher(CreaturesAttackedWatcher.class);
if (watcher != null) {
int attackingCreatures = 0;
for (MageObjectReference attacker : watcher.getAttackedThisTurnCreatures()) {
if (attacker.getPermanentOrLKIBattlefield(game).isControlledBy(controller.getId())) {
attackingCreatures++;
}
}
if (attackingCreatures > 0) {
Choice manaChoice = new ChoiceImpl();
Set<String> choices = new LinkedHashSet<>();
choices.add("Red");
choices.add("Green");
manaChoice.setChoices(choices);
manaChoice.setMessage("Select color of mana to add");
for (int i = 0; i < attackingCreatures; i++) {
Mana mana = new Mana();
if (!controller.choose(Outcome.Benefit, manaChoice, game)) {
return false;
}
if (manaChoice.getChoice() == null) {
// can happen if player leaves game
return false;
}
switch(manaChoice.getChoice()) {
case "Green":
mana.increaseGreen();
break;
case "Red":
mana.increaseRed();
break;
}
controller.getManaPool().addMana(mana, game, source, true);
}
return true;
}
return true;
}
}
return false;
}
Aggregations