Example #1
0
def fight(room, noun):
    room = gamestate.currentRoom()

    if "enemy" not in room:
        print(
            "You brandish a weapon of your choosing, and with a flourish of"
            "decidedly expert skill, you flail pointlessly in the air. You"
            "have no doubt been harshly judged by the denizens of your locale."
        )
        return

    your_stats = {'name': "you", 'hp': 100, 'base_damage': 20}
    bobos_stats = {'name': "Bobo", 'hp': 25, 'base_damage': 5}

    you = Actor("you", your_stats)
    bobo = Actor("Bobo", bobos_stats)
    enemy = room["enemy"]

    if enemy.defeated:
        print "The adage 'beating %s %s that is already dead' comes to mind" % (
            enemy.article(), enemy.name)
        return

    print "Ohkaaaaaaaay, you decide to attack the %s" % enemy.name
    print
    print enemy.art
    print

    contestants = [you, bobo]

    while not enemy.defeated:
        print "[ You HP=%d, Bobo HP=%d ] vs [ %s HP=%d ]" % (
            you.hp, bobo.hp, enemy.name[0], enemy.hp)

        you_attack = you.attack()
        print "You attack for %d damage" % you_attack
        enemy.hit(you_attack)

        if not bobo.defeated:
            bobo_attack = bobo.attack()
            print "Bobo attacks for %d damage" % bobo_attack
            enemy.hit(bobo_attack)

        if enemy.defeated:
            break

        enemy_attack = enemy.attack()
        enemy_attack_whom = sample(contestants, 1)[0]
        print "%s attacks %s for %d damage" % (
            enemy.name[0], enemy_attack_whom.name[0], enemy_attack)
        enemy_attack_whom.hit(enemy_attack)

        if you.defeated:
            try:
                contestants.remove(you)
            except:
                pass

        if bobo.defeated:
            try:
                contestants.remove(bobo)
            except:
                pass

        if len(contestants) == 0:
            break

        time.sleep(0.5)

    if enemy.defeated:
        print "You slew your foe!"
        if enemy.value != 0:
            print "ERMAGERD %s dropped %d monies!!1!1!!" % (enemy.name[0],
                                                            enemy.value)
            gamestate.addToInventory(
                "monies",
                gamestate.inventory()['monies'] + enemy.value)

    if you.defeated:
        print "Whelp, guess fighting just wasn't your thing. You're dead."

    if bobo.defeated:
        print "But Bobo did not survive to sling poo another day. Poor Bobo."
    else:
        print "Since he survived somehow, Bobo dances valiantly on the corpse of the enemy!"

    print "But this is MAGIC BOBO WORLD AND EVERYTHING IS BACK AS IT WAS"
Example #2
0
def fight(room, noun) :
    room = gamestate.currentRoom()

    if "enemy" not in room :
      print ("You brandish a weapon of your choosing, and with a flourish of"
            "decidedly expert skill, you flail pointlessly in the air. You"
            "have no doubt been harshly judged by the denizens of your locale.")
      return

    your_stats = {'name': "you", 'hp': 100, 'base_damage': 20}
    bobos_stats = {'name': "Bobo", 'hp': 25, 'base_damage': 5}

    you = Actor("you",your_stats)
    bobo = Actor("Bobo",bobos_stats)
    enemy = room["enemy"]

    if enemy.defeated :
        print "The adage 'beating %s %s that is already dead' comes to mind"%(enemy.article(),enemy.name)
        return

    print "Ohkaaaaaaaay, you decide to attack the %s"%enemy.name
    print
    print enemy.art
    print

    contestants = [you,bobo]

    while not enemy.defeated :
        print "[ You HP=%d, Bobo HP=%d ] vs [ %s HP=%d ]"%(you.hp,bobo.hp,enemy.name[0],enemy.hp)

        you_attack = you.attack()
        print "You attack for %d damage"%you_attack
        enemy.hit(you_attack)

        if not bobo.defeated :
            bobo_attack = bobo.attack()
            print "Bobo attacks for %d damage"%bobo_attack
            enemy.hit(bobo_attack)

        if enemy.defeated :
            break

        enemy_attack = enemy.attack()
        enemy_attack_whom = sample(contestants,1)[0]
        print "%s attacks %s for %d damage"%(enemy.name[0],enemy_attack_whom.name[0],enemy_attack)
        enemy_attack_whom.hit(enemy_attack)

        if you.defeated :
            try : contestants.remove(you)
            except : pass

        if bobo.defeated :
            try : contestants.remove(bobo)
            except : pass

        if len(contestants) == 0 :
            break

        time.sleep(0.5)

    if enemy.defeated :
        print "You slew your foe!"
        if enemy.value != 0 :
            print "ERMAGERD %s dropped %d monies!!1!1!!"%(enemy.name[0],enemy.value)
            gamestate.addToInventory("monies",gamestate.inventory()['monies']+enemy.value)

    if you.defeated :
        print "Whelp, guess fighting just wasn't your thing. You're dead."

    if bobo.defeated :
        print "But Bobo did not survive to sling poo another day. Poor Bobo."
    else :
        print "Since he survived somehow, Bobo dances valiantly on the corpse of the enemy!"

    print "But this is MAGIC BOBO WORLD AND EVERYTHING IS BACK AS IT WAS"
Example #3
0
def takeBeastOrb(gamestate):
    room = gamestate.currentRoom()
    gamestate.addToInventory('beast orb')
    del (gamestate.room('boboHut')['actions']['take']['beast orb'])
    print "You take the beast orb.  It growls softly and warmly in your robes."
Example #4
0
def takeBeastOrb(gamestate):
    room = gamestate.currentRoom()
    gamestate.addToInventory('beast orb')
    del(gamestate.room('boboHut')['actions']['take']['beast orb'])
    print "You take the beast orb.  It growls softly and warmly in your robes."