From f98672541f74f8b91d171db7ffd6cf34b0e1793b Mon Sep 17 00:00:00 2001 From: Tegiminis Date: Tue, 9 Aug 2022 01:15:27 -0700 Subject: [PATCH] remove deprecated helper method change alter_cache to update_cache to better match what the method does (+1 squashed commits) Squashed commits: [23d61e14d] fix test --- evennia/contrib/rpg/buffs/buff.py | 14 ++------------ evennia/contrib/rpg/buffs/tests.py | 2 +- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/evennia/contrib/rpg/buffs/buff.py b/evennia/contrib/rpg/buffs/buff.py index f360bf00d6..f21786763d 100644 --- a/evennia/contrib/rpg/buffs/buff.py +++ b/evennia/contrib/rpg/buffs/buff.py @@ -234,8 +234,8 @@ class BaseBuff: self.start = time.time() self.handler.buffcache[self.buffkey]["start"] = time.time() - def alter_cache(self, to_cache: dict): - """Alters this buff's cache, both internally (this instance) and on the handler's buff cache. + def update_cache(self, to_cache: dict): + """Updates this buff's cache using the given values, both internally (this instance) and on the handler. Args: to_cache: The dictionary of values you want to add to the cache""" @@ -930,16 +930,6 @@ class BuffHandler: ) return - def set_duration(self, key, value): - """Sets the duration of the specified buff. - - Args: - key: The key of the buff whose duration you want to set - value: The value you want the new duration to be""" - if key in self.buffcache.keys(): - self.buffcache[key]["duration"] = value - return - def view(self, to_filter=None) -> dict: """Returns a buff flavor text as a dictionary of tuples in the format {key: (name, flavor)}. Common use for this is a buff readout of some kind. diff --git a/evennia/contrib/rpg/buffs/tests.py b/evennia/contrib/rpg/buffs/tests.py index 0fa115269a..0d6b0f36b5 100644 --- a/evennia/contrib/rpg/buffs/tests.py +++ b/evennia/contrib/rpg/buffs/tests.py @@ -368,7 +368,7 @@ class TestBuffsAndHandler(EvenniaTest): _instance.at_tick() self.assertTrue(self.testobj.db.ticktest) # test duration modification and cleanup - handler.set_duration("ttib", 0) + _instance.duration = 0 self.assertEqual(handler.get("ttib").duration, 0) handler.cleanup() self.assertFalse(handler.get("ttib"), None)