예제 #1
0
def look_for_caterpillar(dust, show_act=True):
    if not dust:
        log.bug("dust non è un parametro valido: %r" % dust)
        return

    caterpillar = dust.find_entity("bruco", dust.location, ["mobs"])
    if not caterpillar:
        if show_act:
            dust.act("My name is $n: niente bruchi" % dust, TO.OTHERS)
            dust.act("My name is $n: niente bruchi" % dust, TO.ENTITY)

        defer(60, look_for_caterpillar, dust)
        return

    if show_act:
        dust.act("My name is $n, ho visto un bruco: %r" % caterpillar,
                 TO.OTHERS)
        dust.act("My name is $n, ho visto un bruco: %r" % caterpillar,
                 TO.ENTITY)
        command_say(caterpillar, "sa la vist cus'è?")

    #defer(60, look_for_caterpillar, dust)
    # il bruco potrebbe essere soggetto a script che lo potrebbero mutare senza
    # avvisaglie quindi tolgo di mezzo il bruco per sostituirlo con un altro
    # che so non essere afflitto da script
    location = caterpillar.location
    caterpillar.extract(1)
    new_caterpillar = Mob(PROTO_CATERPILLAR_CODE)
    new_caterpillar.inject(location)
    new_caterpillar.act("$n cambia aspetto in modo repentino.", TO.OTHERS)

    dust_eating(dust, new_caterpillar)
def look_for_caterpillar(dust, show_act=True):
    if not dust:
        log.bug("dust non è un parametro valido: %r" % dust)
        return

    caterpillar = dust.find_entity("bruco", dust.location, ["mobs"])
    if not caterpillar:
        if show_act:
            dust.act("My name is $n: niente bruchi" % dust, TO.OTHERS)
            dust.act("My name is $n: niente bruchi" % dust, TO.ENTITY)

        defer(60, look_for_caterpillar, dust)
        return

    if show_act:
        dust.act("My name is $n, ho visto un bruco: %r" % caterpillar, TO.OTHERS)
        dust.act("My name is $n, ho visto un bruco: %r" % caterpillar, TO.ENTITY)
        command_say(caterpillar, "sa la vist cus'è?")

    #defer(60, look_for_caterpillar, dust)
    # il bruco potrebbe essere soggetto a script che lo potrebbero mutare senza
    # avvisaglie quindi tolgo di mezzo il bruco per sostituirlo con un altro
    # che so non essere afflitto da script
    location = caterpillar.location
    caterpillar.extract(1)
    new_caterpillar = Mob(PROTO_CATERPILLAR_CODE)
    new_caterpillar.inject(location)
    new_caterpillar.act("$n cambia aspetto in modo repentino.", TO.OTHERS)

    dust_eating(dust, new_caterpillar)
예제 #3
0
def born_mushrum(spore, room):
    # Se le spore non si trovan più tra gli oggetti allora il gamescript è
    # già scattato in precedenza
    if spore.code not in database["items"]:
        return

    # Rimuove le spore dalla stanza e dal database, abbiamo nella funzione
    # spore che possiamo utilizzare fino alla fine della stessa, poi
    # l'oggetto sarà come se non esistesse più
    spore = spore.extract(1)

    # Crea una nuova entità dal nostro conosciutissimo mushroom passandogli il
    # codice identificativo del prototipo
    mushroom = Mob("torreelementi_mob_faura_01")

    # Imposta tutti i riferimenti per il neonato mushroom, sarà da controllare che
    # siano tutti a posto!
    mushroom.inject(room)

    # Avvisiamo tutti quanti del lieto evento
    mushroom.act(
        "Qualcuno ha fatto l'errore di seminarti tramite $N ma lo raggiungerai",
        TO.ENTITY, spore)
    mushroom.act("L'orrore non avrà dunque mai fine! Ecco enuclearsi $n!",
                 TO.OTHERS, spore)
    mushroom.act("$n 'enuclea ed ora tu te ne devi andare", TO.TARGET, spore)

    # Rendiamo conto della velocità di germinazione con genuina sorpresa
    defer_random_time(15, 30, command_emote, mushroom,
                      "è cresciuto a vista d'occhio!")
