def perform_inspection(self): player = self.args['player_lifeform'] acu, sen = player.get_detection_pair() acu *= (1.0 - self.ObservationPenalty) sen *= (1.0 - self.ObservationPenalty) origin = player.coordinates open_space = self.world.all_traversable_coordinates() at = self.args['interaction_target'] max_range = self.FogOfWarScalar * player.visual_fog_of_war() visual_area = list(Distance.direct_los( origin, open_space, max_range, at, self.RadiusAroundInspection)) player.detect_in_area(visual_area) room_description = Environment.describe_area_visually( player, acu, sen, self.world, visual_area) self.append_result(self.player_info.uid, room_description)
def actors_in_range_los(self, caller, start, distance): coords = list( Distance.direct_los(origin=start, open_space=self.all_traversable_coordinates(), max_distance=distance)) for coord in coords: yield from self.actors_at(caller, coord)
def compute_fog_of_war(self, lifeform, available_space): coords = lifeform.coordinates fog_of_war = lifeform.visual_fog_of_war() los = Distance.direct_los(coords, available_space, fog_of_war) for seen in los: self.fog_of_war.append(seen) self.all_seen.add(seen)
def observe(self, max_range=None, loc=None, radius=None): visual_area = list( Distance.direct_los(self.coordinates, self.world.all_traversable_coordinates(), max_range or self.visual_fog_of_war(), loc or self.coordinates, radius or max_range)) self.detect_in_area(visual_area)
def observe(self, max_range=None, loc=None, radius=None): visual_area = list(Distance.direct_los( self.coordinates, self.world.all_traversable_coordinates(), max_range or self.visual_fog_of_war(), loc or self.coordinates, radius or max_range)) self.detect_in_area(visual_area)
def actors_in_range_los(self, caller, start, distance): coords = list(Distance.direct_los( origin=start, open_space=self.all_traversable_coordinates(), max_distance=distance )) for coord in coords: yield from self.actors_at(caller, coord)
def get_summon_location(self, instigator, cmd, mutator): return random.choice( list( Distance.direct_los(instigator.coordinates, cmd.world.all_traversable_coordinates(), max_distance=2)))
def get_summon_location(self, instigator, cmd, mutator): return random.choice(list(Distance.direct_los( instigator.coordinates, cmd.world.all_traversable_coordinates(), max_distance=2)))
def rebuild_affected_tiles(self): self.needs_rebuilt = False coords = self.world.all_traversable_coordinates() circle = Distance.direct_los(self.location, coords, self.max_distance) self.affected_tiles = set(circle)