Search in sources :

Example 6 with PlayerLostLifeWatcher

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;
}
Also used : Player(mage.players.Player) PlayerLostLifeWatcher(mage.watchers.common.PlayerLostLifeWatcher) UUID(java.util.UUID)

Example 7 with PlayerLostLifeWatcher

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;
}
Also used : Player(mage.players.Player) PlayerLostLifeWatcher(mage.watchers.common.PlayerLostLifeWatcher) UUID(java.util.UUID)

Aggregations

PlayerLostLifeWatcher (mage.watchers.common.PlayerLostLifeWatcher)7 Player (mage.players.Player)5 UUID (java.util.UUID)4 MorbidHint (mage.abilities.hint.common.MorbidHint)1 Card (mage.cards.Card)1 ExileZone (mage.game.ExileZone)1 TargetCard (mage.target.TargetCard)1