So, if you have read by blog, you know I am working on a roguelike in python. For this, I need a large list of monsters and items, all with distinct properties, behavior, visuals, stats etc. Right now, at load time, I use decorators to add them all to a large list, but I really dislike doing anything at load time, especially since it creates annoying circular dependencies that require me to import modules at the end of code files instead of the beginning.
Also, I feel like I am missing some encapsulation since the player object has about 25 functions, and all items have to reach threw the player to do anything. However, most of the players functions are internal since my system for handling turns works most efficiently with every action having it's own function, some requiring 2. For example, I have the wear command. This calls removeFromInventoryByLetter(letter) and if that function successfully gets a item, I call wear(Item). My container class also uses removeFromInventoryByLetter(letter) when putting a item into the container, but this code is in the container class, outside the player class. This method should however not be directly used by the AI, since it doesn't calculate movement cost. Neither of them should use the function displayWelcomeMessage(). If I wanted a object to explode when touched, I would do something like self.owner.world.explosion(self.owner.position, magnitude) and then remove myself from the players inventory. It just seems like there will be a extremely high chance of getting bugs by calling a invalid method or a reference not set properly or a method that in some cases has to depend on whether the player is alive and sometimes shouldn't.
I am just curious how you would go out organizing a large amount of very similar classes, with slightly different code, that only get a reference to there owner (The player or a monster) with which to access the world.
(I realize this is a bit of a run-on post, if you are confused, just give up)