use of mage.game.events.EntersTheBattlefieldEvent in project mage by magefree.
the class DranaTheLastBloodchiefCounterEffect method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
if (creature != null && mor.refersTo(creature, game)) {
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 GyomeMasterChefWatcher method watch.
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() != GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
return;
}
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (permanent == null || permanent instanceof PermanentToken || !permanent.isCreature(game)) {
return;
}
playerMap.compute(event.getPlayerId(), CardUtil::setOrIncrementValue);
}
use of mage.game.events.EntersTheBattlefieldEvent in project mage by magefree.
the class OpalPalaceEntersBattlefieldEffect method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (permanent != null) {
CommanderPlaysCountWatcher watcher = game.getState().getWatcher(CommanderPlaysCountWatcher.class);
int castCount = watcher.getPlaysCount(permanent.getId());
if (castCount > 0) {
permanent.addCounters(CounterType.P1P1.createInstance(castCount), source.getControllerId(), source, game);
}
}
return false;
}
use of mage.game.events.EntersTheBattlefieldEvent in project mage by magefree.
the class AshlingsPrerogativeCorrectOddityEffect method applies.
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
int incorrectModResult;
if (oddCondition.apply(game, source)) {
incorrectModResult = 0;
} else {
incorrectModResult = 1;
}
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
return permanent != null && creaturefilter.match(permanent, game) && permanent.getManaValue() % 2 == incorrectModResult;
}
use of mage.game.events.EntersTheBattlefieldEvent in project mage by magefree.
the class BloodSeekerTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (game.getOpponents(this.controllerId).contains(event.getPlayerId())) {
EntersTheBattlefieldEvent zEvent = (EntersTheBattlefieldEvent) event;
Card card = zEvent.getTarget();
if (card != null && card.isCreature(game)) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
}
return true;
}
}
return false;
}
Aggregations