def _refresh(self): if self.dead or not need_refresh(self): unregister(self._refresh_pulse) del self._refresh_pulse return for pool_id, base_pool_id in POOL_KEYS: new_value = getattr(self, pool_id) + self._refresher[pool_id] setattr(self, pool_id, min(new_value, getattr(self, base_pool_id))) self.status_change() self.check_fight()
def start_refresh(self): if not self._refresh_pulse and need_refresh(self): self._refresh_pulse = register_p(self._refresh, pulses=self._refresh_interval)