Exemplo n.º 1
0
    def retreat(self, coward):
        w = World()
        for co in coward.combats:
            w.combats.remove(co)
            co.combatant1.combats.remove(co)
            co.combatant2.combats.remove(co)
            if co.combatant1.engaged == co:
                if co.combatant1.combats and co.combatant1 != coward:
                    co.combatant1.engaged = co.combatant1.combats[0]
                    co.combatant1.engaged.in_range_set_action(co.combatant1)
                else:
                    co.combatant1.engaged = None

            if co.combatant2.engaged == co:
                if co.combatant2.combats and co.combatant2 != coward:
                    co.combatant2.engaged = co.combatant2.combats[0]
                    co.combatant2.engaged.in_range_set_action(co.combatant2)
                else:
                    co.combatant2.engaged = None
        choices = []
        choices.extend(libsigma.open_exits(coward.location))
        selection = random.choice(choices)
        libsigma.report(libsigma.SELF | libsigma.ROOM, "$actor $verb to turn tail and run away!", coward,
                        ("manage", "manages"))
        libsigma.run_command(coward, "go " + libsigma.dir2txt(selection))
Exemplo n.º 2
0
    def retreat(self, coward):
        w = World()
        for co in coward.combats:
            w.combats.remove(co)
            co.combatant1.combats.remove(co)
            co.combatant2.combats.remove(co)
            if co.combatant1.engaged == co:
                if co.combatant1.combats and co.combatant1 != coward:
                    co.combatant1.engaged = co.combatant1.combats[0]
                    co.combatant1.engaged.in_range_set_action(co.combatant1)
                else:
                    co.combatant1.engaged = None

            if co.combatant2.engaged == co:
                if co.combatant2.combats and co.combatant2 != coward:
                    co.combatant2.engaged = co.combatant2.combats[0]
                    co.combatant2.engaged.in_range_set_action(co.combatant2)
                else:
                    co.combatant2.engaged = None
        choices = []
        choices.extend(libsigma.open_exits(coward.location))
        selection = random.choice(choices)
        libsigma.report(libsigma.SELF | libsigma.ROOM,
                        "$actor $verb to turn tail and run away!", coward,
                        ("manage", "manages"))
        libsigma.run_command(coward, "go " + libsigma.dir2txt(selection))
Exemplo n.º 3
0
def task_execute():
    w = World()
    for current in w.populators:
        if w.denizens.has_key(current.instance) and 'mobile' in current.flags:
            active_denizen = w.denizens[current.instance]

            choices = [None]
            choices.extend(libsigma.open_exits(active_denizen.location))

            selection = random.choice(choices)
            if active_denizen.engaged:
                selection=None

            if (selection != None):
                if active_denizen.location.altmsg[selection]!=None:
                    libsigma.report(libsigma.ROOM, "$actor just went " + active_denizen.location.altmsg[selection] + ".", active_denizen )
                elif (libsigma.dir2txt(selection) =='leave'):
                    libsigma.report(libsigma.ROOM, "$actor just went out.", active_denizen)
                elif (libsigma.dir2txt(selection) == 'enter'):
                    libsigma.report(libsigma.ROOM, "$actor just went in.", active_denizen)
                else:
                    libsigma.report(libsigma.ROOM, "$actor just went " + libsigma.dir2txt(selection) + ".", active_denizen)
                libsigma.enter_room(active_denizen, active_denizen.location.exits[selection])
                libsigma.report(libsigma.ROOM, "$actor has entered the room.", active_denizen)