예제 #4
0
def  born_to_be_wild_or_something(brain, room):
    # Se il  cervello non si trova più tra gli oggetti allora il gamescript è
    # già scattato in precedenza
    if brain.code not in  database["items"]:
        return

    # Rimuove il cervello dalla stanza e dal database,  abbiamo nella funzione
    # brain che possiamo utilizzare fino  alla fine della stessa, poi
    # l'oggetto sarà come se non  esistesse più
    brain.extract(1)

    # Crea una nuova entità dal nostro conosciutissimo mindf passandogli il
    # codice identificativo del prototipo
    mindf = Mob("mfdonald_mob_mindflayer_01")

    # Imposta tutti i riferimenti per il neonato mindf, sarà da controllare che
    # siano tutti a posto!
    mindf.inject(room)

    # Avvisiamo tutti quanti del lieto evento
    mindf.act("$n nasce da $N e inizia subito a muovere i tentacolini, che carino!", TO.OTHERS, brain)
    mindf.act("Nasci da $N e inizi subito ad avere un certo languorino; ma la tua non è proprio fame... e solo voglia di qualcosa di buono!", TO.ENTITY, brain)
    mindf.act("$n nasce da te, e ti senti subito molto orGoglione di quello che hai fatto!", TO.TARGET, brain)

    # Ora che è nato facciamogli dire qualcosa di intelligente in un tempo
    # variabili di secondi (qui in realtà sarebbe meglio utilizzare la funzione
    # interpret per inviare i comandi, cosicché mob che, per esempio, dormono
    # si mettono nella posizione alzata per inviare il comando, ma vabbe')
    defer_random_time(15, 30, command_say, mindf, "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl, fhtagn!")
def look_for_caterpillar(dust, show_act=True):
    if not dust:
        log.bug("dust non è un parametro valido: %r" % dust)
        return

    location = dust.location
    caterpillar = dust.find_entity("bruco", location, ["mobs"])
    if not caterpillar:
        if show_act:
            dust.act("My name is $n: niente bruchi %r" % dust, TO.OTHERS)
            dust.act("My name is $n: niente bruchi %r" % dust, TO.ENTITY)

        defer(60, look_for_caterpillar, dust)
        return

    if show_act:
        dust.act("My name is $n, ho visto un bruco: %r" % caterpillar,
                 TO.OTHERS)
        dust.act("My name is $n, ho visto un bruco: %r" % caterpillar,
                 TO.ENTITY)
        command_say(caterpillar, "sa la vist cus'è?")

    #defer( 60, look_for_caterpillar, dust)
    # il bruco potrebbe essere soggetto a script che lo potrebbero mutare senza avvisaglie quindi
    # tolgo di mezzo il bruco per sostituirlo con un altro che so non essere afflitto da script
    location = caterpillar.location
    caterpillar.extract(1)
    new_caterpillar = Mob(PROTO_CATERPILLAR_CODE)
    if not caterpillar:
        log.bug("impossibile crare un nuovo bruco: %r" % new_caterpillar)

    new_caterpillar.inject(location)
    new_caterpillar.act("$n cambia aspetto in modo repentino.", TO.OTHERS)
    new_caterpillar.act("$n cambia aspetto in modo repentino.", TO.ENTITY)

    dust_eating(dust, new_caterpillar)
    #ora resta solo da far mangiare la polvere che è bene rimuovere e rimpiazzare con con qualcosaltro
    return
def look_for_caterpillar(dust, show_act=True):
    if not dust:
        log.bug("dust non è un parametro valido: %r" % dust)
        return
    
    location = dust.location
    caterpillar = dust.find_entity("bruco", location, ["mobs"])
    if not caterpillar: 
        if show_act:
            dust.act("My name is $n: niente bruchi %r" % dust, TO.OTHERS)
            dust.act("My name is $n: niente bruchi %r" % dust, TO.ENTITY)
        
        defer(60, look_for_caterpillar, dust)
        return

    if show_act:
        dust.act("My name is $n, ho visto un bruco: %r" % caterpillar, TO.OTHERS)
        dust.act("My name is $n, ho visto un bruco: %r" % caterpillar, TO.ENTITY)
        command_say(caterpillar, "sa la vist cus'è?")

    #defer( 60, look_for_caterpillar, dust)
    # il bruco potrebbe essere soggetto a script che lo potrebbero mutare senza avvisaglie quindi
    # tolgo di mezzo il bruco per sostituirlo con un altro che so non essere afflitto da script
    location = caterpillar.location
    caterpillar.extract(1)
    new_caterpillar = Mob(PROTO_CATERPILLAR_CODE)
    if not caterpillar: 
        log.bug("impossibile crare un nuovo bruco: %r" % new_caterpillar)

    new_caterpillar.inject(location)
    new_caterpillar.act("$n cambia aspetto in modo repentino.", TO.OTHERS)
    new_caterpillar.act("$n cambia aspetto in modo repentino.", TO.ENTITY)

    dust_eating(dust, new_caterpillar)
    #ora resta solo da far mangiare la polvere che è bene rimuovere e rimpiazzare con con qualcosaltro
    return
