1
0

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

31
entities/weapons.py Normal file
View File

@@ -0,0 +1,31 @@
import random as _random
from entities import weapon_syms as _syms
class BrSimPlayer():
def __init__(self, wtype):
self.weapon= _syms.WEAPONS[wtype]
self.name= self.weapon['name']
self.damage= self.weapon['damage']
self.weight= self.weapon['weight']
self.range= self.weapon['range']
self.ammons= self.weapon['ammons']
self.miss_chance= self.weapon['miss_chance']
def _ammons_check(self):
if self.ammons == -1: return True # this weapons doesn't needs ammons
return self.ammons > 0
def _try_to_hit(self):
if not self.miss_chance: return True
rnd= _random.randint(0, 100)
if rnd > self.miss_chance: return True
return False
def hit(self, hits= 1):
if not _ammons_check: return 0
if not _try_to_hit(): return 0
return self.damage
def add_ammons(self, ammons):
self.ammons+= ammons