use of mage.watchers.common.PlayerLostLifeWatcher in project mage by magefree.
the class WoundReflectionEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
PlayerLostLifeWatcher watcher = game.getState().getWatcher(PlayerLostLifeWatcher.class);
if (controller != null && watcher != null) {
for (UUID playerId : game.getOpponents(controller.getId())) {
Player opponent = game.getPlayer(playerId);
if (opponent != null) {
int lifeLost = watcher.getLifeLost(playerId);
if (lifeLost > 0) {
opponent.loseLife(lifeLost, game, source, false);
}
}
}
return true;
}
return false;
}
use of mage.watchers.common.PlayerLostLifeWatcher in project mage by magefree.
the class ArchfiendOfDespairEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
PlayerLostLifeWatcher watcher = game.getState().getWatcher(PlayerLostLifeWatcher.class);
if (controller != null && watcher != null) {
for (UUID playerId : game.getOpponents(controller.getId())) {
Player opponent = game.getPlayer(playerId);
if (opponent != null) {
int lifeLost = watcher.getLifeLost(playerId);
if (lifeLost > 0) {
opponent.loseLife(lifeLost, game, source, false);
}
}
}
return true;
}
return false;
}
Aggregations