define the skeleton of the battle royale game
This commit is contained in:
20
entities/player.py
Normal file
20
entities/player.py
Normal 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
|
||||
Reference in New Issue
Block a user