@Override public String getTargetedName(Game game) { StringBuilder sb = new StringBuilder(); for (UUID targetId : getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { sb.append(permanent.getLogName()).append(' '); } else { Spell spell = game.getStack().getSpell(targetId); if (spell != null) { if (spell.isFaceDown(game)) { sb.append(GameLog.getNeutralColoredText("face down spell")); } else { sb.append(spell.getLogName()).append(' '); } } } } return sb.toString(); }
@Override public boolean apply(Game game, Ability source) { MageObjectReference spellRef = (MageObjectReference) this.getValue("StormSpellRef"); if (spellRef == null) { return false; } int stormCount = 0; Player player = game.getPlayer(source.getControllerId()); if (player == null) { return false; } stormCount = player.getCommandersIds().stream().map( (commanderId) -> (Integer) game.getState().getValue(commanderId + "_castCount") ).map((castCount) -> castCount).reduce(stormCount, Integer::sum); if (stormCount == 0) { return true; } Spell spell = (Spell) this.getValue("StormSpell"); if (spell == null) { return false; } game.informPlayers(spell.getLogName() + " will be copied " + stormCount + " time" + (stormCount > 1 ? "s" : "")); for (int i = 0; i < stormCount; i++) { spell.createCopyOnStack(game, source, source.getControllerId(), true); } return true; }
@Override public boolean apply(Game game, Ability source) { MageObjectReference spellRef = (MageObjectReference) this.getValue("StormSpellRef"); if (spellRef != null) { CastSpellLastTurnWatcher watcher = game.getState().getWatcher(CastSpellLastTurnWatcher.class); if (watcher != null) { int stormCount = watcher.getSpellOrder(spellRef, game) - 1; if (stormCount > 0) { Spell spell = (Spell) this.getValue("StormSpell"); if (spell != null) { if (!game.isSimulation()) { game.informPlayers("Storm: " + spell.getLogName() + " will be copied " + stormCount + " time" + (stormCount > 1 ? "s" : "")); } for (int i = 0; i < stormCount; i++) { spell.createCopyOnStack(game, source, source.getControllerId(), true); } } } } else { Logger.getLogger(StormEffect.class).fatal("CastSpellLastTurnWatcher not found. game = " +game.getGameType().toString()); } return true; } return false; }
game.informPlayers(sourceObject.getLogName() + ": Changed target of " + spell.getLogName() + " from " + oldTargetName + " to " + loser.getLogName());
target.setMinNumberOfTargets(0); target.setMaxNumberOfTargets(1); target.setTargetName(filter.getMessage() + " that " + spell.getLogName() + " could target (" + targetCopyMap.size() + " remaining)");
if (player != null) { if (player.getHand().isEmpty()) { game.informPlayers(player.getLogName() + " doesn't have a card in hand to discard to counter " + spell.getLogName() + ", effect aborted."); return true; Player player = game.getPlayer(uuid); if (player != null) { if (!player.chooseUse(outcome, "Do you wish to discard a card to counter " + spell.getLogName() + '?', source, game)) { game.informPlayers(player.getLogName() + " refuses to discard a card to counter " + spell.getLogName()); return true; } else { game.informPlayers(player.getLogName() + " agrees to discard a card to counter " + spell.getLogName());
@Override public boolean apply(Game game, Ability source) { Spell spell = game.getStack().getSpell(getTargetPointer().getFirst(game, source)); if (spell == null) { spell = (Spell) game.getLastKnownInformation(getTargetPointer().getFirst(game, source), Zone.STACK); } MageObject sourceObject = source.getSourceObject(game); if (sourceObject != null && spell != null) { Player caster = game.getPlayer(spell.getControllerId()); if (caster != null) { if (!caster.flipCoin(source, game, true)) { game.informPlayers(sourceObject.getLogName() + ": " + spell.getLogName() + " countered"); game.getStack().counter(getTargetPointer().getFirst(game, source), source.getSourceId(), game); } } return true; } return false; } }