use of mage.game.events.TappedForManaEvent in project mage by magefree.
the class ChaosMoonEvenReplacementEffect method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent land = ((TappedForManaEvent) event).getPermanent();
if (land == null || !land.hasSubtype(SubType.MOUNTAIN, game)) {
return false;
}
this.getEffects().setTargetPointer(new FixedTarget(land.getControllerId()));
return true;
}
use of mage.game.events.TappedForManaEvent in project mage by magefree.
the class ForsakenMonumentTriggeredManaAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
TappedForManaEvent mEvent = (TappedForManaEvent) event;
Permanent permanent = mEvent.getPermanent();
return permanent != null && isControlledBy(event.getPlayerId()) && mEvent.getMana().getColorless() > 0;
}
use of mage.game.events.TappedForManaEvent in project mage by magefree.
the class BubblingMuckTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent land = ((TappedForManaEvent) event).getPermanent();
if (land == null || !land.hasSubtype(SubType.SWAMP, game)) {
return false;
}
getEffects().setTargetPointer(new FixedTarget(land.getControllerId()));
return true;
}
use of mage.game.events.TappedForManaEvent in project mage by magefree.
the class ExtraplanarLensTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
// need only info about permanent
Permanent landTappedForMana = ((TappedForManaEvent) event).getPermanent();
Permanent extraplanarLens = game.getPermanent(getSourceId());
if (extraplanarLens != null && landTappedForMana != null && !extraplanarLens.getImprinted().isEmpty()) {
Card imprinted = game.getCard(extraplanarLens.getImprinted().get(0));
if (imprinted != null && game.getState().getZone(imprinted.getId()) == Zone.EXILED) {
if (landTappedForMana.getName().equals(imprinted.getName()) && landTappedForMana.isLand(game)) {
ManaEvent mEvent = (ManaEvent) event;
for (Effect effect : getEffects()) {
effect.setValue("mana", mEvent.getMana());
effect.setValue("tappedPermanent", landTappedForMana);
}
getEffects().get(0).setTargetPointer(new FixedTarget(landTappedForMana.getId()));
return true;
}
}
}
return false;
}
use of mage.game.events.TappedForManaEvent in project mage by magefree.
the class RealityTwistEffect 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.SWAMP, game)) {
choice.getChoices().add("Green");
}
if (permanent.hasSubtype(SubType.MOUNTAIN, game)) {
choice.getChoices().add("White");
}
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 "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;
}
Aggregations