@Override protected void handleAttacking( final FfFightCommand command, final ResolvationData resolvationData, final List<ParagraphData> resolveList) { command.increaseBattleRound(); command.getMessages().setRoundMessage(command.getRoundNumber()); final FfFightRoundResolver roundResolver = getBeanFactory().getBean(Ship15FightRoundResolver.class); roundResolver.resolveRound(command, resolvationData, null); if (allEnemiesDead(command.getResolvedEnemies())) { command.setOngoing(false); for (final FightOutcome outcome : command.getWin()) { if (command.getRoundNumber() >= outcome.getMin() && command.getRoundNumber() <= outcome.getMax()) { resolveList.add(outcome.getParagraphData()); } } } else if (shipIsDestroyed(resolvationData)) { command.setOngoing(false); resolveList.add(command.getLose()); } else { command.setOngoing(true); command.setKeepOpen(true); } }
@Override public List<ParagraphData> doResolve( final FfFightCommand command, final ResolvationData resolvationData) { final List<ParagraphData> resolveList = new ArrayList<>(); resolveBattlingParties(command, resolvationData, null); final FfCharacterHandler characterHandler = (FfCharacterHandler) resolvationData.getCharacterHandler(); command.setOngoing(true); resolveBattleRound(command, resolvationData, resolveList); characterHandler .getAttributeHandler() .sanityCheck((FfCharacter) resolvationData.getCharacter()); resolveBattlingParties(command, resolvationData, resolveList); return resolveList; }
private void resolveBattleRound( final FfFightCommand command, final ResolvationData resolvationData, final List<ParagraphData> resolveList) { final FfCharacter character = (FfCharacter) resolvationData.getCharacter(); final FfCharacterHandler characterHandler = (FfCharacterHandler) resolvationData.getCharacterHandler(); final String lastFightCommand = characterHandler.getInteractionHandler().getLastFightCommand(character); if (FfFightCommand.ATTACKING.equals(lastFightCommand)) { handleAttacking(command, resolvationData, resolveList); } else { command.setBattleType("ff15ship"); command.setOngoing(true); } }