1
0

define players and items coordinates to be used on the map

This commit is contained in:
andrea
2025-07-27 23:34:35 +02:00
parent a7fd66e9e4
commit 5e6816269b
4 changed files with 31 additions and 15 deletions

View File

@@ -1,20 +1,27 @@
import os as _os
from local_settings import TOKEN as _token
from local_settings import BOT_PATH as _bot_path
from local_settings import LOG_PATH as _log_path
from local_settings import BOT_EXEC_CMD as _bot_exec_cmd
from local_settings import SUPER_USERS as _superusers
try:
from local_settings import TOKEN as _token
TOKEN= _token
try: BOT_PATH= _os.path.expanduser(_bot_path)
except: TOKEN= 'XXX'
try:
from local_settings import BOT_PATH as _bot_path
BOT_PATH= _os.path.expanduser(_bot_path)
except: BOT_PATH= ''
try: LOG_PATH= _os.path.expanduser(_log_path)
try:
from local_settings import LOG_PATH as _log_path
LOG_PATH= _os.path.expanduser(_log_path)
except: LOG_PATH= ''
try: BOT_EXEC_CMD= _bot_exec_cmd
try:
from local_settings import BOT_EXEC_CMD as _bot_exec_cmd
BOT_EXEC_CMD= _bot_exec_cmd
except: BOT_EXEC_CMD= None
try: SUPER_USERS= _superusers
try:
from local_settings import SUPER_USERS as _superusers
SUPER_USERS= _superusers
except: SUPER_USERS= []
START_MSG= """Benvenuto nel crudele mondo di Battle Royal Simulator,
La tua avventura e quella dei tuoi compagni inizia qui.
Questo Bot simula Hunger Games,

View File

@@ -3,7 +3,8 @@ import random as _random
class BrSimItem():
def __init__(self):
pass
self.coord_x= 0
self.coord_y= 0
def get_name(self):
return self.name
@@ -19,3 +20,6 @@ class BrSimItem():
def is_cure(self):
return False
def get_item_coordinates(self):
return self.coord_x, self.coord_y

View File

@@ -15,7 +15,6 @@ class BrSimMap():
self.init_map_matrix()
def init_map_matrix(self):
# TODO map matrix:
# show a matrix representing the game's map
# 🟩 is and empty cell
# (tomorrow we can choose different colors for different locations
@@ -27,11 +26,12 @@ class BrSimMap():
width.append(self.field_sym)
for i in range(self.world_height):
self.game_map.append(width)
# TODO add players and items on map
for player in self.players:
self.game_map[player.coord_y][player.coord_x]= self.player_sym
p_coord_x, p_coord_y= players.get_player_coordinates()
self.game_map[p_coord_y][p_coord_x]= self.player_sym
for item in self.items:
self.game_map[item.coord_y][item.coord_x]= self.item_sym
i_coord_x, i_coord_y= item.get_item_coordinates()
self.game_map[i_coord_y][i_coord_x]= self.item_sym
_logs.log_debug(f'init_map_matrix: {self.game_map}')
def get_map_matrix(self):

View File

@@ -19,9 +19,14 @@ class BrSimPlayer():
self.equipped_weapon= None
self.gender= _random.sample(['m', 'f', '-'], 1)[0] # for now get a random gender
self.reputation= 50 #Like RDR2 the player can be evil(0) or good(100). This should influence the sponsors and internal alliance
self.coord_x= 0
self.coord_y= 0
### control methods
def get_player_coordinates(self):
return self.coord_x. self.coord_y
def get_name_and_stats(self):
health= '♥️' * self.health or '☠️'
strength= '⚔️' * self.damage