use of mage.game.events.ManaEvent in project mage by magefree.
the class RitualOfSubdualReplacementEffect method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
ManaEvent manaEvent = (ManaEvent) event;
Mana mana = manaEvent.getMana();
mana.setToMana(Mana.ColorlessMana(mana.count()));
return false;
}
use of mage.game.events.ManaEvent in project mage by magefree.
the class ManaOptions method checkManaReplacementAndTriggeredMana.
/**
* Generates triggered mana and checks replacement of Tapped_For_Mana event.
* Also generates triggered mana for MANA_ADDED event.
*
* @param ability
* @param game
* @param mana
* @return false if mana production was completely replaced
*/
private boolean checkManaReplacementAndTriggeredMana(Ability ability, Game game, Mana mana) {
if (ability.hasTapCost()) {
ManaEvent event = new TappedForManaEvent(ability.getSourceId(), ability, ability.getControllerId(), mana, game);
if (game.replaceEvent(event)) {
return false;
}
game.fireEvent(event);
}
ManaEvent manaEvent = new ManaEvent(GameEvent.EventType.MANA_ADDED, ability.getSourceId(), ability, ability.getControllerId(), mana);
manaEvent.setData(mana.toString());
game.fireEvent(manaEvent);
return true;
}
use of mage.game.events.ManaEvent in project mage by magefree.
the class HallOfGemstoneEffect method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
ObjectColor colorChosen = (ObjectColor) game.getState().getValue(source.getSourceId() + "_color");
if (colorChosen == null) {
return false;
}
ManaEvent manaEvent = (ManaEvent) event;
Mana mana = manaEvent.getMana();
// 8/23/2016 Colorless mana added to a player's mana pool isn't affected.
int genericAmount = mana.getGeneric();
int colorlessAmount = mana.getColorless();
int coloredAmount = mana.countColored();
switch(colorChosen.getOneColoredManaSymbol()) {
case W:
mana.setToMana(Mana.WhiteMana(coloredAmount));
break;
case U:
mana.setToMana(Mana.BlueMana(coloredAmount));
break;
case B:
mana.setToMana(Mana.BlackMana(coloredAmount));
break;
case R:
mana.setToMana(Mana.RedMana(coloredAmount));
break;
case G:
mana.setToMana(Mana.GreenMana(coloredAmount));
break;
}
mana.setGeneric(genericAmount);
mana.setColorless(colorlessAmount);
return false;
}
use of mage.game.events.ManaEvent in project mage by magefree.
the class BalduvianFallenAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
this.getEffects().clear();
if (event.getTargetId().equals(this.getSourceId()) && event instanceof ManaEvent) {
ManaEvent manaEvent = (ManaEvent) event;
int total = manaEvent.getMana().getBlack() + manaEvent.getMana().getRed();
if (total > 0) {
this.getEffects().add(new BoostSourceEffect(total, 0, Duration.EndOfTurn));
}
return true;
}
return false;
}
use of mage.game.events.ManaEvent in project mage by magefree.
the class ChaosMoonEvenReplacementEffect method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
ManaEvent manaEvent = (ManaEvent) event;
Mana mana = manaEvent.getMana();
mana.setToMana(Mana.ColorlessMana(mana.count()));
return false;
}
Aggregations