コード例 #1
0
    def invoke_effect( self, effect, originator, area_of_effect, opening_anim = None, delay_point=None ):
        all_anims = list()
        if opening_anim:
            all_anims.append( opening_anim )
            anims = opening_anim.children
        else:
            anims = all_anims
        delay = 1
        for p in area_of_effect:
            if delay_point:
                delay = self.scene.distance( p, delay_point ) * 2 + 1
            effect( self.camp, originator, p, anims, delay )
        animobs.handle_anim_sequence( self.screen, self.view, all_anims, self.record_anim )
        self.record_anim = False

        # Remove dead models from the map, and handle probes and mitoses.
        for m in list(self.scene.contents):
            if hasattr( m, "probe_me" ) and m.probe_me:
                self.probe( m )
                m.probe_me = False
            if isinstance( m, characters.Character ) and not m.is_alright():
                self.check_trigger( "DEATH", m )
                if not m.is_alright():
                    # There may be a script keeping this model alive...
                    self.scene.contents.remove( m )
                    if m.is_dead():
                        # Drop all held items.
                        m.drop_everything( self.scene )
            elif hasattr( m, "mitose_me" ) and m.mitose_me:
                self.mitose( m )
                del( m.mitose_me )
コード例 #2
0
 def invoke_technique( self, tech, originator, area_of_effect, opening_anim = None, delay_point=None ):
     if self.camp.fight and self.camp.fight.cstat[originator].silent and isinstance( tech, spells.Spell ):
         anims = [ animobs.SpeakSilence(originator.pos), ]
         animobs.handle_anim_sequence( self.screen, self.view, anims )
     else:
         self.invoke_effect( tech.fx, originator, area_of_effect, opening_anim, delay_point )
     tech.pay_invocation_price( originator )
コード例 #3
0
ファイル: exploration.py プロジェクト: BrendanPotts/dmeternal
 def invoke_technique( self, tech, originator, area_of_effect, opening_anim = None, delay_point=None ):
     if self.camp.fight and self.camp.fight.cstat[originator].silent and isinstance( tech, spells.Spell ):
         anims = [ animobs.SpeakSilence(originator.pos), ]
         animobs.handle_anim_sequence( self.screen, self.view, anims )
     else:
         self.invoke_effect( tech.fx, originator, area_of_effect, opening_anim, delay_point )
     tech.pay_invocation_price( originator )
コード例 #4
0
ファイル: exploration.py プロジェクト: BrendanPotts/dmeternal
    def invoke_effect( self, effect, originator, area_of_effect, opening_anim = None, delay_point=None ):
        all_anims = list()
        if opening_anim:
            all_anims.append( opening_anim )
            anims = opening_anim.children
        else:
            anims = all_anims
        delay = 1
        for p in area_of_effect:
            if delay_point:
                delay = self.scene.distance( p, delay_point ) * 2 + 1
            effect( self.camp, originator, p, anims, delay )
        animobs.handle_anim_sequence( self.screen, self.view, all_anims )

        # Remove dead models from the map, and handle probes.
        for m in self.scene.contents[:]:
            if hasattr( m, "probe_me" ) and m.probe_me:
                self.probe( m )
                m.probe_me = False
            if isinstance( m, characters.Character ) and not m.is_alright():
                self.check_trigger( "DEATH", m )
                if not m.is_alright():
                    # There may be a script keeping this model alive...
                    self.scene.contents.remove( m )
                    # Drop all held items.
                    for i in m.contents[:]:
                        if hasattr( i, "place" ):
                            m.contents.remove(i)
                            i.equipped = False
                            i.place( self.scene, m.pos )
コード例 #5
0
ファイル: exploration.py プロジェクト: jwvhewitt/dmeternal
    def invoke_effect( self, effect, originator, area_of_effect, opening_anim = None, delay_point=None ):
        all_anims = list()
        if opening_anim:
            all_anims.append( opening_anim )
            anims = opening_anim.children
        else:
            anims = all_anims
        delay = 1
        for p in area_of_effect:
            if delay_point:
                delay = self.scene.distance( p, delay_point ) * 2 + 1
            effect( self.camp, originator, p, anims, delay )
        animobs.handle_anim_sequence( self.screen, self.view, all_anims, self.record_anim )
        self.record_anim = False

        # Remove dead models from the map, and handle probes and mitoses.
        for m in list(self.scene.contents):
            if hasattr( m, "probe_me" ) and m.probe_me:
                self.probe( m )
                m.probe_me = False
            if isinstance( m, characters.Character ) and not m.is_alright():
                self.check_trigger( "DEATH", m )
                if not m.is_alright():
                    # There may be a script keeping this model alive...
                    self.scene.contents.remove( m )
                    if m.is_dead():
                        # Drop all held items.
                        m.drop_everything( self.scene )
            elif hasattr( m, "mitose_me" ) and m.mitose_me:
                self.mitose( m )
                del( m.mitose_me )
コード例 #6
0
ファイル: specfeatures.py プロジェクト: carriercomm/dmeternal
 def answer_correctly( self, explo ):
     self.elements["TEAM"].charm_roll = 999
     self.shop_open = True
     r_stat,r_amount = self.REWARDS.get( self.boss_goal, (stats.TOUGHNESS,1) )
     ao = list()
     for pc in explo.camp.party:
         pc.statline[r_stat] = pc.statline.get(r_stat,0) + r_amount
         ao.append( animobs.PurpleSparkle( pos = pc.pos ) )
     animobs.handle_anim_sequence( explo.screen, explo.view, ao )
