@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent creature = game.getPermanent(source.getSourceId()); if (controller != null && creature != null) { if (controller.flipCoin(game)) { return true; } else { creature.removeFromCombat(game); creature.tap(game); return true; } } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = source.getSourceObject(game); if (controller != null && sourceObject != null) { int flipsWon = 0; boolean controllerStopped = false; while (controller.flipCoin(game)) { ++flipsWon; if (!controller.chooseUse( outcome, new StringBuilder("You won ") .append(flipsWon) .append(flipsWon == 1 ? " flip." : " flips.") .append(" Flip another coin?") .toString(), source, game)) { controllerStopped = true; break; } } if (controllerStopped) { Permanent creature = game.getPermanent(getTargetPointer().getFirst(game, source)); if (creature != null) { creature.damage(3, source.getSourceId(), game, false, true); } if (flipsWon > 1) { new DamagePlayersEffect(6, TargetController.OPPONENT).apply(game, source); } if (flipsWon > 2) { controller.drawCards(9, game); new UntapAllLandsControllerEffect().apply(game, source); } } else { game.informPlayers(sourceObject.getIdName() + " had no effect"); } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Card molten = game.getCard(source.getSourceId()); if (controller != null) { ElementalToken token = new ElementalToken(); token.putOntoBattlefield(2, game, source.getSourceId(), source.getControllerId()); if (controller.flipCoin(game)) { molten.moveToZone(Zone.HAND, source.getSourceId(), game, true); game.informPlayers( controller.getLogName() + " won the flip. " + molten.getLogName() + " is returned to " + controller.getLogName() + "'s hand."); } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { Set<UUID> toSacrifice = new HashSet<UUID>(); if (controller.flipCoin(game)) { // each blocking creature is sacrificed by its controller for (CombatGroup combatGroup : game.getCombat().getGroups()) { for (UUID blockerId : combatGroup.getBlockers()) { toSacrifice.add(blockerId); } } } else { // each blocked creature is sacrificed by its controller for (CombatGroup combatGroup : game.getCombat().getGroups()) { if (!combatGroup.getBlockers().isEmpty()) { for (UUID attackerId : combatGroup.getAttackers()) { toSacrifice.add(attackerId); } } } } for (UUID creatureId : toSacrifice) { Permanent creature = game.getPermanent(creatureId); if (creature != null) { creature.sacrifice(source.getSourceId(), game); Player player = game.getPlayer(creature.getControllerId()); if (player != null) { game.informPlayers( new StringBuilder(player.getName()) .append(" sacrifices ") .append(creature.getName()) .toString()); } } } return true; } return false; }