use of mage.abilities.SpecialAction in project mage by magefree.
the class ChannelDelayedTriggeredAbility method apply.
@Override
public boolean apply(Game game, Ability source) {
SpecialAction specialAction = new ChannelSpecialAction();
new CreateSpecialActionEffect(specialAction).apply(game, source);
// Create a hidden delayed triggered ability to remove the special action at end of turn.
new CreateDelayedTriggeredAbilityEffect(new ChannelDelayedTriggeredAbility(specialAction.getId()), false).apply(game, source);
return true;
}
use of mage.abilities.SpecialAction in project mage by magefree.
the class LicidSpecialActionEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent licid = (Permanent) source.getSourceObjectIfItStillExists(game);
if (licid != null) {
UUID messageId = UUID.randomUUID();
LicidContinuousEffect effect = new LicidContinuousEffect(messageId);
effect.setTargetPointer(new FixedTarget(licid, game));
game.addEffect(effect, source);
new AttachEffect(Outcome.Neutral).apply(game, source);
SpecialAction specialAction = new LicidSpecialAction(this.specialActionCost, messageId, licid.getIdName());
new CreateSpecialActionEffect(specialAction).apply(game, source);
return true;
}
return false;
}
use of mage.abilities.SpecialAction in project mage by magefree.
the class GuardianAngelDelayedTriggeredAbility method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
String targetName = "";
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
if (targetPlayer == null) {
Permanent targetPermanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (targetPermanent == null) {
return true;
}
targetName = targetPermanent.getIdName();
} else {
targetName = "player " + targetPlayer.getName();
}
ContinuousEffect effect = new PreventDamageToTargetEffect(Duration.EndOfTurn, source.getManaCostsToPay().getX(), false);
effect.setTargetPointer(getTargetPointer());
game.addEffect(effect, source);
SpecialAction specialAction = new GuardianAngelAction();
specialAction.getEffects().get(0).setTargetPointer(getTargetPointer());
specialAction.getEffects().get(0).setText("Prevent the next 1 damage that would be dealt to any target this turn (" + targetName + ").");
new CreateSpecialActionEffect(specialAction).apply(game, source);
// Create a hidden delayed triggered ability to remove the special action at end of turn.
new CreateDelayedTriggeredAbilityEffect(new GuardianAngelDelayedTriggeredAbility(specialAction.getId()), false).apply(game, source);
return true;
}
return false;
}
Aggregations