ParletteSoftware / bitfl

Billy in the Fat Lane
GNU General Public License v3.0
0 stars 0 forks source link

Add major attributes #81

Closed matthew-parlette closed 11 years ago

matthew-parlette commented 11 years ago

This is pretty big change to how the attributes are managed for a player.

You should take some time to familiarize yourself with the Attribute class and its subclasses (added to the end of player.py). Each subclass will define calculate, which will eventually serve to figure out the value of an attribute (happiness, for instance) based on its minor attributes (add up your relaxation time and job satisfaction to determine happiness). For now, though, it just returns the value instance variable.

So the two things you should be aware of to use an Attribute is:

I also added Time as an attribute. This moves it to the player class instead of the game class, which I think makes more sense, but also allows for you to define time used by an item. So if you see the book defined in the library, it will take two hours to use that item, but will provide two happiness.

For examples on this, see the game class, particularly the command processor method, which uses get() and set() throughout. Its a little rough looking to reference the attributes as a dictionary, but it makes the Player.use_item() and Player.info_display() easier to use.

cparlette commented 11 years ago

I think one of the debug statements is whacked, it's showing the names of the attributes instead of the values:

Game Class: Debug: command(): command is item_use Game Class: Debug: command(): parameters: {'player': a, 'item': Hamburger Meal} Game Class: Debug: Player item list: [Hamburger Meal] Game Class: Debug: Player item list (id): [UUID('6c8d98e0-7104-45e1-817a-75af77a49df0')] Game Class: Debug: ID of item: 6c8d98e0-7104-45e1-817a-75af77a49df0 Game Class: Debug: Consuming item (Hamburger Meal) with effects {u'health': 1} Game Class: Debug: Player attributes are now {'money': Money, 'health': Health, 'knowledge': Knowledge, 'happiness': Happiness, 'time': Time}

matthew-parlette commented 11 years ago

should be fixed now