@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);
    }
  }
Exemplo n.º 2
0
 @Override
 public void executePostHandler(
     final FfFightCommand command,
     final ResolvationData resolvationData,
     final FightRoundResult[] results,
     final BasicEnemyPrePostFightDataContainer data) {
   final int[] randomNumber = getGenerator().getRandomNumber(1);
   final String dice = getRenderer().render(getGenerator().getDefaultDiceSide(), randomNumber);
   final FightCommandMessageList messages = command.getMessages();
   messages.addKey("page.ff.label.random.after", dice, randomNumber[0]);
   final Ff20Character character = (Ff20Character) resolvationData.getCharacter();
   if (randomNumber[0] < LUCK_LOWER_LIMIT) {
     character.changeStamina(STAMINA_EXTRA_DEDUCTION);
     messages.addKey("page.ff20.fight.daioni.stamina");
   } else if (randomNumber[0] > LUCK_UPPER_LIMIT) {
     character.changeSkill(SKILL_EXTRA_DEDUCTION);
     messages.addKey("page.ff20.fight.daioni.skill");
   } else {
     character.changeLuck(LUCK_EXTRA_DEDUCTION);
     messages.addKey("page.ff20.fight.daioni.luck");
   }
 }