@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; }
@Override public ParagraphData resolve( final ItemCheckCommand parent, final ResolvationData resolvationData) { ParagraphData toResolve; if (resolvationData .getCharacterHandler() .getParagraphHandler() .visitedParagraph(resolvationData.getCharacter(), parent.getId())) { toResolve = parent.getHave(); } else { toResolve = parent.getDontHave(); } return toResolve; }
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); } }
public void testExecutePostHandlerShouldKillEnemiesAndAddMarkerItem() { // GIVEN final ImmutableMap<String, Enemy> enemiesMap = ImmutableMap.of("7", (Enemy) captain, "8", elvira); expect(resolvationData.getEnemies()).andReturn(enemiesMap); captain.setStamina(0); elvira.setStamina(0); expect(resolvationData.getCharacterHandler()).andReturn(characterHandler); expect(characterHandler.getItemHandler()).andReturn(itemHandler); expect(resolvationData.getCharacter()).andReturn(character); expect(itemHandler.addItem(character, "4001", 1)).andReturn(1); mockControl.replay(); // WHEN underTest.executePostHandler(command, resolvationData, results, data); // THEN }
@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"); } }
private boolean shipIsDestroyed(final ResolvationData resolvationData) { final Ff15Character character = (Ff15Character) resolvationData.getCharacter(); return character.getShipAttributes().getShield() <= 0; }
@BeforeClass public void setUpClass() { resolvationData.setCharacter(character); character.getCodeWords().addAll(Sets.newHashSet("ship")); }