public void removeEocEffects(Game game) { effects.removeEndOfCombatEffects(); delayed.removeEndOfCombatAbilities(); game.applyEffects(); }
public void removeEotEffects(Game game) { effects.removeEndOfTurnEffects(); delayed.removeEndOfTurnAbilities(); game.applyEffects(); }
public void processAction(Game game) { game.getState().handleSimultaneousEvent(game); game.applyEffects(); }
@Override public void beginStep(Game game, UUID activePlayerId) { Player activePlayer = game.getPlayer(activePlayerId); //20091005 - 504.1/703.4c activePlayer.drawCards(1, game); // game.saveState(); game.applyEffects(); super.beginStep(game, activePlayerId); }
@Override public void beginStep(Game game, UUID activePlayerId) { super.beginStep(game, activePlayerId); Player activePlayer = game.getPlayer(activePlayerId); //20091005 - 502.1/703.4a activePlayer.phasing(game); //20091005 - 502.2/703.4b activePlayer.untap(game); game.applyEffects(); }
@Override public boolean transform(Game game) { if (transformable) { if (!replaceEvent(EventType.TRANSFORM, game)) { setTransformed(!transformed); game.applyEffects(); game.addSimultaneousEvent(GameEvent.getEvent(EventType.TRANSFORMED, getId(), getControllerId())); return true; } } return false; }
@Override public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Target target = new TargetPermanent(filter); if (target.choose(Outcome.GainControl, controllerId, sourceId, game)) { ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfGame); effect.setTargetPointer(new FixedTarget(target.getFirstTarget())); game.addEffect(effect, ability); game.applyEffects(); paid = true; } return paid; }
protected void addAbilityNode(SimulationNode2 parent, Ability ability, int depth, Game game) { Game sim = game.copy(); sim.getStack().push(new StackAbility(ability, playerId)); if (ability.activate(sim, false) && ability.isUsesStack()) { game.fireEvent(new GameEvent(GameEvent.EventType.TRIGGERED_ABILITY, ability.getId(), ability.getSourceId(), ability.getControllerId())); } sim.applyEffects(); SimulationNode2 newNode = new SimulationNode2(parent, sim, depth, playerId); logger.debug("simulating -- node #:" + SimulationNode2.getCount() + " triggered ability option"); for (Target target : ability.getTargets()) { for (UUID targetId : target.getTargets()) { newNode.getTargets().add(targetId); } } parent.children.add(newNode); }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); if (permanent != null) { Player player = game.getPlayer(permanent.getOwnerId()); if (player != null) { player.moveCardToLibraryWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD, true, true); player.shuffleLibrary(source, game); game.applyEffects(); // so effects from creatures that were on the battlefield won't trigger from draw player.drawCards(2, game); return true; } } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { int cardsHand = controller.getHand().size(); if (cardsHand > 0) { controller.moveCards(controller.getHand(), Zone.LIBRARY, source, game); controller.shuffleLibrary(source, game); game.applyEffects(); // then controller.drawCards(cardsHand, game); } return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (controller != null && permanent != null) { controller.moveCards(permanent, Zone.EXILED, source, game); game.applyEffects(); if (permanent.isPlaneswalker() && permanent.hasSubtype(SubType.GIDEON, game)) { controller.gainLife(5, game, source); } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source)); Player player = game.getPlayer(source.getControllerId()); if (permanent == null || player == null) { return false; } int creaturePower = permanent.getPower().getValue(); permanent.moveToExile(null, null, source.getSourceId(), game); game.applyEffects(); player.gainLife(creaturePower, game, source); return true; } }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source)); if (permanent != null) { Player player = game.getPlayer(permanent.getControllerId()); if (player != null) { int creaturePower = permanent.getPower().getValue(); permanent.moveToExile(null, null, source.getSourceId(), game); game.applyEffects(); player.gainLife(creaturePower, game, source); } return true; } return false; } }
protected static void simulateStep(Game game, Step step) { game.getPhase().setStep(step); if (!step.skipStep(game, game.getActivePlayerId())) { step.beginStep(game, game.getActivePlayerId()); // The following commented out call produces random freezes. //game.checkStateAndTriggered(); while (!game.getStack().isEmpty()) { game.getStack().resolve(game); game.applyEffects(); } step.endStep(game, game.getActivePlayerId()); } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { controller.moveCards(controller.getGraveyard().getCards(filterZombie, game), Zone.BATTLEFIELD, source, game, true, false, false, null); game.applyEffects(); for (Permanent permanent : game.getBattlefield().getActivePermanents( new FilterPermanent(SubType.HUMAN, "Humans"), source.getControllerId(), game)) { permanent.destroy(source.getSourceId(), game, false); } return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player targetOpponent = game.getPlayer(getTargetPointer().getFirst(game, source)); if (targetOpponent != null) { int powerSum = 0; for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getSourceId(), game)) { permanent.destroy(source.getSourceId(), game, false); powerSum += permanent.getPower().getValue(); } game.applyEffects(); targetOpponent.damage(powerSum, source.getSourceId(), game, false, true); } return true; } }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (player != null && permanent != null) { permanent.destroy(source.getSourceId(), game, true); game.applyEffects(); if (permanent.getColor(game).isBlack() || permanent.getColor(game).isBlue()) { player.drawCards(1, game); } return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (player != null && permanent != null) { permanent.destroy(source.getSourceId(), game, true); game.applyEffects(); if (permanent.isPlaneswalker() && permanent.hasSubtype(SubType.LILIANA, game)) { Player permanentController = game.getPlayer(permanent.getControllerId()); if (permanentController != null) { permanentController.loseLife(3, game, false); } } return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { SacrificeTargetCost cost = new SacrificeTargetCost(new TargetControlledCreaturePermanent(FILTER_CONTROLLED_CREATURE_SHORT_TEXT)); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { game.applyEffects(); // To end effects of the sacrificed creature controller.moveCards(new CardsImpl(getTargetPointer().getTargets(game, source)).getCards(game), Zone.BATTLEFIELD, source, game, true, false, false, null); } return true; } return false; } }
@Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { Card card = game.getCard(event.getTargetId()); if (card != null) { if (controller.moveCardToExileWithInfo(card, source.getSourceId(), "Madness", source.getSourceId(), game, ((ZoneChangeEvent) event).getFromZone(), true)) { game.applyEffects(); // needed to add Madness ability to cards (e.g. by Falkenrath Gorger) GameEvent gameEvent = GameEvent.getEvent(GameEvent.EventType.MADNESS_CARD_EXILED, card.getId(), source.getOriginalId(), controller.getId()); game.fireEvent(gameEvent); } return true; } } return false; }