use of mage.game.events.TappedForManaEvent in project mage by magefree.
the class HighTideTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent permanent = ((TappedForManaEvent) event).getPermanent();
if (permanent == null || !permanent.hasSubtype(SubType.ISLAND, game)) {
return false;
}
getEffects().setTargetPointer(new FixedTarget(permanent.getControllerId()));
return true;
}
use of mage.game.events.TappedForManaEvent in project mage by magefree.
the class NakedSingularityEffect method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
TappedForManaEvent manaEvent = (TappedForManaEvent) event;
Player controller = game.getPlayer(source.getControllerId());
Permanent permanent = manaEvent.getPermanent();
if (controller == null || permanent == null) {
return false;
}
Choice choice = new ChoiceColor(true);
choice.getChoices().clear();
choice.setMessage("Pick a color to produce");
if (permanent.hasSubtype(SubType.PLAINS, game)) {
choice.getChoices().add("Red");
}
if (permanent.hasSubtype(SubType.ISLAND, game)) {
choice.getChoices().add("Green");
}
if (permanent.hasSubtype(SubType.SWAMP, game)) {
choice.getChoices().add("White");
}
if (permanent.hasSubtype(SubType.MOUNTAIN, game)) {
choice.getChoices().add("Blue");
}
if (permanent.hasSubtype(SubType.FOREST, game)) {
choice.getChoices().add("Black");
}
String chosenColor;
if (choice.getChoices().size() == 1) {
chosenColor = choice.getChoices().iterator().next();
} else {
controller.choose(Outcome.PutManaInPool, choice, game);
chosenColor = choice.getChoice();
}
if (chosenColor == null) {
return false;
}
Mana mana = manaEvent.getMana();
int amount = mana.count();
switch(chosenColor) {
case "White":
mana.setToMana(Mana.WhiteMana(amount));
break;
case "Blue":
mana.setToMana(Mana.BlueMana(amount));
break;
case "Black":
mana.setToMana(Mana.BlackMana(amount));
break;
case "Red":
mana.setToMana(Mana.RedMana(amount));
break;
case "Green":
mana.setToMana(Mana.GreenMana(amount));
break;
}
return false;
}
use of mage.game.events.TappedForManaEvent 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.TappedForManaEvent in project mage by magefree.
the class PriceOfGloryAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
// it's non mana triggered ability, so ignore it on checking, see TAPPED_FOR_MANA
if (game.inCheckPlayableState()) {
return false;
}
Permanent permanent = ((TappedForManaEvent) event).getPermanent();
if (permanent == null || !permanent.isLand(game) || game.isActivePlayer(event.getPlayerId())) {
return false;
}
getEffects().setTargetPointer(new FixedTarget(permanent, game));
return true;
}
use of mage.game.events.TappedForManaEvent in project mage by magefree.
the class TreasureNabberEffect method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
// it's non mana triggered ability, so ignore it on checking, see TAPPED_FOR_MANA
if (game.inCheckPlayableState()) {
return false;
}
if (!game.getOpponents(controllerId).contains(event.getPlayerId())) {
return false;
}
Permanent permanent = ((TappedForManaEvent) event).getPermanent();
if (permanent == null || !permanent.isArtifact(game)) {
return false;
}
getEffects().setTargetPointer(new FixedTarget(permanent, game));
return true;
}
Aggregations