spawn random items, and try to put on map, but i still need to investigate why items are not correctly rendered on map
This commit is contained in:
25
debug.py
25
debug.py
@@ -3,22 +3,39 @@ import random as _rand
|
||||
import main as _main
|
||||
from utils import logs as _logs
|
||||
from bot_libs import syms as _syms
|
||||
from entities.items import syms as _isyms
|
||||
|
||||
|
||||
def _get_random_items():
|
||||
def _extract_random_number_of_items(Arena):
|
||||
players= Arena.get_players()
|
||||
nplayers= len(players)
|
||||
min_extraction= max(nplayers - 5, 3)
|
||||
max_extraction= min(nplayers - 1, 8)
|
||||
nitems= _rand.randint(min_extraction, max_extraction)
|
||||
return nitems
|
||||
|
||||
def _get_random_items(Arena):
|
||||
items= []
|
||||
nitems= _extract_random_number_of_items(Arena)
|
||||
for n in range(nitems):
|
||||
itype= _rand.sample(_isyms.ITEMS_LIST, 1)[0]
|
||||
items.append(itype)
|
||||
return items
|
||||
|
||||
def _debug_data():
|
||||
players= _syms.COLORS_NAMES
|
||||
nelected_players= _rand.randint(6, 12)
|
||||
elected_players= _rand.sample(players, nelected_players)
|
||||
|
||||
Arena= _main.init_arena()
|
||||
for player in players:
|
||||
for player in elected_players:
|
||||
Arena.add_player(player)
|
||||
_logs.log_debug('Players: {elected_players}')
|
||||
|
||||
items= _get_random_items()
|
||||
items= _get_random_items(Arena)
|
||||
for item in items:
|
||||
Arena.add_item(item)
|
||||
_logs.log_info('Items: {items}')
|
||||
return Arena
|
||||
|
||||
def _end_game_debug(alive_players, day):
|
||||
@@ -97,7 +114,7 @@ def init_debug_simulation():
|
||||
_logs.log_debug('#################')
|
||||
_logs.log_debug('#################')
|
||||
_logs.log_debug('#################')
|
||||
_time.sleep(0.3)
|
||||
_time.sleep(0.7)
|
||||
|
||||
def init_debug_attack_loop():
|
||||
Arena= _debug_data()
|
||||
|
||||
Reference in New Issue
Block a user