Exemplo n.º 1
0
def main():

    mobSource = mobLoader()

    monster = mobSource.pickMob(random.randint(0,4),1)
    if monster:
        print "Name: {} \nHP: {} \nArmor: {} \nBase Diff: {}".format(monster.name, monster.hp, monster.armor, monster.bdiff)
        print monster.desc

        itemSource = items.itemLoader()
        monster.loadInventory(itemSource)
        for item in monster.inventory:
            print item.name
    else:
        print "No mob spawned"
Exemplo n.º 2
0
def main():
    itemSource = items.itemLoader()
    mobSource = mobs.mobLoader()
    currentRoom = room.startRoom()
    print "\033[2J"
    print """           WELCOME
                            ,--.
                           {    }
                           K,   }
                          /  ~Y`
                     ,   /   /
                    {_'-K.__/
                      `/-.__L._
                      /  ' /`\_}
                     /  ' /
             ____   /  ' /
      ,-'~~~~    ~~/  ' /_
    ,'             ``~~~  ',
   (                        Y
  {                         I
 {      -                    `,
 |       ',                   )
 |        |   ,..__      __. Y
 |    .,_./  Y ' / ^Y   J   )|
 \           |' /   |   |   ||
  \          L_/    . _ (_,.'(
   \,   ,      ^^""' / |      )
     \_  \          /,L]     /
       '-_~-,       ` `   ./`
          `'{_            )
              ^^\..___,.--`
    """ #This is super cheesy, but it's a nod to old school MUDs, which inspired this game
    char = player.player()

    #debug
    if char.name == "AlexRocks":
        potion = itemSource.makeItem(0)
        char.inventory.append(potion)
        armor = itemSource.makeArmor(0, "head")
        char.inventory.append(armor)
        armor2 = itemSource.makeArmor(1, "head")
        char.inventory.append(armor2)
        weapon = itemSource.makeWeapon(0, "weapon")
        char.inventory.append(weapon)
        weapon2 = itemSource.makeWeapon(1, "weapon")
        char.inventory.append(weapon2)
        twohand = itemSource.makeWeapon(1, "twohanded")
        char.inventory.append(twohand)
        shield = itemSource.makeArmor(1, "shield")
        char.inventory.append(shield)

    while char.currentHP > 0:
        # check to see if a monster is in the room, if so set it to monster
        monster = currentRoom.enter(char, mobSource, itemSource)
        print "\n" + currentRoom.desc
        # if there is a monster in the room, begin combat
        if not monster:
            print "You appear to be alone here."
        if currentRoom.monCount > 0 and monster:
            print monster.desc + "\n"
            time.sleep(1.5)
            with combat.combat(char, monster, currentRoom) as battle:
                while battle.running is True:
                    battle.getInput(char)
            currentRoom.monCount -= 1
            if char.currentHP < 1:
                char.death()
            del battle
        # check for chance event
        currentRoom.rollChance(char, itemSource)
        # if any items in room, show them
        currentRoom.roomContents()
        # display next room options
        currentRoom.nextRooms(currentRoom.exits)
        # (re)initialize results to None
        result = None
        # display game prompt. If the user selects a new room, restart the loop
        while not result:
            result = prompt.basePrompt(char, currentRoom)
            if isinstance(result, room.maps):
                currentRoom = result



    if char.currentHP < 1:
        char.death()