From 218b4bc5488093a7846e7b873a7373c2dd59be7a Mon Sep 17 00:00:00 2001 From: BowsiePup <34384474+BowsiePup@users.noreply.github.com> Date: Sun, 12 Jun 2022 03:17:13 -0400 Subject: [PATCH] Add money gained to display --- src/__main__.py | 2 + src/config/maps/darkcastle/easy.json | 94 ++++++++++++++++++---------- src/config/maps/logs/easy.json | 41 +++++++++--- src/utils/Console.py | 11 +++- 4 files changed, 105 insertions(+), 43 deletions(-) diff --git a/src/__main__.py b/src/__main__.py index 16d692d..bbf36c5 100644 --- a/src/__main__.py +++ b/src/__main__.py @@ -60,6 +60,7 @@ if gameResult == True: console.wins += 1 + console.moneyGenerated += map_settings["moneyPerGame"] else: console.loss += 1 console.gamesPlayed += 1 @@ -70,3 +71,4 @@ except Exception as e: print(f"An error has occured:") raise e + exit() diff --git a/src/config/maps/darkcastle/easy.json b/src/config/maps/darkcastle/easy.json index 1b4068c..4985539 100644 --- a/src/config/maps/darkcastle/easy.json +++ b/src/config/maps/darkcastle/easy.json @@ -1,37 +1,65 @@ { - "towers": { - "obyn": { - "hotkey": "u", - "coords": [570, 480], - "name": "Obyn" - }, - "dart": { - "hotkey": "q", - "coords": [590, 610], - "name": "Dart Monkey" - }, - "sub": { - "hotkey": "x", - "coords": [1090, 430], - "name": "Monkey Sub" - } + "moneyPerGame": 60, + "towers": { + "obyn": { + "hotkey": "u", + "coords": [ + 570, + 480 + ], + "name": "Obyn" + }, + "dart": { + "hotkey": "q", + "coords": [ + 590, + 610 + ], + "name": "Dart Monkey" }, - "instructions": { - "1": [ - "start", - "place obyn", - "place dart", - "sleep 1", - "upgrade dart 0-0-2" + "sub": { + "hotkey": "x", + "coords": [ + 1090, + 430 ], - "3": ["place sub"], - "7": ["upgrade sub 2-0-0"], - "9": ["upgrade sub 2-0-1"], - "14": ["upgrade sub 2-0-2"], - "18": ["upgrade sub 2-0-3"], - "28": ["upgrade sub 2-0-4"], - "34": ["upgrade dart 0-2-2"], - "38": ["upgrade dart 0-2-4"], - "40": ["restart"] + "name": "Monkey Sub" } -} + }, + "instructions": { + "1": [ + "start", + "place obyn", + "place dart", + "sleep 1", + "upgrade dart 0-0-2" + ], + "3": [ + "place sub" + ], + "7": [ + "upgrade sub 2-0-0" + ], + "9": [ + "upgrade sub 2-0-1" + ], + "14": [ + "upgrade sub 2-0-2" + ], + "18": [ + "upgrade sub 2-0-3" + ], + "28": [ + "upgrade sub 2-0-4" + ], + "34": [ + "upgrade dart 0-2-2" + ], + "38": [ + "upgrade dart 0-2-4" + ], + "40": [ + "restart" + ] + } +} \ No newline at end of file diff --git a/src/config/maps/logs/easy.json b/src/config/maps/logs/easy.json index bbc241e..db81a75 100644 --- a/src/config/maps/logs/easy.json +++ b/src/config/maps/logs/easy.json @@ -1,23 +1,37 @@ { + "moneyPerGame": 30, "towers": { "obyn": { "hotkey": "u", - "coords": [475, 460], + "coords": [ + 475, + 460 + ], "name": "Obyn" }, "dart": { "hotkey": "q", - "coords": [350, 460], + "coords": [ + 350, + 460 + ], "name": "Dart Monkey" }, "ninja": { "hotkey": "d", - "coords": [475, 525], + "coords": [ + 475, + 525 + ], "name": "Ninja Monkey" } }, "instructions": { - "1": ["place obyn", "place dart", "start"], + "1": [ + "place obyn", + "place dart", + "start" + ], "5": [ "place ninja", "sleep 2", @@ -25,9 +39,18 @@ "sleep 5", "upgrade ninja 2-0-0" ], - "10": ["sleep 5", "upgrade ninja 3-0-1"], - "30": ["upgrade ninja 4-0-2"], - "33": ["upgrade dart 0-2-4"], - "40": ["restart"] + "10": [ + "sleep 5", + "upgrade ninja 3-0-1" + ], + "30": [ + "upgrade ninja 4-0-2" + ], + "33": [ + "upgrade dart 0-2-4" + ], + "40": [ + "restart" + ] } -} +} \ No newline at end of file diff --git a/src/utils/Console.py b/src/utils/Console.py index 2b6e835..0ec4bbc 100644 --- a/src/utils/Console.py +++ b/src/utils/Console.py @@ -23,6 +23,7 @@ def __init__(self): self.__wins: int = 0 self.__loss: int = 0 self.__gamesPlayed: int = 0 + self.__moneyGenerated: int = 0 @property @@ -40,6 +41,14 @@ def loss(self) -> int: @loss.setter def loss(self, value: int): self.__loss = value + + @property + def moneyGenerated(self) -> int: + return self.__moneyGenerated + + @moneyGenerated.setter + def moneyGenerated(self, value: int): + self.__moneyGenerated = value @property def gamesPlayed(self) -> int: @@ -61,7 +70,7 @@ def welcome_screen(self): def show_stats(self): - print(f"Wins: {termColor.GREEN}{self.wins}\n{termColor.DEFAULT}Losses: {termColor.RED}{self.loss}\n{termColor.DEFAULT}Games Played: {termColor.YELLOW}{self.gamesPlayed}\n{self.screen_bar()}") + print(f"Wins: {termColor.GREEN}{self.wins}\n{termColor.DEFAULT}Losses: {termColor.RED}{self.loss}\n{termColor.DEFAULT}Games Played: {termColor.YELLOW}{self.gamesPlayed}\n{termColor.DEFAULT}Money Gained: {termColor.GREEN}{self.moneyGenerated}\n{self.screen_bar()}") def game_logs_below(self): print("Current Game Logs:")