1
0
Files
battle_royale_sim/entities/player.py
2025-07-23 19:54:39 +02:00

21 lines
517 B
Python

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