コード例 #1
0
 private void fixEnemy() {
   notSelectedEnemy.setStaminaAutoDamage(0);
   notSelectedEnemy.setStaminaDamageWhileInactive(0);
   selectedEnemy.setStaminaAutoDamage(0);
   selectedEnemy.setKillableByNormal(true);
   selectedEnemy.setKillableByMagical(true);
   selectedEnemy.setKillableByBlessed(true);
   selectedEnemy.setStamina(3);
   selectedEnemy.setDamageAbsorptionEdged(0);
 }
コード例 #2
0
 public void
     testResolveRoundWhenSingleMagicalEnemyIsHitWithMagicalWeaponShouldCauseDamageAndReturnRoundResultWithWin() {
   // GIVEN
   enemies.add(selectedEnemy);
   command.getResolvedEnemies().addAll(enemies);
   selectedEnemy.setKillableByNormal(false);
   selectedEnemy.setKillableByBlessed(false);
   expect(interactionHandler.peekLastFightCommand(character, "enemyId")).andReturn("9");
   expect(generator.getRandomNumber(2)).andReturn(SELF_ATTACK_STRENGTH_ROLL);
   expect(attributeHandler.resolveValue(character, "attackStrength")).andReturn(0);
   expect(generator.getRandomNumber(2)).andReturn(ENEMY_ATTACK_STRENGTH_ROLL);
   expect(attributeHandler.resolveValue(character, "skill")).andReturn(10);
   expect(diceResultRenderer.render(6, SELF_ATTACK_STRENGTH_ROLL))
       .andReturn(SELF_ATTACK_STRENGTH_RENDER);
   expectText(
       "page.ff.label.fight.single.attackStrength.self",
       new Object[] {SELF_ATTACK_STRENGTH_RENDER, 17});
   logger.debug("Attack strength for self: {}", 17);
   expect(diceResultRenderer.render(6, ENEMY_ATTACK_STRENGTH_ROLL))
       .andReturn(ENEMY_ATTACK_STRENGTH_RENDER);
   expectText(
       "page.ff.label.fight.single.attackStrength.enemy",
       new Object[] {"Goblin", ENEMY_ATTACK_STRENGTH_RENDER, 15});
   logger.debug("Attack strength for {}: {}", "Goblin", 15);
   final FfItem weapon = new FfItem("7", "Sword", ItemType.weapon1);
   weapon.setMagical(true);
   weapon.setStaminaDamage(3);
   expect(itemHandler.getEquippedWeapon(character)).andReturn(weapon).times(2);
   expect(attributeHandler.resolveValue(character, "baseStaminaDamage")).andReturn(0);
   expectText("page.ff.label.fight.single.successfulAttack", new Object[] {"Goblin"});
   mockControl.replay();
   // WHEN
   final FightRoundResult[] returned =
       underTest.resolveRound(command, resolvationData, beforeRoundResult);
   // THEN
   Assert.assertEquals(returned.length, 1);
   Assert.assertEquals(returned[0], FightRoundResult.WIN);
 }