Grimmys/rpg_tactical_fantasy_game

Define limited stock of money for shops

Opened this issue · 4 comments

Currently, Shops have infinite amount of money: you can sell them whatever amount of items you want and still get money from it.

My idea would be to define a limited amount of money for Shops, same as what is already the case for the players.

The amount of money owned by the seller should be display in the "Sell" view (and maybe in the "Buy" view as well?).

Selling items to the seller would decrease the money left according to the sell value of the item, and buying items from the seller should increase the money left.
If the seller does not have enough money for buying the item, then something should be happening between:

  1. Forbid the sell (inform the player that seller cannot buy the item)
  2. Allow the sell but only give to the player what the seller had left (0 if the seller already had no money anymore), and maybe ask confirmation to the player that the sell would be "at loss"

I don't have any strong opinion about which behaviour is the best.

Concerned places should be shop.py, menu_creator_manager.py#create_shop_menu (if anything should be updated in the menu) and level_0/map.tmx, level_3/map.tmx (for giving the new "money" property to the shops defined in these levels).

N.B.: I don't know if this feature is a balanced one, I just think it may be funny to implement. Let see after experimenting if it's bringing some value or too boring

Hello, I am new to open source and would like to implement the following feature if it is available!

Hello @Sonny-Cao , sure, you can start working on it if you want!

Don't hesitate to ask me some questions (by e-mails, or by Discord) if you need help understanding something.

Hello, I am interested in working on this, has it already been done?

Hi @Elemperor1 , in fact someone else just started its implementation, I merged the change today: https://github.com/Grimmys/rpg_tactical_fantasy_game/pull/84/files

But there are still some things to be done :

  • Default balance of any shop is hard-coded to 500, obviously not ideal. The default balance should be read from the level configuration (while parsing the shops entities). For this, TMX maps have to be modified (using Tiled) and src/services/load_from_tmx_manager.py should be adapted to parse the information from the map.
  • Updated balance of the shop should be persisted in the save file. For this, save method in shop.py should be extended, and src/services/load_from_xml_manager.py as well to load the value from the save file.
  • Shop balance should be shown on sell interface as well.