use of mage.watchers.common.AmountOfDamageAPlayerReceivedThisTurnWatcher in project mage by magefree.
the class NotoriousThrongEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
AmountOfDamageAPlayerReceivedThisTurnWatcher watcher = game.getState().getWatcher(AmountOfDamageAPlayerReceivedThisTurnWatcher.class);
if (controller != null && watcher != null) {
int numTokens = 0;
for (UUID opponentId : game.getOpponents(controller.getId())) {
numTokens += watcher.getAmountOfDamageReceivedThisTurn(opponentId);
}
if (numTokens > 0) {
new CreateTokenEffect(new FaerieRogueToken(), numTokens).apply(game, source);
}
return true;
}
return false;
}
use of mage.watchers.common.AmountOfDamageAPlayerReceivedThisTurnWatcher in project mage by magefree.
the class KnollspineDragonEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Player targetOpponent = game.getPlayer(targetPointer.getFirst(game, source));
if (controller != null) {
new DiscardHandControllerEffect().apply(game, source);
if (targetOpponent != null) {
AmountOfDamageAPlayerReceivedThisTurnWatcher watcher = game.getState().getWatcher(AmountOfDamageAPlayerReceivedThisTurnWatcher.class);
if (watcher != null) {
int drawAmount = watcher.getAmountOfDamageReceivedThisTurn(targetOpponent.getId());
controller.drawCards(drawAmount, source, game);
return true;
}
}
game.informPlayers(controller.getLogName() + " drew no cards");
return true;
}
return false;
}
Aggregations