def apply_positive(self, actor_type, actor_name, place, person, positive_heroes, negative_heroes, job_power): from the_tale.game.places import logic as places_logic effect_value = self.base_value * job_power effect_delta = effect_value * (1.0 / (24 * c.NORMAL_JOB_LENGTH)) places_logic.register_effect(place_id=place.id, attribute=self.attribute, value=effect_value, name=actor_name, delta=effect_delta, refresh_effects=True, refresh_places=False, info={'source': 'jobs'}) return self.apply_to_heroes( actor_type=actor_type, effect=getattr(EFFECT, 'PLACE_{}'.format(self.attribute.name)), method_names=('job_message', 'job_message'), method_kwargs={ 'place_id': place.id, 'person_id': person.id if person else None, 'job_power': job_power }, positive_heroes=positive_heroes, negative_heroes=negative_heroes, direction='positive')
def apply_negative(self, actor_type, actor_name, place, person, positive_heroes, negative_heroes, job_power): from the_tale.game.places import logic as places_logic value = self.negative_effect_value(job_power) delta = self.effect_delta(abs(value)) places_logic.register_effect(place_id=place.id, attribute=self.attribute, value=value, name=actor_name, delta=delta, refresh_effects=True, refresh_places=False, info={'source': 'jobs'}) return self.apply_to_heroes(actor_type=actor_type, effect=self.effect_type(), method_names=('job_message', 'job_message'), method_kwargs={'place_id': place.id, 'person_id': person.id if person else None}, positive_heroes=positive_heroes, negative_heroes=negative_heroes, direction='negative')