-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathplayer.py
33 lines (25 loc) · 883 Bytes
/
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
from __future__ import annotations
from datetime import datetime
from typing import Any
from telegram import User
class Player:
"""A player already in a game"""
def __init__(self, user: User):
self.id = user.id
self.user = user
self.is_ai = False
# the player will pay kora if is_koratable is True
self.is_koratable = True
self.is_controller = False
# money lost or won, (negative if lost)
self.nkap = 0
# points lost or won, (negative if lost)
self.points = 0
# achievements obtained
self.achievements: list[str] = []
self.hand_of_cards: list[Any] = []
self.turn_started_time = datetime.now()
def __eq__(self, p: object) -> bool:
if not isinstance(p, Player):
return NotImplemented
return str(object=self.id) == str(p.id)