Skip to content

Commit

Permalink
Refactored progress battle and adventure code
Browse files Browse the repository at this point in the history
Signed-off-by: Ole Herman Schumacher Elgesem <oleherman93@gmail.com>
  • Loading branch information
olehermanse committed Jun 9, 2019
1 parent 19bf2e9 commit a1c0e62
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions mrpg/core/game.py
Expand Up @@ -96,10 +96,12 @@ def battle_menu_choice(self, choice):
self.battle.b.ai()
assert self.battle.turn is None
self.battle.turn = Turn(self.battle)
self.progress_battle()
self.progress()

def progress_battle(self):
if self.battle.is_over():
def progress(self):
if self.adventure and not self.battle:
self.progress_adventure()
elif self.battle.is_over():
self.end_battle()
elif self.battle.turn:
try:
Expand Down Expand Up @@ -128,7 +130,7 @@ def end_battle(self):
self.put_output(out)

if self.adventure:
self.progress_adventure()
self.progress()
else:
self.set_state(State.GAME_MENU)

Expand Down
2 changes: 1 addition & 1 deletion mrpg/gui/controller.py
Expand Up @@ -75,7 +75,7 @@ def progress_to_output(self):
if output:
return output
while self.game.battle and self.game.battle.turn:
self.game.progress_battle()
self.game.progress()
output = self.resolve_to_output()
if output:
return output
Expand Down

0 comments on commit a1c0e62

Please sign in to comment.