コード例 #1
0
  private void attackWithCurrentMonster() {
    controllers.actorStatsController.useAPs(
        currentActiveMonster, currentActiveMonster.getAttackCost());

    combatTurnListeners.onMonsterIsAttacking(currentActiveMonster);
    AttackResult attack = monsterAttacks(currentActiveMonster);
    this.lastAttackResult = attack;

    if (attack.isHit) {
      combatActionListeners.onMonsterAttackSuccess(currentActiveMonster, attack);
      startAttackEffect(attack, world.model.player.position, this, CALLBACK_MONSTERATTACK);
    } else {
      combatActionListeners.onMonsterAttackMissed(currentActiveMonster, attack);
      startMissedEffect(attack, world.model.player.position, this, CALLBACK_MONSTERATTACK);
    }
  }
コード例 #2
0
 private boolean useAPs(int cost) {
   if (controllers.actorStatsController.useAPs(world.model.player, cost)) {
     return true;
   } else {
     combatActionListeners.onPlayerDoesNotHaveEnoughAP();
     return false;
   }
 }
コード例 #3
0
  private void executePlayerAttack() {
    if (controllers.effectController.isRunningVisualEffect()) return;
    if (!useAPs(world.model.player.getAttackCost())) return;
    final Monster target = world.model.uiSelections.selectedMonster;
    final Coord attackPosition = world.model.uiSelections.selectedPosition;

    final AttackResult attack = playerAttacks(target);
    this.lastAttackResult = attack;

    if (attack.isHit) {
      combatActionListeners.onPlayerAttackSuccess(target, attack);

      if (attack.targetDied) {
        playerKilledMonster(target);
      }

      startAttackEffect(attack, attackPosition, this, CALLBACK_PLAYERATTACK);
    } else {
      combatActionListeners.onPlayerAttackMissed(target, attack);
      startMissedEffect(attack, attackPosition, this, CALLBACK_PLAYERATTACK);
    }
  }
コード例 #4
0
  public void playerKilledMonster(Monster killedMonster) {
    final Player player = world.model.player;

    Loot loot = world.model.currentMap.getBagOrCreateAt(killedMonster.position);
    killedMonster.createLoot(loot, player);

    controllers.monsterSpawnController.remove(world.model.currentMap, killedMonster);
    controllers.effectController.addSplatter(world.model.currentMap, killedMonster);

    controllers.actorStatsController.addActorAP(
        player,
        player.getSkillLevel(SkillCollection.SkillID.cleave)
            * SkillCollection.PER_SKILLPOINT_INCREASE_CLEAVE_AP);
    controllers.actorStatsController.addActorHealth(
        player,
        player.getSkillLevel(SkillCollection.SkillID.eater)
            * SkillCollection.PER_SKILLPOINT_INCREASE_EATER_HEALTH);

    world.model.statistics.addMonsterKill(killedMonster.getMonsterTypeID());
    controllers.actorStatsController.addExperience(loot.exp);

    totalExpThisFight += loot.exp;
    loot.exp = 0;
    controllers.actorStatsController.applyKillEffectsToPlayer(player);

    if (!loot.hasItemsOrGold()) {
      world.model.currentMap.removeGroundLoot(loot);
    } else if (world.model.uiSelections.isInCombat) {
      killedMonsterBags.add(loot);
    }

    combatActionListeners.onPlayerKilledMonster(killedMonster);

    if (world.model.uiSelections.selectedMonster == killedMonster) {
      selectNextAggressiveMonster();
    }
  }
コード例 #5
0
 public void startFlee() {
   setCombatSelection(null, null);
   combatActionListeners.onPlayerStartedFleeing();
 }
コード例 #6
0
 private void fleeingFailed() {
   combatActionListeners.onPlayerFailedFleeing();
   endPlayerTurn();
 }