def attempt_holy_sign(self, explo, chara): """Attempt to disrupt the undead creatures in the area.""" aoe = pfov.PointOfView(self.scene, chara.pos[0], chara.pos[1], 6).tiles explo.invoke_effect(HOLY_SIGN_EFFECT, chara, aoe, animobs.Marquee(chara.pos)) chara.holy_signs_used += 1 self.end_turn(chara)
def attack_from_here(self, explo, comba, chara, redraw): candidates = list() legal_tiles = pfov.PointOfView(explo.scene, chara.pos[0], chara.pos[1], chara.get_attack_reach()).tiles for m in explo.scene.contents: if chara.is_enemy(explo.camp, m) and m.pos in legal_tiles and not m.hidden: candidates.append(m) if candidates: target = random.choice(candidates) comba.attack(explo, chara, target, redraw) return True
def attack_from_here(self, explo, comba, chara, redraw): candidates = list() legal_tiles = pfov.PointOfView(explo.scene, chara.pos[0], chara.pos[1], chara.get_attack_reach()).tiles for m in explo.scene.contents: if chara.is_enemy(explo.camp, m) and m.pos in legal_tiles and not m.hidden: candidates.append(m) if candidates: if random.randint(0, self.SMART_ATTACK_INT) <= chara.get_stat( stats.INTELLIGENCE): candidates.sort(key=self.get_target_heat) target = candidates[0] else: target = random.choice(candidates) comba.attack(explo, chara, target, redraw) return True
def update_monsters( self ): for m in self.scene.contents: if isinstance( m, characters.Character ) and self.monster_inactive(m): # First handle movement. if m.get_move() and ( ((self.time + hash(m)) % 35 == 1 ) or self.camp.fight ): rdel = random.choice( self.scene.DELTA8 ) nupos = ( m.pos[0] + rdel[0], m.pos[1] + rdel[1] ) if self.scene.on_the_map(nupos[0],nupos[1]) and not self.scene.map[nupos[0]][nupos[1]].blocks_walking() and not self.scene.get_character_at_spot(nupos): if m.team and m.team.home: if m.team.home.collidepoint( nupos ): m.pos = nupos else: m.pos = nupos # Monsters that can hide may hide. if m.can_use_stealth() and m.is_hostile( self.camp ) and random.randint(1,6) == 1: m.hidden = True # Next, check visibility to PC. if m.team and m.team.on_guard() and m.pos in self.scene.in_sight: pov = pfov.PointOfView( self.scene, m.pos[0], m.pos[1], 5 ) in_sight = False for pc in self.camp.party: if pc.pos in pov.tiles and pc in self.scene.contents: in_sight = True break if in_sight: react = m.get_reaction( self.camp ) if react < characters.FRIENDLY_THRESHOLD: if react < characters.ENEMY_THRESHOLD: anims = [ animobs.SpeakAttack(m.pos,loop=16), ] animobs.handle_anim_sequence( self.screen, self.view, anims ) self.camp.activate_monster( m ) break else: anims = [ animobs.SpeakAngry(m.pos,loop=16), ] animobs.handle_anim_sequence( self.screen, self.view, anims ) # Start by setting this team to hostile- just in case the player # exits the dialogue w/o making a truce. m.team.charm_roll = -999 self.converse_with_model( m, dialogue.CUE_THREATEN )
def get_targets(self, camp, origin): tiles = pfov.PointOfView(camp.scene, origin[0], origin[1], self.reach).tiles tiles.remove(origin) return tiles
def get_targets(self, camp, origin): return pfov.PointOfView(camp.scene, origin[0], origin[1], self.reach).tiles
def get_area(self, camp, origin, target): return pfov.PointOfView(camp.scene, target[0], target[1], self.radius).tiles
def get_area(self, camp, origin, target): tiles = pfov.PointOfView(camp.scene, origin[0], origin[1], self.radius).tiles if self.exclude_middle: tiles.remove(origin) return tiles