From 9ad8d4bd96628791fca8c771d27f6af286fbde8c Mon Sep 17 00:00:00 2001 From: Shoes01 <0jason.gilbert@gmail.com> Date: Tue, 11 Jun 2019 14:34:20 -0300 Subject: [PATCH] Minor fixes Saner use of JSON and consumables, dealing no damage no longer prints what may have been negative damage --- components/item/consumable.py | 2 +- data/consumables.json | 2 +- processors/combat.py | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/components/item/consumable.py b/components/item/consumable.py index 4c0e367..21a09f7 100644 --- a/components/item/consumable.py +++ b/components/item/consumable.py @@ -1,3 +1,3 @@ class ConsumableComponent(): def __init__(self, effects): - self.effects = {} if effects is True else effects # type: a dict of effects \ No newline at end of file + self.effects = {} if effects is None else effects # type: a dict of effects \ No newline at end of file diff --git a/data/consumables.json b/data/consumables.json index d70203f..27c7499 100644 --- a/data/consumables.json +++ b/data/consumables.json @@ -7,7 +7,7 @@ { "archtype": "item", - "consumable": true, + "consumable": null, "name": {"name": "Soul Jar"}, "render": {"char": "!", "color": "con_jar"} } diff --git a/processors/combat.py b/processors/combat.py index 7d4e77d..79c7880 100644 --- a/processors/combat.py +++ b/processors/combat.py @@ -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})