use of mage.choices.ChoiceColorOrArtifact in project mage by magefree.
the class JeweledSpiritEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
ChoiceColorOrArtifact choice = new ChoiceColorOrArtifact();
if (controller != null && controller.choose(outcome, choice, game)) {
FilterCard protectionFilter = new FilterCard();
if (choice.isArtifactSelected()) {
protectionFilter.add(CardType.ARTIFACT.getPredicate());
} else {
protectionFilter.add(new ColorPredicate(choice.getColor()));
}
protectionFilter.setMessage(choice.getChoice());
ProtectionAbility protectionAbility = new ProtectionAbility(protectionFilter);
ContinuousEffect effect = new GainAbilitySourceEffect(protectionAbility, Duration.EndOfTurn);
game.addEffect(effect, source);
return true;
}
return false;
}
use of mage.choices.ChoiceColorOrArtifact in project mage by magefree.
the class ApostlesBlessingEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
ChoiceColorOrArtifact choice = new ChoiceColorOrArtifact();
if (controller.choose(outcome, choice, game)) {
FilterCard protectionFilter = new FilterCard();
if (choice.isArtifactSelected()) {
protectionFilter.add(CardType.ARTIFACT.getPredicate());
} else {
protectionFilter.add(new ColorPredicate(choice.getColor()));
}
protectionFilter.setMessage(choice.getChoice());
ProtectionAbility protectionAbility = new ProtectionAbility(protectionFilter);
ContinuousEffect effect = new GainAbilityTargetEffect(protectionAbility, Duration.EndOfTurn);
effect.setTargetPointer(getTargetPointer());
game.addEffect(effect, source);
return true;
}
}
return false;
}
Aggregations