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:
andrea
2025-11-14 23:15:14 +01:00
parent f408aee8f8
commit 054522eaf3
5 changed files with 46 additions and 25 deletions

View File

@@ -1,28 +1,35 @@
import random as _random
from entities import resource as _resource
from entities.items import syms as _isyms
class BrSimItem(_resource.BrSimResource):
#XXX i don't know yet if we need to call this clas
# or we need to have subclasses that inherit this one
# for example class Weapon and class Medikit (or something else)
# this decision would change everything from Arena init
# test
def __init__(self, item):
self.coord_x= 0
self.coord_y= 0
self.item= item
def __init__(self, item_id):
self.item= _isyms.ITEMS[item_id]
def is_item(self):
return True
def get_name(self):
return self.name
def get_data(self):
return self.item
def get_item_type(self):
return self.item_type
def get_name(self):
idata= self.get_data()
return idata['name']
def get_weight(self):
return self.weight
idata= self.get_data()
return idata['weight']
def is_weapon(self):
return False
idata= self.get_data()
return idata['is_weapon']
def is_cure(self):
return False
#XXX not sure about it
# maybe we could have more item type, like foods, drink, poison...
return not self.is_weapon()