protected void printOutState(Game game) { if (logger.isInfoEnabled()) { printOutState(game, playerId); for (UUID opponentId : game.getOpponents(playerId)) { printOutState(game, opponentId); } } }
@Override public boolean applies(GameEvent event, Ability source, Game game) { if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) { Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); if (permanent != null && permanent.isCreature()) { return true; } } return false; }
@Override public boolean apply(Game game, Ability source) { for (UUID opponentId : game.getOpponents(source.getControllerId())) { Player opponent = game.getPlayer(opponentId); if (opponent != null) { opponent.loseLife(2, game, false); } } return true; }
@Override public boolean apply(Game game, Ability source) { Set<UUID> opponents = game.getOpponents(source.getControllerId()); for (UUID uuid : opponents) { if (game.getBattlefield().countAll(StaticFilters.FILTER_PERMANENT_CREATURE, uuid, game) >= 3) { return true; } } return false; } }
@Override public boolean applies(GameEvent event, Ability source, Game game) { if ((event.getType() == EventType.WINS && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) || (event.getType() == EventType.LOSES && event.getPlayerId().equals(source.getControllerId()))) { return true; } return false; }
@Override public boolean checkTrigger(GameEvent event, Game game) { if (game.getOpponents(this.controllerId).contains(event.getPlayerId())) { this.getEffects().get(0).setValue("damageAmount", event.getAmount()); return true; } return false; }
@Override public boolean applies(GameEvent event, Ability source, Game game) { if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) { Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); if (permanent != null && (permanent.isCreature() || permanent.isArtifact())) { return true; } } return false; }
@Override public boolean apply(Game game, Ability source) { for (UUID opponentId: game.getOpponents(source.getControllerId())) { Player player = game.getPlayer(opponentId); if (player != null) { player.loseLife(amount.calculate(game, source, this), game, false); } } return true; }
@Override public boolean apply(Game game, Ability source) { CastSpellLastTurnWatcher watcher = game.getState().getWatcher(CastSpellLastTurnWatcher.class); if (watcher != null) { for (UUID opponentId : game.getOpponents(source.getControllerId())) { if (watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(opponentId) > 2) { return true; } } } return false; }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { int amount = 0; Set<UUID> playerList = game.getOpponents(sourceAbility.getControllerId()); for (UUID playerUUID : playerList) { Player player = game.getPlayer(playerUUID); if (player != null) { amount += player.getCounters().getCount(CounterType.POISON); } } return amount; }
@Override public boolean apply(Game game, Ability source) { for (UUID opponentId : game.getOpponents(source.getControllerId())) { Token token = new SoldierToken(); token.putOntoBattlefield(1, game, source.getSourceId(), opponentId); } return true; } }
@Override public boolean checkTrigger(GameEvent event, Game game) { if (((ZoneChangeEvent)event).isDiesEvent()) { Permanent p = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); if (p != null && p.isCreature() && game.getOpponents(this.getControllerId()).contains(p.getControllerId())) { return true; } } return false; }
@Override public void init(Ability source, Game game) { super.init(source, game); if (this.affectedObjectsSet) { Set<UUID> opponents = game.getOpponents(source.getControllerId()); for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { if (opponents.contains(perm.getControllerId())) { affectedObjectList.add(new MageObjectReference(perm, game)); } } } }
@Override public boolean applies(Permanent permanent, Ability source, Game game) { if (permanent.hasAbility(FlyingAbility.getInstance().getId(), game) || permanent.hasAbility(ReachAbility.getInstance().getId(), game)) { return false; } return game.getOpponents(source.getControllerId()).contains(permanent.getControllerId()); }
@Override public boolean applies(Permanent permanent, Ability source, Game game) { if (game.isActivePlayer(permanent.getControllerId()) && game.getOpponents(source.getControllerId()).contains(permanent.getControllerId())) { CastSpellLastTurnWatcher watcher = game.getState().getWatcher(CastSpellLastTurnWatcher.class); if (watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(permanent.getControllerId()) > 0) { return true; } } return false; }
@Override public boolean applies(GameEvent event, Ability source, Game game) { if (game.isActivePlayer(event.getPlayerId()) && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) { PlayerAttackedWatcher watcher = game.getState().getWatcher(PlayerAttackedWatcher.class); if (watcher != null && watcher.getNumberOfAttackersCurrentTurn(event.getPlayerId()) > 0) { return true; } } return false; }
@Override public boolean applies(GameEvent event, Ability source, Game game) { if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) { ObjectColor chosenColor = (ObjectColor) game.getState().getValue(source.getSourceId() + "_color"); // spell is not on the stack yet, so we have to check the card Card card = game.getCard(event.getSourceId()); if (chosenColor != null && card != null && card.getColor(game).contains(chosenColor)) { return true; } } return false; }
@Override public boolean checkTrigger(GameEvent event, Game game) { if (game.getOpponents(controllerId).contains(event.getPlayerId())) { Card card = game.getCard(event.getSourceId()); if (card != null && card.isCreature()) { this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId())); return true; } } return false; }
@Override public boolean apply(Game game, Ability source) { int damage = 0; for (UUID opponentId: game.getOpponents(source.getControllerId())) { damage += game.getPlayer(opponentId).damage(3, source.getSourceId(), game, false, true); } game.getPlayer(source.getControllerId()).gainLife(damage, game, source); return true; }
@Override public boolean checkTrigger(GameEvent event, Game game) { ZoneChangeEvent zEvent = (ZoneChangeEvent) event; if (zEvent.getFromZone() == Zone.LIBRARY && zEvent.getToZone() == Zone.GRAVEYARD && game.getOpponents(this.getControllerId()).contains(zEvent.getPlayerId())) { Card card = game.getCard(event.getTargetId()); if (card != null && card.isCreature()) { this.getEffects().get(0).setTargetPointer(new FixedTarget(card.getId())); return true; } } return false; }