def on_sunset(tessitrice):
    barbagianni = Mob(BAGGIA_PROTO_CODE)
    barbagianni.inject(tessitrice.location)

    for content in tessitrice.iter_contains():
        content.from_location()
        content.to_location(barbagianni)

    command_yell(tessitrice, "Aahhh%s Dolore%s" % (random_marks(0, 2), random_marks(0, 3)))

    barbagianni.act("Ti origini da $N e sei $n.", TO.ENTITY, tessitrice)
    barbagianni.act("In un istante $N si trasforma in $n!", TO.OTHERS, tessitrice)
    barbagianni.act("$n si origina da te!", TO.TARGET, tessitrice)

    tessitrice.extract(1)
def on_sunrise(barbagianni):
    tessy = Mob(TESSY_PROTO_CODE)
    tessy.inject(barbagianni.location)

    for content in barbagianni.iter_contains():
        content.from_location()
        content.to_location(tessy)
        #Nel caso volessi resettare lo slot dell'item:
        #content.wear_mode.clear()

    command_yell(barbagianni, "Screeeh%s Scretch%s" % (random_marks(0, 2), random_marks(0, 3)))

    tessy.act("Ti origini da $N e sei $n.", TO.ENTITY, barbagianni)
    tessy.act("In un istante $N si trasforma in  $n!", TO.OTHERS, barbagianni)
    tessy.act("$n si origina da te!", TO.TARGET, barbagianni)

    #print "barbagianni proto glob qty prima dell'estract", barbagianni.current_global_quantity
    barbagianni.extract(1)
def on_sunset(dosso):
    if not dosso:
        log.bug("dosso non è un parametro valido: %r" % dosso)
        return

    lupo = Mob(PROTO_LUPO_CODE)
    lupo.inject(dosso.location)

    #for content in tessitrice.iter_contains(use_reversed=True):
    #    content = content.from_location(content.quantity)
    #    content.to_location(barbagianni)

    lupo.act("Ti origini da $N e sei $n.", TO.ENTITY, dosso)
    lupo.act("$N emmette un risonante fruscio e si trasforma improvvisamente in $n!", TO.OTHERS, dosso)
    lupo.act("$n si origina da te!", TO.TARGET, dosso)

    dosso.stop_repop()
    dosso.extract(1)
def coming(locanda):
    """
    Controlla non ci siano bimbe in giro e poi la inietta.
    """
    # È possibile visto che questa funzione viene deferrata
    if not locanda:
        return

    for mob in database["mobs"].itervalues():
        if mob.prototype.code == PROTO_MOB_CODE:
            return

    bimba = Mob(PROTO_MOB_CODE)
    bimba.inject(locanda)

    bimba.act("Entri trotterellante in $N", TO.ENTITY, locanda)
    bimba.act("$n entra trotterellando in $N.", TO.OTHERS, locanda)
    bimba.act("Ti senti calpestare dal trotterellare di $n", TO.TARGET,
              locanda)
def on_sunset(dosso):
    if not dosso:
        log.bug("dosso non è un parametro valido: %r" % dosso)
        return

    lupo = Mob(PROTO_LUPO_CODE)
    lupo.inject(dosso.location)

    #for content in tessitrice.iter_contains(use_reversed=True):
    #    content = content.from_location(content.quantity)
    #    content.to_location(barbagianni)

    lupo.act("Ti origini da $N e sei $n.", TO.ENTITY, dosso)
    lupo.act(
        "$N emmette un risonante fruscio e si trasforma improvvisamente in $n!",
        TO.OTHERS, dosso)
    lupo.act("$n si origina da te!", TO.TARGET, dosso)

    dosso.stop_repop()
    dosso.extract(1)