Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into littleViewImprov…
Browse files Browse the repository at this point in the history
…ements
  • Loading branch information
AngeloFilaseta committed Sep 10, 2021
2 parents bd8965c + e0014f2 commit b9acf8a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ object BattleController {
override def attemptEscape(): Unit = {
if (escapeCondition){
battleFirstRound = true
storyModel.currentStoryNode.enemy.get.properties.health.currentPS = 0
battleView.escapeResult()
} else {
battleView.escapeResult(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,17 @@ object InventoryController {
* Defines the actions to do when the Controller execution is over.
*/
override def close(): Unit = {
if(targets().size == 1) {
gameMasterController.executeOperation(OperationType.StoryOperation)
} else {
if(currentlyInBattle()) {
gameMasterController.executeOperation(OperationType.BattleOperation)
} else {
gameMasterController.executeOperation(OperationType.StoryOperation)
}
}

private def currentlyInBattle(): Boolean =
targets().size > 1 &&
storyModel.currentStoryNode.enemy.get.properties.health.currentPS > 0

/**
* @return the list of all the possible targets.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ private[inventoryPanel] object InventoryPanelButtons {
SqSwingButton(
useButtonName,
useButtonActionListener, item match {
case _: EquipItem => inventoryController.targets().size == 1
case _: KeyItem => false
case _ => true
})
Expand Down

0 comments on commit b9acf8a

Please sign in to comment.