protected void logLife(Game game) { StringBuilder sb = new StringBuilder(); sb.append(game.getTurn().getValue(game.getTurnNum())); for (Player player: game.getPlayers().values()) { sb.append("[player ").append(player.getName()).append(':').append(player.getLife()).append(']'); } logger.info(sb.toString()); }
@Override public void selectAttackers(Game game, UUID attackingPlayerId) { StringBuilder sb = new StringBuilder(); sb.append(game.getTurn().getValue(game.getTurnNum())).append(" player ").append(name).append(" attacking with: "); getNextAction(game, NextAction.SELECT_ATTACKERS); Combat combat = root.getCombat(); UUID opponentId = game.getCombat().getDefenders().iterator().next(); for (UUID attackerId: combat.getAttackers()) { this.declareAttacker(attackerId, opponentId, game, false); sb.append(game.getPermanent(attackerId).getName()).append(','); } logger.info(sb.toString()); MCTSNode.logHitMiss(); }
@Override public boolean apply(Game game, Ability source) { return !game.getTurn().isDeclareAttackersStepStarted(); }
@Override public boolean apply(Game game, Ability source) { return turnPhase == game.getTurn().getPhaseType(); }
@Override public boolean checkInterveningIfClause(Game game) { return game.getTurn().getPhase(TurnPhase.COMBAT).getCount() == 0; }
@Override public boolean apply(Game game, Ability source) { if (game.isActivePlayer(source.getControllerId())) { TurnPhase turnPhase = game.getTurn().getPhase().getType(); if (turnPhase == TurnPhase.BEGINNING || turnPhase == TurnPhase.PRECOMBAT_MAIN) { return true; } if (turnPhase == TurnPhase.COMBAT) { return !game.getTurn().isDeclareAttackersStepStarted(); } } return false; }
@Override public boolean apply(Game game, Ability source) { return game.getStack().isEmpty() && turnPhases.contains(game.getTurn().getPhase().getType()); }
@Override public boolean apply(Game game, Ability source) { return game.isActivePlayer(source.getControllerId()) && turnPhases.contains(game.getTurn().getPhase().getType()); } }
@Override public boolean applies(GameEvent event, Ability source, Game game) { return source.isControlledBy(event.getPlayerId()) && game.getTurn().getStepType() == PhaseStep.DRAW; }
@Override public void beginStep(Game game, UUID activePlayerId) { super.beginStep(game, activePlayerId); game.getTurn().setDeclareAttackersStepStarted(true); game.getCombat().selectAttackers(game); }
@Override public boolean applies(GameEvent event, Ability source, Game game) { // has to return true, if the spell cannot be cast in the current phase / step if (event.getSourceId().equals(source.getSourceId())) { if ((turnPhase != null && game.getPhase().getType() != turnPhase) || (phaseStep != null && (game.getTurn().getStepType() != phaseStep)) || (condition != null && !condition.apply(game, source))) { return true; } } return false; // cast not prevented by this effect }
@Override public boolean applies(GameEvent event, Ability source, Game game) { if (game.getTurn().getStepType() == PhaseStep.UNTAP) { for (UUID targetId : targetPointer.getTargets(game, source)) { if (event.getTargetId().equals(targetId)) { Permanent permanent = game.getPermanent(targetId); if (permanent != null && game.isActivePlayer(permanent.getControllerId())) { return true; } } } } return false; }
@Override public boolean applies(GameEvent event, Ability source, Game game) { if (game.getTurn().getStepType() == PhaseStep.UNTAP && event.getTargetId().equals(source.getSourceId())) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null && permanent.isControlledBy(game.getActivePlayerId())) { return true; } } return false; }
@Override public boolean applies(GameEvent event, Ability source, Game game) { // prevent untap event of creatures of target player if (game.getTurn().getStepType() == PhaseStep.UNTAP) { Permanent permanent = game.getPermanent(event.getTargetId()); if (permanent != null && permanent.isControlledBy(targetPlayerId) && filter.match(permanent, game)) { return true; } } return false; }
@Override public boolean apply(Game game, Ability source) { if (!game.isActivePlayer(source.getControllerId()) || !turnPhases.contains(game.getTurn().getPhase().getType())) { return false; } if (CastFromEverywhereSourceCondition.instance.apply(game, source)) { return true; } Spell spell = game.getSpell(source.getSourceId()); return spell != null && !spell.isCopy(); } }
@Override public boolean applies(GameEvent event, Ability source, Game game) { if (game.getTurn().getStepType() == PhaseStep.UNTAP) { Permanent equipment = game.getPermanent(source.getSourceId()); if (equipment != null && equipment.getAttachedTo() != null) { Permanent equipped = game.getPermanent(equipment.getAttachedTo()); if (equipped.getId().equals(event.getTargetId())) { return true; } } } return false; } }
@Override public boolean applies(GameEvent event, Ability source, Game game) { if (game.getTurn().getStepType() == PhaseStep.UNTAP) { Permanent equipment = game.getPermanent(source.getSourceId()); if (equipment != null && equipment.getAttachedTo() != null) { Permanent equipped = game.getPermanent(equipment.getAttachedTo()); if (equipped.getId().equals(event.getTargetId())) { return true; } } } return false; } }
@Override public boolean applies(GameEvent event, Ability source, Game game) { if (game.getTurn().getStepType() == PhaseStep.UNTAP) { Permanent enchantment = game.getPermanent(source.getSourceId()); if (enchantment != null && enchantment.getAttachedTo() != null && event.getTargetId().equals(enchantment.getAttachedTo())) { Permanent permanent = game.getPermanent(enchantment.getAttachedTo()); if (permanent != null && permanent.isControlledBy(game.getActivePlayerId())) { return true; } } } return false; }