define the skeleton of the battle royale game

This commit is contained in:
andrea
2025-07-23 19:54:39 +02:00
parent 86c7f7ae48
commit 0694ae0cae
4 changed files with 126 additions and 0 deletions

20
entities/player.py Normal file
View File

@@ -0,0 +1,20 @@
import random as _random
class BrSimPlayer():
def __init__(self, name, inventory= None):
self.name= name
self.health= 1
self.inventory= inventory or []
self.damage= 1 # this is the punch damage amount
self.max_weight= 5 # this is the max inventory weight
self.is_alive= True
self.agility= 10 # chance to avoid an hit
def is_alive(self):
return self.is_alive
def try_to_avoid_hit(self):
rnd= _random.randint(0, 100)
if rnd > self.agility: return True
return False