use of mage.game.permanent.token.ChainersTormentNightmareToken in project mage by magefree.
the class ChainersTormentEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
int xValue = (int) Math.ceil((1.0 * Math.max(0, player.getLife())) / 2);
CreateTokenEffect effect = new CreateTokenEffect(new ChainersTormentNightmareToken(xValue));
if (effect.apply(game, source)) {
for (UUID tokenId : effect.getLastAddedTokenIds()) {
Permanent token = game.getPermanentOrLKIBattlefield(tokenId);
if (token != null) {
player.damage(xValue, tokenId, source, game);
}
}
}
return true;
}
Aggregations