forked from Cryz/battle_royale_sim
32 lines
785 B
Python
32 lines
785 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
|
|
|
|
def steal(self):
|
|
#XXX can steal from death players or from sleeping players
|
|
pass
|
|
|
|
def heal(self):
|
|
#XXX if you have a wound and you have a medikit item, you can heal your wound or sickness
|
|
pass
|
|
|
|
def get_inventory(self):
|
|
return self.inventory
|