use of mage.target.targetpointer.FixedTarget in project mage by magefree.
the class StanggExileTokenEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent sourceObject = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (sourceObject != null) {
CreateTokenEffect effect = new CreateTokenEffect(new StanggTwinToken());
effect.apply(game, source);
game.getState().setValue(source.getSourceId() + "_token", effect.getLastAddedTokenIds());
for (UUID addedTokenId : effect.getLastAddedTokenIds()) {
Effect sacrificeEffect = new SacrificeTargetEffect("sacrifice " + sourceObject.getName());
sacrificeEffect.setTargetPointer(new FixedTarget(sourceObject, game));
LeavesBattlefieldTriggeredAbility triggerAbility = new LeavesBattlefieldTriggeredAbility(sacrificeEffect, false);
ContinuousEffect continuousEffect = new GainAbilityTargetEffect(triggerAbility, Duration.WhileOnBattlefield);
continuousEffect.setTargetPointer(new FixedTarget(addedTokenId, game));
game.addEffect(continuousEffect, source);
}
return true;
}
return false;
}
use of mage.target.targetpointer.FixedTarget in project mage by magefree.
the class SporogenesisRemoveCountersEffect method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.isDiesEvent()) {
Permanent permanent = game.getPermanentOrLKIBattlefield(zEvent.getTargetId());
if (permanent != null && permanent.isCreature(game) && permanent.getCounters(game).containsKey(CounterType.FUNGUS)) {
Effect effect = this.getEffects().get(0);
effect.setTargetPointer(new FixedTarget(event.getTargetId(), game));
return true;
}
}
return false;
}
use of mage.target.targetpointer.FixedTarget in project mage by magefree.
the class TheDeckOfManyThingsDelayedTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (!zEvent.isDiesEvent() || !mor.refersTo(zEvent.getTarget(), game)) {
return false;
}
getEffects().setTargetPointer(new FixedTarget(zEvent.getTarget().getOwnerId(), game));
return true;
}
use of mage.target.targetpointer.FixedTarget in project mage by magefree.
the class TezzeretMasterOfMetalControlEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(filter, targetPointer.getFirst(game, source), game);
for (Permanent permanent : permanents) {
ContinuousEffect effect = new TezzeretMasterOfMetalControlEffect(source.getControllerId());
effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source);
}
return true;
}
use of mage.target.targetpointer.FixedTarget in project mage by magefree.
the class TransmogrifyingWandEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent creature = game.getPermanent(source.getFirstTarget());
if (creature == null) {
return false;
}
Effect effect = new CreateTokenTargetEffect(new OxToken());
effect.setTargetPointer(new FixedTarget(creature.getControllerId(), game));
new DestroyTargetEffect().apply(game, source);
return effect.apply(game, source);
}
Aggregations