forked from Cryz/battle_royale_sim
telegram bot more commands, and use the debug function to start a first day iteration
This commit is contained in:
@@ -8,11 +8,21 @@ class BrSimArena():
|
||||
# players = [{'name': name, 'inventory': default_inventory, other_stats}]
|
||||
# weapons = [{WEAPON.KNIFE: quantity}, etc...] # this is the whole quantity of the items available on the world
|
||||
|
||||
def __init__(self, players, weapons):
|
||||
def __init__(self, players= None, weapons= None):
|
||||
self.day= 1
|
||||
self.players= [_player.BrSimPlayer(p['name'], p.get('inventory')) for p in players]
|
||||
self.players= []
|
||||
self.weapons= []
|
||||
self.eventClass = _events.ArenaEventPicker(self.players)
|
||||
self.init_players(players)
|
||||
self.init_weapons(weapons)
|
||||
|
||||
def init_players(self, players):
|
||||
if not players: return
|
||||
for player in players:
|
||||
self.add_player(player['name'], player.get('inventory'))
|
||||
|
||||
def init_weapons(self, weapons):
|
||||
if not weapons: return
|
||||
for weapon in weapons:
|
||||
for wtype, quantity in weapon.items():
|
||||
for i in range(quantity): self.weapons.append(_weapons.BrSimWeapon(wtype))
|
||||
@@ -54,6 +64,10 @@ class BrSimArena():
|
||||
player= _player.BrSimPlayer(name, inventory)
|
||||
self.players.append(player)
|
||||
|
||||
def add_weapon(self, weapon_type):
|
||||
weapon= _weapons.BrSimWeapon(weapon_type)
|
||||
self.weapons.append(weapon)
|
||||
|
||||
def get_players(self):
|
||||
res= []
|
||||
for p in self.players:
|
||||
|
||||
Reference in New Issue
Block a user