Skip to content

Commit

Permalink
Merge pull request #87 from AngeloFilaseta/littleViewImprovements
Browse files Browse the repository at this point in the history
Solved battle bug where victory does not redirect to story
  • Loading branch information
Tale152 committed Sep 11, 2021
2 parents fe56f87 + 074bbf7 commit 1752116
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,8 @@ object BattleController {
enemyAttack()
playerAttack()
}
setOpponentsInfo()
battleView.narrative(roundNarrative)
battleView.render()

//battleView.narrative(roundNarrative)
}

private def enemyAttack(): Unit = {
Expand Down Expand Up @@ -127,9 +126,11 @@ object BattleController {
} else if (enemy.properties.health.currentPS == 0){
battleFirstRound = true
battleView.battleResult()
} else {
setOpponentsInfo()
battleView.narrative(roundNarrative)
battleView.render()
}
battleView.narrative(roundNarrative)
battleView.render()
}

private def setOpponentsInfo(): Unit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ object StoryController {

override def goToInventory(): Unit = gameMasterController.executeOperation(OperationType.InventoryOperation)

private def redirect(): Unit = if (storyModel.currentStoryNode.enemy.isEmpty) this.execute() else goToBattle()
private def redirect(): Unit =
if (storyModel.currentStoryNode.enemy.isEmpty) this.execute() else goToBattle()

private def goToBattle(): Unit = gameMasterController.executeOperation(OperationType.BattleOperation)

Expand All @@ -112,7 +113,7 @@ object StoryController {
}

/**
* @param statName The name of the stat to consider.
* @param statName The name of the stat to consider.
* @param statModifierStrategy The strategy to apply last.
* @return the difference between the stat value before and after the application of statModifierStrategy
* formatted with + or - sign.
Expand All @@ -122,7 +123,7 @@ object StoryController {
val modifiedStatValue = storyModel.player.properties.statModifiers.filter(s => s.statName == statName)
.foldLeft(originalStatValue)((o, m) => m.modifyStrategy(o))
val difference = statModifierStrategy(modifiedStatValue) - modifiedStatValue
if(difference >= 0){
if (difference >= 0) {
"+" + difference
} else {
difference.toString
Expand Down

0 comments on commit 1752116

Please sign in to comment.