use of mage.abilities.effects.common.ReturnToHandSourceEffect in project mage by magefree.
the class WildWurmEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(source.getSourceId());
if (controller != null && permanent != null) {
if (controller.flipCoin(source, game, true)) {
return true;
} else {
new ReturnToHandSourceEffect().apply(game, source);
return true;
}
}
return false;
}
use of mage.abilities.effects.common.ReturnToHandSourceEffect in project mage by magefree.
the class ScoriaWurmEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(source.getSourceId());
if (controller != null && permanent != null) {
if (controller.flipCoin(source, game, true)) {
return true;
} else {
new ReturnToHandSourceEffect().apply(game, source);
return true;
}
}
return false;
}
use of mage.abilities.effects.common.ReturnToHandSourceEffect in project mage by magefree.
the class ContemptEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent contempt = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (contempt != null) {
Permanent attachedToPermanent = game.getPermanent(contempt.getAttachedTo());
if (attachedToPermanent != null) {
Effect effect = new ReturnToHandTargetEffect();
effect.setTargetPointer(new FixedTarget(attachedToPermanent.getId(), game)).setText("return " + attachedToPermanent.getName() + " to owner's hand.");
AtTheEndOfCombatDelayedTriggeredAbility ability = new AtTheEndOfCombatDelayedTriggeredAbility(effect);
game.addDelayedTriggeredAbility(ability, source);
}
Effect effect = new ReturnToHandSourceEffect();
AtTheEndOfCombatDelayedTriggeredAbility ability = new AtTheEndOfCombatDelayedTriggeredAbility(effect);
game.addDelayedTriggeredAbility(ability, source);
return true;
}
return false;
}
Aggregations