use of mage.target.targetpointer.FixedTarget in project mage by magefree.
the class CommandersPlateEffect method init.
@Override
public void init(Ability source, Game game) {
super.init(source, game);
if (!affectedObjectsSet) {
return;
}
Permanent equipment = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (equipment == null || equipment.getAttachedTo() == null) {
return;
}
this.setTargetPointer(new FixedTarget(equipment.getAttachedTo(), game));
}
use of mage.target.targetpointer.FixedTarget in project mage by magefree.
the class CoffinQueenDelayedTriggeredAbility method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent controlledCreature = game.getPermanent(source.getFirstTarget());
if (controlledCreature != null) {
DelayedTriggeredAbility delayedAbility = new CoffinQueenDelayedTriggeredAbility();
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 CommandoRaidEffect method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
Player opponent = game.getPlayer(event.getPlayerId());
if (!damageEvent.isCombatDamage() || !event.getSourceId().equals(this.getSourceId()) || opponent == null) {
return false;
}
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature " + opponent.getLogName() + " controls");
filter.add(new ControllerIdPredicate(opponent.getId()));
this.getTargets().clear();
this.addTarget(new TargetCreaturePermanent(filter));
for (Effect effect : this.getAllEffects()) {
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
effect.setValue("damage", event.getAmount());
}
return true;
}
use of mage.target.targetpointer.FixedTarget in project mage by magefree.
the class DarkDabblingEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
if (SpellMasteryCondition.instance.apply(game, source)) {
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game)) {
if (!permanent.getId().equals(getTargetPointer().getFirst(game, source))) {
RegenerateTargetEffect regenEffect = new RegenerateTargetEffect();
regenEffect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(regenEffect, source);
}
}
}
return true;
}
use of mage.target.targetpointer.FixedTarget in project mage by magefree.
the class DarkDecisionEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null) {
TargetCardInLibrary target = new TargetCardInLibrary(new FilterNonlandCard());
target.setCardLimit(10);
if (controller.searchLibrary(target, source, game)) {
UUID targetId = target.getFirstTarget();
Card card = game.getCard(targetId);
if (card != null) {
controller.moveCardsToExile(card, source, game, true, source.getSourceId(), sourceObject.getIdName());
ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(card.getId(), game));
game.addEffect(effect, source);
}
controller.shuffleLibrary(source, game);
}
return true;
}
return false;
}
Aggregations