@Override public boolean apply(Game game, Ability source) { if (spell != null) { spell.createCopyOnStack(game, source, source.getControllerId(), true); return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source)); if (spell != null) { spell.createCopyOnStack(game, source, source.getControllerId(), true); spell.createCopyOnStack(game, source, source.getControllerId(), true); return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source)); if (spell != null) { StackObject newStackObject = spell.createCopyOnStack(game, source, spell.getControllerId(), true); Player player = game.getPlayer(spell.getControllerId()); if (player != null && newStackObject instanceof Spell) { String activateMessage = ((Spell) newStackObject).getActivatedMessage(game); if (activateMessage.startsWith(" casts ")) { activateMessage = activateMessage.substring(6); } game.informPlayers(player.getLogName() + " copies " + activateMessage); } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { Spell spell = game.getStack().getSpell(source.getSourceId()); if (spell != null) { StackObject stackObjectCopy = spell.createCopyOnStack(game, source, source.getControllerId(), true); if (stackObjectCopy instanceof Spell) { String activateMessage = ((Spell) stackObjectCopy).getActivatedMessage(game); if (activateMessage.startsWith(" casts ")) { activateMessage = activateMessage.substring(6); } game.informPlayers(controller.getLogName() + " copies " + activateMessage); } return true; } } return false; }
@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) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source)); if (spell != null) { StackObject stackObjectCopy = spell.createCopyOnStack(game, source, source.getControllerId(), true); if (stackObjectCopy instanceof Spell) { game.informPlayers(controller.getLogName() + ((Spell) stackObjectCopy).getActivatedMessage(game)); } Spell sourceSpell = (Spell) game.getStack().getStackObject(source.getSourceId()); if (sourceSpell != null) { if (sourceSpell.getFromZone() == Zone.GRAVEYARD) { stackObjectCopy = spell.createCopyOnStack(game, source, source.getControllerId(), true); if (stackObjectCopy instanceof Spell) { game.informPlayers(new StringBuilder(controller.getLogName()).append(((Spell) stackObjectCopy).getActivatedMessage(game)).toString()); } } } return true; } } return false; }
@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; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null && conspiredSpell != null) { Card card = game.getCard(conspiredSpell.getSourceId()); if (card != null) { StackObject newStackObject = conspiredSpell.createCopyOnStack(game, source, source.getControllerId(), true); if (newStackObject instanceof Spell && !game.isSimulation()) { game.informPlayers(controller.getLogName() + ((Spell) newStackObject).getActivatedMessage(game)); } return true; } } return false; }
@Override public boolean apply(Game game, Ability source) { Spell spell = game.getSpellOrLKIStack(getTargetPointer().getFirst(game, source)); if (spell != null) { ThousandYearWatcher watcher = game.getState().getWatcher(ThousandYearWatcher.class); if (watcher != null) { int numberOfCopies = watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(source.getControllerId()) - 1; if (numberOfCopies > 0) { for (int i = 0; i < numberOfCopies; i++) { spell.createCopyOnStack(game, source, source.getControllerId(), true); } } return true; } } return false; } }
@Override public boolean apply(Game game, Ability source) { Spell spell = game.getSpellOrLKIStack(this.getTargetPointer().getFirst(game, source)); Player player = game.getPlayer(source.getControllerId()); if (spell != null && player != null) { PlayerList range = game.getState().getPlayersInRange(player.getId(), game); for (UUID playerId : game.getState().getPlayerList(spell.getControllerId())) { if (!playerId.equals(spell.getControllerId()) && range.contains(playerId)) { spell.createCopyOnStack(game, source, playerId, true); } } return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Spell spell; if (useLKI) { spell = game.getSpellOrLKIStack(targetPointer.getFirst(game, source)); } else { spell = game.getStack().getSpell(targetPointer.getFirst(game, source)); } if (spell == null) { spell = (Spell) game.getLastKnownInformation(targetPointer.getFirst(game, source), Zone.STACK); } if (spell != null) { StackObject newStackObject = spell.createCopyOnStack(game, source, useController ? spell.getControllerId() : source.getControllerId(), true); Player player = game.getPlayer(source.getControllerId()); if (player != null && newStackObject instanceof Spell) { String activateMessage = ((Spell) newStackObject).getActivatedMessage(game); if (activateMessage.startsWith(" casts ")) { activateMessage = activateMessage.substring(6); } if (!game.isSimulation()) { game.informPlayers(player.getLogName() + activateMessage); } } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Spell spell = game.getSpellOrLKIStack(this.getTargetPointer().getFirst(game, source)); if (spell != null) { String chooseMessage = "Copy target spell? You may choose new targets for the copy."; for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { if (!spell.isControlledBy(playerId)) { Player player = game.getPlayer(playerId); if (player != null && player.chooseUse(Outcome.Copy, chooseMessage, source, game)) { spell.createCopyOnStack(game, source, player.getId(), true); } } } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { MageObjectReference spellRef = (MageObjectReference) this.getValue("GravestormSpellRef"); if (spellRef != null) { GravestormWatcher watcher = game.getState().getWatcher(GravestormWatcher.class); if(watcher != null) { int gravestormCount = watcher.getGravestormCount(); if (gravestormCount > 0) { Spell spell = (Spell) this.getValue("GravestormSpell"); if (spell != null) { if (!game.isSimulation()) { game.informPlayers("Gravestorm: " + spell.getName() + " will be copied " + gravestormCount + " time" + (gravestormCount > 1 ? "s" : "")); } for (int i = 0; i < gravestormCount; i++) { spell.createCopyOnStack(game, source, source.getControllerId(), true); } } } return true; } } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller == null) { return false; } Spell spell = game.getStack().getSpell(getTargetPointer().getFirst(game, source)); if (spell != null) { game.getStack().counter(spell.getId(), source.getSourceId(), game); if (SpellMasteryCondition.instance.apply(game, source) && controller.chooseUse(Outcome.PlayForFree, "Copy " + spell.getName() + " (you may choose new targets for the copy)?", source, game)) { StackObject newStackObject = spell.createCopyOnStack(game, source, source.getControllerId(), true); if (newStackObject instanceof Spell) { String activateMessage = ((Spell) newStackObject).getActivatedMessage(game); if (activateMessage.startsWith(" casts ")) { activateMessage = activateMessage.substring(6); } game.informPlayers(controller.getLogName() + activateMessage); } } return true; } return false; } }
Spell spell = game.getStack().getSpell(source.getSourceId()); if (spell != null) { StackObject newStackObject = spell.createCopyOnStack(game, source, player.getId(), true); if (newStackObject instanceof Spell) { String activateMessage = ((Spell) newStackObject).getActivatedMessage(game);
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { Spell spell = (Spell) this.getValue("ReplicateSpell"); int replicateCount = (Integer) this.getValue("ReplicateCount"); if (spell != null && replicateCount > 0) { // reset replicate now so the copies don't report x times Replicate Card card = game.getCard(spell.getSourceId()); if (card != null) { for (Ability ability : card.getAbilities(game)) { if (ability instanceof ReplicateAbility) { if (((ReplicateAbility) ability).isActivated()) { ((ReplicateAbility) ability).resetReplicate(); } } } } // create the copies for (int i = 0; i < replicateCount; i++) { StackObject newStackObject = spell.createCopyOnStack(game, source, source.getControllerId(), true); if (newStackObject instanceof Spell && !game.isSimulation()) { game.informPlayers(controller.getLogName() + ((Spell) newStackObject).getActivatedMessage(game)); } } return true; } } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { UUID targetId = source.getFirstTarget(); Player affectedPlayer = game.getPlayer(targetId); if (affectedPlayer != null) { Effect effect = new DiscardTargetEffect(2); effect.setTargetPointer(new FixedTarget(targetId)); effect.apply(game, source); if (affectedPlayer.chooseUse(Outcome.Copy, "Copy the spell?", source, game)) { Spell spell = game.getStack().getSpell(source.getSourceId()); if (spell != null) { spell.createCopyOnStack(game, source, affectedPlayer.getId(), true); game.informPlayers(affectedPlayer.getLogName() + " copies " + spell.getName() + '.'); } } return true; } } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { UUID targetId = source.getFirstTarget(); Permanent permanent = game.getPermanent(targetId); if (permanent != null) { Player affectedPlayer = game.getPlayer(permanent.getControllerId()); if (affectedPlayer != null) { Effect effect = new DestroyTargetEffect(); effect.setTargetPointer(new FixedTarget(targetId)); effect.apply(game, source); if (affectedPlayer.chooseUse(Outcome.Copy, "Copy the spell?", source, game)) { Spell spell = game.getStack().getSpell(source.getSourceId()); if (spell != null) { spell.createCopyOnStack(game, source, affectedPlayer.getId(), true); game.informPlayers(affectedPlayer.getLogName() + " copies " + spell.getName() + '.'); } } return true; } } } return false; } }
Spell spell = game.getStack().getSpell(source.getSourceId()); if (spell != null) { spell.createCopyOnStack(game, source, affectedPlayer.getId(), true); game.informPlayers(affectedPlayer.getLogName() + " copies " + spell.getName() + '.');
Spell spell = game.getStack().getSpell(source.getSourceId()); if (spell != null) { spell.createCopyOnStack(game, source, affectedPlayer.getId(), true); game.informPlayers(affectedPlayer.getLogName() + " copies " + spell.getName() + '.');