add kills counter random agility for each player and random init players

This commit is contained in:
andrea
2025-07-26 15:20:03 +02:00
parent 67804a394d
commit 4ce19d1a50
5 changed files with 74 additions and 17 deletions

View File

@@ -10,7 +10,7 @@ class BrSimPlayer():
self.inventory= inventory or []
self.damage= 1 # this is the punch damage amount
self.max_weight= 5 # this is the max inventory weight
self.agility= 10 # chance to avoid an hit
self.agility= _random.randint(5,30) # chance to avoid an hit
self.kills= 0 # track the number of kills
self.survived_days= 0 # track the number of the survived days
self.equipped_weapon= None
@@ -78,6 +78,9 @@ class BrSimPlayer():
def is_alive(self):
return self.health > 0
def get_kills(self):
return self.kills
### player actions
def _equip_weapon(self):
@@ -122,7 +125,8 @@ class BrSimPlayer():
msg= f'Ehhhh voleviiii!!! sei lent##! {target.get_name()} schiva il colpo di {self.get_name()}'
return 0, msg
target.accuses_damage(self.damage)
msg= f'{self.get_name()} Colpisce {target.get_name()} in nome di Guarino'
msg= f'{self.get_name()} Colpisce {target.get_name()}'
self.kills+= 1
return self.damage, msg
def get_item(self, item):