Skip to content

Commit

Permalink
Add money gained to display
Browse files Browse the repository at this point in the history
  • Loading branch information
BowsiePup committed Jun 12, 2022
1 parent 135e3a3 commit 218b4bc
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 43 deletions.
2 changes: 2 additions & 0 deletions src/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@

if gameResult == True:
console.wins += 1
console.moneyGenerated += map_settings["moneyPerGame"]
else:
console.loss += 1
console.gamesPlayed += 1
Expand All @@ -70,3 +71,4 @@
except Exception as e:
print(f"An error has occured:")
raise e
exit()
94 changes: 61 additions & 33 deletions src/config/maps/darkcastle/easy.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
}
41 changes: 32 additions & 9 deletions src/config/maps/logs/easy.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,56 @@
{
"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",
"upgrade ninja 1-0-0",
"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"
]
}
}
}
11 changes: 10 additions & 1 deletion src/utils/Console.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def __init__(self):
self.__wins: int = 0
self.__loss: int = 0
self.__gamesPlayed: int = 0
self.__moneyGenerated: int = 0


@property
Expand All @@ -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:
Expand All @@ -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:")
Expand Down

0 comments on commit 218b4bc

Please sign in to comment.