Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
Saner use of JSON and consumables, dealing no damage no longer prints what may have been negative damage
  • Loading branch information
Shoes01 committed Jun 11, 2019
1 parent 17e4ce9 commit 9ad8d4b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion components/item/consumable.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
class ConsumableComponent():
def __init__(self, effects):
self.effects = {} if effects is True else effects # type: a dict of effects
self.effects = {} if effects is None else effects # type: a dict of effects
2 changes: 1 addition & 1 deletion data/consumables.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{
"archtype": "item",

"consumable": true,
"consumable": null,
"name": {"name": "Soul Jar"},
"render": {"char": "!", "color": "con_jar"}
}
Expand Down
2 changes: 2 additions & 0 deletions processors/combat.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ def process(self):

if damage > 0:
self.world.component_for_entity(defender_ID, StatsComponent).hp -= damage
else:
damage = 0

if def_stats['hp'] <= 0:
self.world.get_processor(DeathProcessor).queue.put({'ent': defender_ID})
Expand Down

0 comments on commit 9ad8d4b

Please sign in to comment.