use of mage.target.targetpointer.FixedTarget in project mage by magefree.
the class MacabreMockeryEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Card card = game.getCard(getTargetPointer().getFirst(game, source));
if (card == null) {
return false;
}
Player controller = game.getPlayer(source.getControllerId());
if (controller == null || !controller.moveCards(card, Zone.BATTLEFIELD, source, game)) {
return false;
}
Permanent permanent = game.getPermanent(card.getId());
if (permanent == null) {
return false;
}
ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom);
effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source);
effect = new BoostTargetEffect(2, 0, Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source);
Effect sacrificeEffect = new SacrificeTargetEffect("sacrifice " + permanent.getLogName(), controller.getId());
sacrificeEffect.setTargetPointer(new FixedTarget(permanent, game));
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect), source);
return true;
}
use of mage.target.targetpointer.FixedTarget in project mage by magefree.
the class LuminousBroodmothEffect method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getTarget() == null || zEvent.getTarget().getId().equals(this.getSourceId())) {
return false;
}
Permanent permanent = game.getPermanentOrLKIBattlefield(zEvent.getTarget().getId());
if (permanent != null && zEvent.isDiesEvent() && permanent.isCreature(game) && !permanent.getAbilities().containsKey(FlyingAbility.getInstance().getId()) && permanent.isControlledBy(this.controllerId)) {
this.getEffects().setTargetPointer(new FixedTarget(zEvent.getTargetId()));
return true;
}
return false;
}
use of mage.target.targetpointer.FixedTarget in project mage by magefree.
the class MeriekeRiBeritDelayedTriggeredAbility method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent controlledCreature = game.getPermanent(source.getFirstTarget());
if (controlledCreature != null) {
DelayedTriggeredAbility delayedAbility = new MeriekeRiBeritDelayedTriggeredAbility();
delayedAbility.getEffects().get(0).setTargetPointer(new FixedTarget(controlledCreature, game));
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
return false;
}
use of mage.target.targetpointer.FixedTarget in project mage by magefree.
the class OathOfLiegesPredicate method apply.
@Override
public boolean apply(Game game, Ability source) {
Player activePlayer = game.getPlayer(game.getActivePlayerId());
if (activePlayer != null) {
if (activePlayer.chooseUse(outcome, "Search your library for a basic land card, put that card onto the battlefield, then shuffle?", source, game)) {
Effect effect = new SearchLibraryPutInPlayTargetPlayerEffect(new TargetCardInLibrary(StaticFilters.FILTER_CARD_BASIC_LAND), false, false, Outcome.PutLandInPlay, true);
effect.setTargetPointer(new FixedTarget(game.getActivePlayerId()));
return effect.apply(game, source);
}
return true;
}
return false;
}
use of mage.target.targetpointer.FixedTarget in project mage by magefree.
the class ParoxysmEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent aura = game.getPermanent(source.getSourceId());
if (aura != null) {
Permanent creatureAttachedTo = game.getPermanent(aura.getAttachedTo());
if (creatureAttachedTo != null) {
Player controllerOfCreature = game.getPlayer(creatureAttachedTo.getControllerId());
if (controllerOfCreature != null) {
Card revealCardFromTop = controllerOfCreature.getLibrary().getFromTop(game);
if (revealCardFromTop != null) {
Cards cards = new CardsImpl(revealCardFromTop);
controllerOfCreature.revealCards(source, cards, game);
if (revealCardFromTop.isLand(game)) {
creatureAttachedTo.destroy(source, game, false);
} else {
ContinuousEffect effect = new BoostTargetEffect(3, 3, Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(creatureAttachedTo.getId(), game));
game.addEffect(effect, source);
}
return true;
}
}
}
}
return false;
}
Aggregations