use of mage.choices.ChoiceBasicLandType in project mage by magefree.
the class TerraformerContinuousEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
Choice choice = new ChoiceBasicLandType();
if (player.choose(Outcome.Neutral, choice, game)) {
game.getState().setValue(source.getSourceId().toString() + "_Terraformer", choice.getChoice());
}
game.addEffect(new TerraformerContinuousEffect(), source);
return true;
}
return false;
}
use of mage.choices.ChoiceBasicLandType in project mage by magefree.
the class ChooseBasicLandTypeEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject mageObject = game.getPermanentEntering(source.getSourceId());
if (mageObject == null) {
mageObject = game.getObject(source.getSourceId());
}
if (controller != null && mageObject != null) {
ChoiceImpl choices = new ChoiceBasicLandType();
if (controller.choose(Outcome.Neutral, choices, game)) {
game.informPlayers(mageObject.getName() + ": Chosen basic land type is " + choices.getChoice());
game.getState().setValue(mageObject.getId().toString() + VALUE_KEY, choices.getChoice());
if (mageObject instanceof Permanent) {
((Permanent) mageObject).addInfo("chosen color", CardUtil.addToolTipMarkTags("Chosen basic land type: " + choices.getChoice()), game);
}
return true;
}
}
return false;
}
use of mage.choices.ChoiceBasicLandType in project mage by magefree.
the class ChooseTwoBasicLandTypesEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject mageObject = game.getPermanentEntering(source.getSourceId());
if (mageObject == null) {
mageObject = game.getObject(source.getSourceId());
}
if (controller != null && mageObject != null) {
ChoiceImpl choices = new ChoiceBasicLandType();
if (controller.choose(Outcome.Neutral, choices, game)) {
game.informPlayers(mageObject.getName() + ": First chosen basic land type is " + choices.getChoice());
game.getState().setValue(mageObject.getId().toString() + "firstChoice", choices.getChoice());
choiceOne = SubType.byDescription((String) game.getState().getValue(source.getSourceId().toString() + "firstChoice")).getDescription();
}
if (controller.choose(Outcome.Neutral, choices, game)) {
game.informPlayers(mageObject.getName() + ": Second chosen basic land type is " + choices.getChoice());
game.getState().setValue(mageObject.getId().toString() + "secondChoice", choices.getChoice());
choiceTwo = SubType.byDescription((String) game.getState().getValue(source.getSourceId().toString() + "secondChoice")).getDescription();
if (mageObject instanceof Permanent && choiceOne != null && choiceTwo != null) {
((Permanent) mageObject).addInfo("Chosen Types", CardUtil.addToolTipMarkTags("First chosen basic land type: " + choiceOne + "\n Second chosen basic land type: " + choiceTwo), game);
}
return true;
}
}
return false;
}
use of mage.choices.ChoiceBasicLandType in project mage by magefree.
the class VisionCharmEffect method init.
@Override
public void init(Ability source, Game game) {
super.init(source, game);
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Choice choice = new ChoiceLandType();
if (!controller.choose(outcome, choice, game)) {
discard();
return;
}
targetLandType = choice.getChoice();
choice = new ChoiceBasicLandType();
if (!controller.choose(outcome, choice, game)) {
discard();
return;
}
targetBasicLandType = SubType.byDescription(choice.getChoice());
if (targetLandType == null || targetBasicLandType == null) {
this.discard();
return;
}
} else {
this.discard();
return;
}
FilterPermanent filter = new FilterLandPermanent();
filter.add(SubType.byDescription(targetLandType).getPredicate());
if (this.affectedObjectsSet) {
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) {
affectedObjectList.add(new MageObjectReference(permanent, game));
}
}
}
use of mage.choices.ChoiceBasicLandType in project mage by magefree.
the class BecomesBasicLandTargetEffect method init.
@Override
public void init(Ability source, Game game) {
super.init(source, game);
// choose land type
if (chooseLandType) {
Player controller = game.getPlayer(source.getControllerId());
Choice choice = new ChoiceBasicLandType();
if (controller != null && controller.choose(outcome, choice, game)) {
landTypes.add(SubType.byDescription(choice.getChoice()));
} else {
this.discard();
return;
}
}
}
Aggregations