use of mage.game.events.EntersTheBattlefieldEvent in project mage by magefree.
the class NeoformReplacementEffect method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
if (creature != null) {
creature.addCounters(CounterType.P1P1.createInstance(), source.getControllerId(), source, game, event.getAppliedEffects());
}
discard();
return false;
}
use of mage.game.events.EntersTheBattlefieldEvent in project mage by magefree.
the class SavageSummoningEntersBattlefieldEffect method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
if (creature != null) {
creature.addCounters(CounterType.P1P1.createInstance(), source.getControllerId(), source, game, event.getAppliedEffects());
}
discard();
return false;
}
use of mage.game.events.EntersTheBattlefieldEvent in project mage by magefree.
the class TheoreticalDuplicationTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
EntersTheBattlefieldEvent eEvent = (EntersTheBattlefieldEvent) event;
if (!eEvent.getTarget().isCreature(game) || eEvent.getTarget() instanceof PermanentToken || !game.getOpponents(getControllerId()).contains(eEvent.getTarget().getControllerId())) {
return false;
}
getEffects().setTargetPointer(new FixedTarget(eEvent.getTarget(), game));
return true;
}
use of mage.game.events.EntersTheBattlefieldEvent in project mage by magefree.
the class UndyingMaliceCounterEffect method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
if (creature == null) {
return false;
}
creature.addCounters(CounterType.P1P1.createInstance(), source.getControllerId(), source, game, event.getAppliedEffects());
discard();
return false;
}
use of mage.game.events.EntersTheBattlefieldEvent in project mage by magefree.
the class YarokTheDesecratedEffect method applies.
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (!(event instanceof NumberOfTriggersEvent)) {
return false;
}
NumberOfTriggersEvent numberOfTriggersEvent = (NumberOfTriggersEvent) event;
if (!source.isControlledBy(event.getPlayerId())) {
return false;
}
GameEvent sourceEvent = numberOfTriggersEvent.getSourceEvent();
// Only EtB triggers
if (sourceEvent == null || sourceEvent.getType() != GameEvent.EventType.ENTERS_THE_BATTLEFIELD || !(sourceEvent instanceof EntersTheBattlefieldEvent)) {
return false;
}
// Only for triggers of permanents
return game.getPermanent(numberOfTriggersEvent.getSourceId()) != null;
}
Aggregations