use of mage.game.events.GameEvent in project mage by magefree.
the class AegarTheFreezingFlameWatcher method watch.
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() != GameEvent.EventType.DAMAGED_PERMANENT) {
return;
}
DamagedEvent dEvent = (DamagedEvent) event;
MageObject sourceObject = game.getObject(event.getSourceId());
if (sourceObject == null) {
return;
}
if (game.getSpellOrLKIStack(event.getSourceId()) == null && !sourceObject.hasSubtype(SubType.GIANT, game) && !sourceObject.hasSubtype(SubType.WIZARD, game)) {
return;
}
playerMap.computeIfAbsent(game.getControllerId(event.getSourceId()), x -> new HashSet<>()).add(new MageObjectReference(event.getTargetId(), game));
}
use of mage.game.events.GameEvent in project mage by magefree.
the class NimbleTrapfinderWatcher method watch.
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() != GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
return;
}
Permanent permanent = game.getPermanent(event.getTargetId());
if (!filter.match(permanent, game)) {
return;
}
playerMap.computeIfAbsent(event.getPlayerId(), u -> new HashSet<>()).add(new MageObjectReference(permanent, game));
}
use of mage.game.events.GameEvent in project mage by magefree.
the class Step method priority.
public void priority(Game game, UUID activePlayerId, boolean resuming) {
if (hasPriority) {
stepPart = StepPart.PRIORITY;
game.fireEvent(new GameEvent(stepEvent, null, null, activePlayerId));
game.playPriority(activePlayerId, resuming);
}
}
use of mage.game.events.GameEvent in project mage by magefree.
the class Step method endStep.
public void endStep(Game game, UUID activePlayerId) {
stepPart = StepPart.POST;
game.fireEvent(new GameEvent(postStepEvent, null, null, activePlayerId));
}
use of mage.game.events.GameEvent in project mage by magefree.
the class Step method beginStep.
public void beginStep(Game game, UUID activePlayerId) {
stepPart = StepPart.PRE;
game.fireEvent(new GameEvent(preStepEvent, null, null, activePlayerId));
}
Aggregations