1
0

replace print with log_debug

This commit is contained in:
andrea
2025-08-02 10:04:30 +02:00
parent 6c3fe6326f
commit cdb69699ab
6 changed files with 48 additions and 43 deletions

View File

@@ -2,6 +2,7 @@ from entities import player as _player
from entities import event_picker as _events
from entities import gamemap as _map
from entities.items import weapons as _weapons
from utils import logs as _logs
class BrSimArena():
@@ -30,13 +31,13 @@ class BrSimArena():
def next_day(self):
self.day+= 1
print(f'Giorno: {self.day}')
_logs.log_debug(f'Giorno: {self.day}')
alive_players_str= ', '.join([p.get_name() for p in self.get_alive_players()])
print(f'Giocatori vivi: {alive_players_str}')
_logs.log_debug(f'Giocatori vivi: {alive_players_str}')
death_players= self.get_death_players()
if (death_players):
death_players_str= ', '.join([p.get_name() for p in death_players])
print(f'Giocatori morti: {death_players_str}')
_logs.log_debug(f'Giocatori morti: {death_players_str}')
def get_alive_players(self):
res= []

View File

@@ -6,6 +6,7 @@ from PIL import ImageDraw as _ImageDraw
from utils import logs as _logs
from bot_libs import syms as _bot_syms
from entities import resource as _resource
from utils import logs as _logs
class BrSimMap():
@@ -78,7 +79,7 @@ class BrSimMap():
x= _random.randint(0, self.world_width -1)
y= _random.randint(0, self.world_height -1)
resource= self.get_map_matrix()[y][x]
print(f'{target.get_name()} >>> ({x},{y})')
_logs.log_debug(f'{target.get_name()} >>> ({x},{y})')
target.set_coordinates(x, y)
self.get_map_matrix()[y][x]= target
@@ -150,7 +151,7 @@ class BrSimMap():
attack= self.check_near_players(Player)
if attack:
print(f'{Player.get_name()} can attack {[a.get_name() for a in attack]}')
_logs.log_debug(f'{Player.get_name()} can attack {[a.get_name() for a in attack]}')
#avail_actions.append(1) #XXX replace with attack action (or maybe other actions on players)
avail_actions[1]= attack #XXX replace with attack action (or maybe other actions on players)
if self.get_player_available_directions(Player):

View File

@@ -1,6 +1,7 @@
import random as _random
import uuid as _uuid
from entities import resource as _resource
from utils import logs as _logs
class BrSimPlayer(_resource.BrSimResource):
@@ -137,11 +138,11 @@ class BrSimPlayer(_resource.BrSimResource):
self.health= 0
if self.player_gender_is_male():
print(f'[{self.get_name_and_stats()}]: Guarino, perdonami se sono morto x.x')
_logs.log_debug(f'[{self.get_name_and_stats()}]: Guarino, perdonami se sono morto x.x')
elif self.player_gender_is_female():
print(f'[{self.get_name_and_stats()}]: Guarino, perdonami se sono morta x.x')
_logs.log_debug(f'[{self.get_name_and_stats()}]: Guarino, perdonami se sono morta x.x')
else:
print(f'[{self.get_name_and_stats()}]: Guarino, perdonami se sono mort* x.x')
_logs.log_debug(f'[{self.get_name_and_stats()}]: Guarino, perdonami se sono mort* x.x')
return damage
def attack(self, target):
@@ -166,11 +167,11 @@ class BrSimPlayer(_resource.BrSimResource):
def get_item(self, item):
if self.get_inventory_weight() + item.get_weight() >= self.get_max_weight():
if self.player_gender_is_male():
print(f'Sono sovraccarico, {self.get_name_and_stats} non puo\' prendere questo oggetto')
_logs.log_debug(f'Sono sovraccarico, {self.get_name_and_stats} non puo\' prendere questo oggetto')
elif self.player_gender_is_female():
print(f'Sono sovraccarica, {self.get_name_and_stats} non puo\' prendere questo oggetto')
_logs.log_debug(f'Sono sovraccarica, {self.get_name_and_stats} non puo\' prendere questo oggetto')
else:
print(f'Sono sovraccaric#, {self.get_name_and_stats} non puo\' prendere questo oggetto')
_logs.log_debug(f'Sono sovraccaric#, {self.get_name_and_stats} non puo\' prendere questo oggetto')
return False
self.inventory.append(item)