forked from Cryz/battle_royale_sim
define players and items coordinates to be used on the map
This commit is contained in:
@@ -1,20 +1,27 @@
|
|||||||
import os as _os
|
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
|
|
||||||
|
|
||||||
TOKEN= _token
|
try:
|
||||||
try: BOT_PATH= _os.path.expanduser(_bot_path)
|
from local_settings import TOKEN as _token
|
||||||
|
TOKEN= _token
|
||||||
|
except: TOKEN= 'XXX'
|
||||||
|
try:
|
||||||
|
from local_settings import BOT_PATH as _bot_path
|
||||||
|
BOT_PATH= _os.path.expanduser(_bot_path)
|
||||||
except: 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= ''
|
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
|
except: BOT_EXEC_CMD= None
|
||||||
try: SUPER_USERS= _superusers
|
try:
|
||||||
|
from local_settings import SUPER_USERS as _superusers
|
||||||
|
SUPER_USERS= _superusers
|
||||||
except: SUPER_USERS= []
|
except: SUPER_USERS= []
|
||||||
|
|
||||||
|
|
||||||
START_MSG= """Benvenuto nel crudele mondo di Battle Royal Simulator,
|
START_MSG= """Benvenuto nel crudele mondo di Battle Royal Simulator,
|
||||||
La tua avventura e quella dei tuoi compagni inizia qui.
|
La tua avventura e quella dei tuoi compagni inizia qui.
|
||||||
Questo Bot simula Hunger Games,
|
Questo Bot simula Hunger Games,
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ import random as _random
|
|||||||
class BrSimItem():
|
class BrSimItem():
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
self.coord_x= 0
|
||||||
|
self.coord_y= 0
|
||||||
|
|
||||||
def get_name(self):
|
def get_name(self):
|
||||||
return self.name
|
return self.name
|
||||||
@@ -19,3 +20,6 @@ class BrSimItem():
|
|||||||
|
|
||||||
def is_cure(self):
|
def is_cure(self):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def get_item_coordinates(self):
|
||||||
|
return self.coord_x, self.coord_y
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ class BrSimMap():
|
|||||||
self.init_map_matrix()
|
self.init_map_matrix()
|
||||||
|
|
||||||
def init_map_matrix(self):
|
def init_map_matrix(self):
|
||||||
# TODO map matrix:
|
|
||||||
# show a matrix representing the game's map
|
# show a matrix representing the game's map
|
||||||
# 🟩 is and empty cell
|
# 🟩 is and empty cell
|
||||||
# (tomorrow we can choose different colors for different locations
|
# (tomorrow we can choose different colors for different locations
|
||||||
@@ -27,11 +26,12 @@ class BrSimMap():
|
|||||||
width.append(self.field_sym)
|
width.append(self.field_sym)
|
||||||
for i in range(self.world_height):
|
for i in range(self.world_height):
|
||||||
self.game_map.append(width)
|
self.game_map.append(width)
|
||||||
# TODO add players and items on map
|
|
||||||
for player in self.players:
|
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:
|
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}')
|
_logs.log_debug(f'init_map_matrix: {self.game_map}')
|
||||||
|
|
||||||
def get_map_matrix(self):
|
def get_map_matrix(self):
|
||||||
|
|||||||
@@ -19,9 +19,14 @@ class BrSimPlayer():
|
|||||||
self.equipped_weapon= None
|
self.equipped_weapon= None
|
||||||
self.gender= _random.sample(['m', 'f', '-'], 1)[0] # for now get a random gender
|
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.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
|
### control methods
|
||||||
|
|
||||||
|
def get_player_coordinates(self):
|
||||||
|
return self.coord_x. self.coord_y
|
||||||
|
|
||||||
def get_name_and_stats(self):
|
def get_name_and_stats(self):
|
||||||
health= '♥️' * self.health or '☠️'
|
health= '♥️' * self.health or '☠️'
|
||||||
strength= '⚔️' * self.damage
|
strength= '⚔️' * self.damage
|
||||||
|
|||||||
Reference in New Issue
Block a user