コード例 #7
0
 def answer_correctly(self, explo):
     self.elements["TEAM"].charm_roll = 999
     self.shop_open = True
     r_stat, r_amount = self.REWARDS.get(self.boss_goal,
                                         (stats.TOUGHNESS, 1))
     ao = list()
     for pc in explo.camp.party:
         pc.statline[r_stat] = pc.statline.get(r_stat, 0) + r_amount
         ao.append(animobs.PurpleSparkle(pos=pc.pos))
     animobs.handle_anim_sequence(explo.screen, explo.view, ao)
コード例 #8
0
 def attempt_awareness( self, explo, chara ):
     """Try to spot any hidden models taking part in combat."""
     awareness = chara.get_stat( stats.AWARENESS ) + chara.get_stat_bonus( stats.INTELLIGENCE ) + 55
     anims = list()
     for m in self.active:
         if m.is_alright() and m.is_enemy( self.camp, chara ) and m.hidden:
             spot_chance = max( awareness - m.get_stat( stats.STEALTH ) - chara.get_stat_bonus( stats.REFLEXES ), 10)
             if random.randint(1,100) <= spot_chance:
                 m.hidden = False
                 anims.append( animobs.PurpleSparkle( pos=m.pos ) )
     if not anims:
         anims.append( animobs.Caption( "Fail!", pos=chara.pos ) )
     animobs.handle_anim_sequence( explo.screen, explo.view, anims )
     self.end_turn( chara )
コード例 #9
0
ファイル: combat.py プロジェクト: BrendanPotts/dmeternal
 def attempt_awareness( self, explo, chara ):
     """Try to spot any hidden models taking part in combat."""
     awareness = chara.get_stat( stats.AWARENESS ) + chara.get_stat_bonus( stats.INTELLIGENCE ) + 55
     anims = list()
     for m in self.active:
         if m.is_alright() and m.is_enemy( self.camp, chara ) and m.hidden:
             spot_chance = max( awareness - m.get_stat( stats.STEALTH ) - chara.get_stat_bonus( stats.REFLEXES ), 10)
             if random.randint(1,100) <= spot_chance:
                 m.hidden = False
                 anims.append( animobs.PurpleSparkle( pos=m.pos ) )
     if not anims:
         anims.append( animobs.Caption( "Fail!", pos=chara.pos ) )
     animobs.handle_anim_sequence( explo.screen, explo.view, anims )
     self.end_turn( chara )
コード例 #10
0
    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 )
コード例 #11
0
ファイル: exploration.py プロジェクト: BrendanPotts/dmeternal
    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 )
コード例 #12
0
    def attempt_stealth( self, explo, chara ):
        """Make a stealth roll for chara vs best enemy awareness roll."""
        # Determine the highest awareness of all enemies.
        hi = 0
        for m in self.active:
            if m.is_alright() and m.is_enemy( self.camp, chara ):
                awareness = m.get_stat( stats.AWARENESS ) + m.get_stat_bonus( stats.INTELLIGENCE )
                hi = max( hi, awareness )
        # The target number is clamped between 5 and 96- always 5% chance of success or failure.
        hi = min( max( hi - chara.get_stat( stats.STEALTH ) - chara.get_stat_bonus( stats.REFLEXES ) + 45 , 5 ), 96 )
        anims = list()
        if random.randint(1,100) >= hi:
            chara.hidden = True
            anims.append( animobs.Smoke( pos=chara.pos ) )
        else:
            anims.append( animobs.Smoke( pos=chara.pos ) )
            anims.append( animobs.Caption( "Fail!", pos=chara.pos ) )
        animobs.handle_anim_sequence( explo.screen, explo.view, anims )

        self.end_turn( chara )
コード例 #13
0
ファイル: combat.py プロジェクト: BrendanPotts/dmeternal
    def attempt_stealth( self, explo, chara ):
        """Make a stealth roll for chara vs best enemy awareness roll."""
        # Determine the highest awareness of all enemies.
        hi = 0
        for m in self.active:
            if m.is_alright() and m.is_enemy( self.camp, chara ):
                awareness = m.get_stat( stats.AWARENESS ) + m.get_stat_bonus( stats.INTELLIGENCE )
                hi = max( hi, awareness )
        # The target number is clamped between 5 and 96- always 5% chance of success or failure.
        hi = min( max( hi - chara.get_stat( stats.STEALTH ) - chara.get_stat_bonus( stats.REFLEXES ) + 45 , 5 ), 96 )
        anims = list()
        if random.randint(1,100) >= hi:
            chara.hidden = True
            anims.append( animobs.Smoke( pos=chara.pos ) )
        else:
            anims.append( animobs.Smoke( pos=chara.pos ) )
            anims.append( animobs.Caption( "Fail!", pos=chara.pos ) )
        animobs.handle_anim_sequence( explo.screen, explo.view, anims )

        self.end_turn( chara )
コード例 #14
0
 def bump_model( self, target ):
     # Do the animation first.
     pc = self.camp.party_spokesperson()
     anims = [ animobs.SpeakHello(pos=pc.pos), animobs.SpeakHello(pos=target.pos)]
     animobs.handle_anim_sequence( self.screen, self.view, anims )
     self.converse_with_model( target )
コード例 #15
0
ファイル: exploration.py プロジェクト: BrendanPotts/dmeternal
 def bump_model( self, target ):
     # Do the animation first.
     pc = self.camp.party_spokesperson()
     anims = [ animobs.SpeakHello(pos=pc.pos), animobs.SpeakHello(pos=target.pos)]
     animobs.handle_anim_sequence( self.screen, self.view, anims )
     self.converse_with_model( target )