-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlayer.py
54 lines (41 loc) · 1.37 KB
/
Player.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import Drone
from Tile import Tile
STARTING_WEALTH = 10000
DRONE_BUY_PRICE = 250
DRONE_SELL_PRICE = 100
AUTOCLICKER_BUY_PRICE = 1000
class Player:
def __init__(self, HQ_tile: Tile):
self.HQ_tile = HQ_tile
self.wealth = STARTING_WEALTH
self.drone_count = 0
self.autoclicker = 0
self.drones = []
def increaseWealth(self, count: int) -> None:
self.wealth += count
def reduceWealth(self, count: int) -> None:
self.wealth -= count
def addDrone(self) -> None:
self.drones.append(Drone.Drone(self.HQ_tile, 10))
self.drone_count += 1
def addAutoclicker(self) -> None:
self.autoclicker += 1
def purchaseAutoclicker(self) -> bool:
if self.canAffordAutoclicker():
self.addAutoclicker()
self.reduceWealth(AUTOCLICKER_BUY_PRICE)
return True
return False
def removeDrone(self) -> None:
self.drones.pop()
self.drone_count -= 1
def canAffordAutoclicker(self) -> bool:
return self.wealth >= AUTOCLICKER_BUY_PRICE
def canAffordDrone(self) -> bool:
return self.wealth >= DRONE_BUY_PRICE
def sellDrone(self) -> None:
self.increaseWealth(DRONE_SELL_PRICE)
def purchaseDrone(self) -> None:
if self.canAffordDrone():
self.reduceWealth(DRONE_BUY_PRICE)
self.addDrone()