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); } }
private boolean useAPs(int cost) { if (controllers.actorStatsController.useAPs(world.model.player, cost)) { return true; } else { combatActionListeners.onPlayerDoesNotHaveEnoughAP(); return false; } }
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); } }
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(); } }
public void startFlee() { setCombatSelection(null, null); combatActionListeners.onPlayerStartedFleeing(); }
private void fleeingFailed() { combatActionListeners.onPlayerFailedFleeing(); endPlayerTurn(); }