Add tickerhandler-free character class for tests

This commit is contained in:
FlutterSprite 2017-12-10 18:52:34 -08:00 committed by GitHub
parent 1420c8773e
commit f738427ff3

View file

@ -592,7 +592,17 @@ class TBItemsCharacter(DefaultCharacter):
self.apply_turn_conditions()
# Tick down condition durations
condition_tickdown(self, self)
class TBItemsCharacterTest(TBItemsCharacter):
"""
Just like the TBItemsCharacter, but doesn't subscribe to the TickerHandler.
This makes it easier to run unit tests on.
"""
def at_object_creation(self):
self.db.max_hp = 100 # Set maximum HP to 100
self.db.hp = self.db.max_hp # Set current HP to maximum
self.db.conditions = {} # Set empty dict for conditions
"""
----------------------------------------------------------------------------
@ -1384,4 +1394,4 @@ AMULET_OF_WEAKNESS = {
"item_func" : "add_condition",
"item_selfonly" : True,
"item_kwargs" : {"conditions":[("Damage Down", 3), ("Accuracy Down", 3), ("Defense Down", 3)]}
}
}