def __init__(self):

        self.handler = Stringhandler()
        self.bossList = []
        self.byteBoss = Bosslist.ByteBoss()
        self.hipsterBoss = Bosslist.HipsterBoss()
        self.boss = None
示例#2
0
    def __init__(self, action, player, room):

        self.action = action
        self.player = player
        self.room = room
        self.monster = room.monster
        self.chest = room.chest
        self.handler = Stringhandler()
示例#3
0
 def __init__(self):
     name = RandomMonsterName()
     self.fullName = name.getFullName()
     self.shortName = name.getShortName()
     self.hp = 10
     self.strength = 1
     self.killed = False
     self.hasLoot = False
     self.level = 1
     self.item = Items()
     self.Loot = self.item.randomWeapon(self.level)
     self.handler = Stringhandler()
示例#4
0
    def __init__(self, difficulty, player):

        self.hasMonster = False
        self.hasBoss = False
        self.hasChest = False
        self.isDone = False
        self.difficulty = difficulty
        self.settings = Settings()
        self.goal = self.settings.getGoal()
        self.player = player
        self.chest = Chest(self.player)
        self.monster = Monster()
        self.inspected = False
        self.handler = Stringhandler()
        self.boss = Endboss()
        self.endboss = self.boss.randomBoss(player)
示例#5
0
 def __init__(self):
     self.name = "player"
     self.hp = 100
     self.facesMonster = False
     self.facesBoss = False
     self.victory = False
     self.condition = "normal"
     self.previous = "normal"
     self.strength = 5
     self.level = 1
     self.inventory = []
     self.is_in_room = False
     self.equipped = []
     self.triedWalk = False
     self.alive = True
     self.settings = Settings()
     self.handler = Stringhandler()
示例#6
0
 def __init__(self, player):
     name = "item"
     self.opened = False
     self.player = player
     self.level = player.level
     self.item = Items()
     self.handler = Stringhandler()
     self.hasLoot = True
     if self.level > 5:
         self.Loot = self.item.randomWeapon(self.level)
     else:
         rnd = random.randint(0, 10)
         if rnd < 3:
             self.hasLoot = False
             self.Loot = ""
         else:
             self.Loot = self.item.randomWeapon(self.level)
示例#7
0
class Chest(object):
    def __init__(self, player):
        name = "item"
        self.opened = False
        self.player = player
        self.level = player.level
        self.item = Items()
        self.handler = Stringhandler()
        self.hasLoot = True
        if self.level > 5:
            self.Loot = self.item.randomWeapon(self.level)
        else:
            rnd = random.randint(0, 10)
            if rnd < 3:
                self.hasLoot = False
                self.Loot = ""
            else:
                self.Loot = self.item.randomWeapon(self.level)

    def getLoot(self):
        return self.Loot

    def is_opened(self):
        return self.opened

    def open(self, player):
        self.opened = True
        player.lvlUp()
        if self.hasLoot:
            return self.handler.strChest(
                "open",
                self.getLoot().name) + "\n\n" + self.player.addItem(
                    self.getLoot())
        else:
            string = self.handler.strChest("empty", self.getLoot())

        return string

    def has_loot(self):
        return self.hasLoot
示例#8
0
class Monster(object):
    def __init__(self):
        name = RandomMonsterName()
        self.fullName = name.getFullName()
        self.shortName = name.getShortName()
        self.hp = 10
        self.strength = 1
        self.killed = False
        self.hasLoot = False
        self.level = 1
        self.item = Items()
        self.Loot = self.item.randomWeapon(self.level)
        self.handler = Stringhandler()

    def getFullName(self):
        return self.fullName

    def getShortName(self):
        return self.shortName

    def is_alive(self):
        if self.hp > 0:
            return True
        else:
            self.killed = True
            return self.killed

    def takeDamage(self, damage, player):

        self.hp -= damage
        string = '"' + self.handler.strMonster("hit", self, player) + '"\n'
        for char in string:
            time.sleep(uniform(0.05, 0.08))
            sys.stdout.write('\033[32m' + '\033[1m' + char)
            sys.stdout.flush()
        print Fore.WHITE
        time.sleep(0.5)

    def getHP(self):
        return self.hp

    def getLoot(self):
        return self.Loot

    def setLoot(self, value):
        self.Loot = self.item.randomWeapon(value)

    def kill(self):
        self.killed = True

    def calcDamage(self):
        damage = self.strength + random.randint(0, 3)
        return damage

    def setup(self, difficulty, player_level):
        self.killed = False
        if difficulty is 1:
            self.hp = player_level + random.randint(10, 25)
            self.strength = player_level + random.randint(1, 9)
            rnd = random.randint(0, 10)
            if rnd > 3:
                self.hasLoot = True
            self.level = random.randint(1, 10)
            self.setLoot(self.level)

        else:
            self.hp = player_level + random.randint(15, 35)
            self.strength = player_level + random.randint(5, 15)

            rnd = random.randint(0, 10)
            if rnd > 7:
                self.hasLoot = True
            self.level = random.randint(1, 6)
            self.setLoot(self.level)

    def attackPlayer(self, room, player, damage):

        return player.takeDamage(damage, room.monster)

    def attack(self, room, player):
        damage = player.getStrength() + random.randint(0, 3)
        damageplayer = self.calcDamage()
        if (self.hp - damage <= 0):
            room.killMonster()
            player.facesMonster = False
            if self.hasLoot:
                return self.handler.strMonster("killedLoot", self,
                                               player) + "\n" + player.addItem(
                                                   self.getLoot())
            else:

                return self.handler.strMonster("killed", self, player)

        elif player.hp - damageplayer <= 0:

            return "\n" + self.attackPlayer(room, player, damageplayer)
        else:

            self.takeDamage(damage, player)
            return self.handler.strMonsterDamage("getAttacked",self,damage,player) +"\n"+\
            self.handler.strMonsterDamage("returnHP",self,damage,player) +"\n"+self.attackPlayer(room,player,damageplayer)

    def flee(self, room, player):
        player.facesMonster = False
        damage = self.calcDamage()

        if damage < 5:
            return self.handler.strMonster(
                "flee", room.monster, player) + " " + self.handler.strMonster(
                    "fleeSuccess", room.monster, player)
        else:
            return self.handler.strMonster(
                "flee", room.monster, player) + " " + self.handler.strMonster(
                    "fleeFail", room.monster,
                    player) + "\n" + player.takeDamage(damage, room.monster)

    def spawn(self, room, player):
        if room.hasMonster:
            if not self.killed and player.facesMonster:
                response = "something went wrong"
                return response
            elif room.hasMonster and not self.killed:
                player.facesMonster = True
                damage = self.calcDamage()
                return self.handler.strMonsterDamage(
                    "spawn", self, damage, player) + "\n" + player.takeDamage(
                        damage, room.monster)
示例#9
0
class Player(object):
    def __init__(self):
        self.name = "player"
        self.hp = 100
        self.facesMonster = False
        self.facesBoss = False
        self.victory = False
        self.condition = "normal"
        self.previous = "normal"
        self.strength = 5
        self.level = 1
        self.inventory = []
        self.is_in_room = False
        self.equipped = []
        self.triedWalk = False
        self.alive = True
        self.settings = Settings()
        self.handler = Stringhandler()

    def is_alive(self):
        return self.hp > 0

    def is_in_room(self):
        return self.is_in_room

    def getCondition(self):
        return self.condition

    def setCondition(self, condition):
        self.condition = condition

    def wins(self):
        self.facesBoss = False
        self.facesMonster = False
        self.victory = True

    def takeDamage(self, damage, monster):
        self.hp -= damage
        rnd = random.randint(0, 20)
        if rnd < 3:
            self.previous = self.condition
            self.condition = "poisoned"
        elif rnd is 10 or 15 or 20:
            if self.condition == "poisoned":
                self.condition = "normal"
                self.previous = "poisoned"
        else:
            self.previous = self.condition
        if self.hp > 0:
            if self.facesBoss:

                if isinstance(monster, ByteBoss) or isinstance(
                        monster, HipsterBoss):
                    if isinstance(monster, ByteBoss):
                        return self.handler.strBoss(
                            "bAttack", self,
                            damage) + "\n" + self.handler.strPlayer(
                                "condition",
                                self) + self.handler.strPlayerDamage(
                                    "hp", self, monster, damage) + "\n"
                    elif isinstance(monster, HipsterBoss):
                        return self.handler.strBoss(
                            "hAttack", self,
                            damage) + "\n" + self.handler.strPlayer(
                                "condition",
                                self) + self.handler.strPlayerDamage(
                                    "hp", self, monster, damage) + "\n"
                    else:
                        return "Uh oh, not good."
            else:
                return "\n" + self.handler.strPlayerDamage(
                    "takeDamage", self,
                    monster, damage) + "\n" + self.handler.strPlayer(
                        "condition", self) + self.handler.strPlayerDamage(
                            "hp", self, monster, damage) + "\n"
        else:
            return self.die(monster)

    def lvlUp(self):
        self.level += 1
        print self.handler.strPlayer("lvl", self)

    def getHP(self):
        return self.hp

    def setCondition(self, condition):
        self.condition = condition

    def getPrevious(self):
        return self.previous

    def is_facing_Monster(self):
        return self.facesMonster

    def facing_Monster(self, status):
        self.facesMonster = status

    def addItem(self, item):
        self.inventory.append(item)
        self.hasItems = True
        if isinstance(item, Weapon):
            print "\n" + self.handler.strPlayerItem("newItem", self, item)
            return self.equipItem(len(self.inventory) - 1, item)

    def equipItem(self, pos, item):
        slot = pos
        if int(slot) >= len(self.inventory):
            string = "Sorry Dave, I'm afraid I can't let you do that."
        else:
            self.equipped = self.inventory[slot]
            # return "\n"+self.handler.strPlayerItem("newItem", self, item)
            if isinstance(item, Weapon):
                self.strength = 1
                self.strength += self.equipped.damage
            # print "\nYou equipped "+Fore.YELLOW + item.name+Fore.WHITE
            string = self.handler.strPlayerItem("equipItem", self, item)
        return string

    def heal(self):
        if isinstance(self.equipped, Potion):
            if not self.equipped.isEmpty:
                self.equipped.drink()
                heal = int(self.hp * self.equipped.strength)
                if self.hp + heal <= 100:
                    self.hp += heal
                    return "\n" + self.handler.strPlayer("heal", self)
                else:
                    self.hp = 100
                    return "\n" + self.handler.strPlayer("healFull", self)
            else:
                return "\n" + self.handler.strPlayer("emptyPot", self)

        elif isinstance(self.equipped, list):
            return "\n" + self.handler.strPlayer("drinkAir", self)
        else:
            return self.handler.strPlayerItem("drinkItem", self, self.equipped)

    def die(self, monster):
        stringtwo = ""
        if monster is not None:
            string = self.handler.strPlayer("dies", self)
        else:
            string = self.handler.strPlayer("dies", self) + "\n"

        if "SHAKESPEAR" in string:
            string = string.replace("SHAKESPEAR ", "")
            stringtwo = "to die, to sleep..."
        elif "FORGET" in string:
            string = string.replace("FORGET ", "")
            stringtwo = "\nDo not forget me..."
        elif "FIREFLY" in string:
            string = string.replace("FIREFLY ", "")
            stringtwo = "\nCurse your sudden but inevitable betrayal..."

        for char in string:
            time.sleep(uniform(0.05, 0.1))
            sys.stdout.write('\033[36m' + char)
            sys.stdout.flush()

        for char in stringtwo:
            time.sleep(uniform(0.1, 0.6))
            sys.stdout.write('\033[36m' + char)
            sys.stdout.flush()
        self.alive = False
        return Fore.WHITE + "\n\n\nYou are dead.\n\n"
        #"+Fore.CYAN+"restart "+Fore.WHITE+"or"+Fore.CYAN+" exit?"

    def getStrength(self):
        return self.strength

    def printInventory(self):
        string = "You own: "
        for index, item in enumerate(self.inventory, start=1):
            string = string + Fore.YELLOW + item.name + Fore.WHITE + "[" + str(
                index) + "], "
        string = string + "\nType" + Fore.CYAN + " equip 1 " + Fore.WHITE + "to equip the first item form the list."
        return self.handler.modify(string, self)
示例#10
0
class Actions():
    def __init__(self, action, player, room):

        self.action = action
        self.player = player
        self.room = room
        self.monster = room.monster
        self.chest = room.chest
        self.handler = Stringhandler()

    def __repr__(self):

        if self.player.alive:

            ##
            ## Continues
            ##
            if "go" in self.action.lower() or "walk" in self.action.lower() or "continue" in self.action.lower():
                text = self.handler.strActions("moving",self.player,self.room)
                for x in range (0,5):
                    b = text + "." * x
                    sys.stdout.write('\r'+b)
                    time.sleep(0.4)

                if self.room.hasMonster or self.player.facesBoss:
                    if not self.room.monster.killed and not self.player.facesBoss:
                        self.player.triedWalk = True
                        damage = self.room.monster.calcDamage()
                        return self.room.monster.attackPlayer(self.room,self.player,damage)
                    elif not self.room.endboss.killed and self.player.facesBoss:
                        self.player.triedWalk = True
                        return self.room.boss.attack(self.player)
                    else:
                        return self.handler.strActions("nextRoomMonster",self.player,self.room) +\
                         "\n"+self.handler.strActions("nextRoom",self.player,self.room)
                        # response = "b"
                elif not self.room.isDone:
                    return self.handler.strActions("moveChest",self.player,self.room)
                else:
                    return self.handler.strActions("nextRoom",self.player,self.room)
            elif "die" == self.action.lower():
                return self.player.die(self.room.monster)

            ##
            ## Equips an item
            ##
            elif "equip" in self.action.lower():
                if bool(re.search(r'\d', self.action.lower())):
                    slot = int(re.search(r'\d+', self.action.lower()).group())-1
                    if slot < len(self.player.inventory):
                        return self.player.equipItem(slot,self.player.inventory[slot])
                    else:
                        return "You only have "+Fore.GREEN+str(len(self.player.inventory))+Fore.WHITE+" item(s) in your"+Fore.CYAN+" inventory" +Fore.WHITE+"."
                else:
                    return "You can't do that.\nUse "+Fore.CYAN+"equip 1" +Fore.WHITE+" to equip the first item of your"+Fore.CYAN+" inventory "+Fore.WHITE+"."

            ##
            ## Drinks a potion
            ##

            elif "drink" in self.action.lower():

                return self.player.heal()


            ##
            ## Attacks the monster
            ##
            elif(self.action.lower()== "attack"):

                if not self.monster.killed and self.player.facesMonster:
                    return self.room.attackMonster(self.player)
                elif self.player.facesBoss:
                    boss = self.room.getBoss()
                    return boss.attackFromPlayer(self.player)
                else:
                    return self.handler.strActions("attackNoMonster",self.player,self.room)

            ##
            ## Flees from a monster
            ##
            elif(self.action.lower()== "flee"):

                time.sleep(2)
                if(self.player.facesMonster):
                    response = self.room.monster.flee(self.room, self.player)
                else:
                    response = self.handler.strActions("fleeNoMonster",self.player,self.room)
                text = self.handler.strActions("fleeing",self.player,self.room)
                for x in range (0,5):
                    b = text + "." * x
                    sys.stdout.write('\r'+b)
                    time.sleep(0.3)
                return response

            ##
            ## Tells the player what the room has inside
            ##

            elif(self.action.lower()== "look around"):
                self.room.inspectRoom()
                if self.room.hasChest and not self.room.chest.opened:
                    if self.room.inspected:
                        response = self.handler.strActions("lookClosedChest",self.player,self.room)
                    else:
                        response = self.handler.strActions("openChestNoLook",self.player,self.room)
                elif self.room.hasChest and self.room.chest.opened:
                    response = self.handler.strActions("lookOpenChest",self.player,self.room)
                else:
                    response = self.handler.strActions("lookNothing",self.player,self.room)
                text = self.handler.strActions("looking",self.player,self.room)
                for x in range (0,5):
                    b = text + "." * x
                    sys.stdout.write('\r'+b)
                    time.sleep(0.4)

                return "\n"+response

            ##
            ## Let's the player open a chest, if he has inspected the room already
            ##
            elif(self.action.lower()== "open chest"):
                if self.room.inspected:
                    if self.room.hasChest and not self.room.chest.opened:
                        response = self.handler.strActions("chestOpens",self.player,self.room) +"\n"+ str(self.room.openChest())
                    elif self.room.chest.opened:
                        return "\n"+self.handler.strActions("chestOpenAgain",self.player,self.room)
                else:
                    response = self.handler.strActions("openChestNoLook",self.player,self.room)
                text = self.handler.strActions("tryOpenChest",self.player,self.room)
                for x in range (0,5):
                    b = text + "." * x
                    sys.stdout.write('\r'+b)
                    time.sleep(0.2)
                return "\n"+response

            ##
            ## Displays the items the player has
            ##

            elif(self.action.lower()== "inventory"):
                if self.player.hasItems:
                    response = self.player.printInventory()
                else:
                    response = "You find some lint in your pockets, it looks pretty useless..."
                text = self.handler.strActions("searchingInventory",self.player,self.room)
                for x in range (0,5):
                    b = text + "." * x
                    sys.stdout.write('\r'+b)
                    time.sleep(0.5)
                return "\n\n"+response

            ##
            ## Just for debugging
            ##

            elif self.action == "info":
                return "Strength: "+str(self.player.getStrength()) + \
                "\nHP: "+str(self.player.getHP()) + \
                "\nLvl: "+str(self.player.level)+\
                "\nVictory: "+str(self.player.victory)+\
                "\nCondition: "+str(self.player.getCondition())+\
                "\nPrevCond: "+str(self.player.getPrevious())

            elif(self.action == "cheat"):
                self.player.lvlUp()
                self.player.strength = 10
                self.player.name ="Lazy Cheater"
                return "You cheater! From now on we will refer to you as"+Fore.CYAN+" %s"%(self.player.name)+Fore.WHITE

            elif(self.action == "p"):
                self.player.condition = "poisoned"
                return "poisoned"
            ##
            ## Displays available commands
            ##

            elif(self.action.lower() =="help"):
                return Back.WHITE + Fore.BLACK +"[attack] [inventory] [flee] [info] [continue] [equip x] [inventory] [look around] [open chest]" +Back.BLACK + Style.RESET_ALL + Style.BRIGHT

            ##
            ## Message if invalid command was used
            ##
            else:

                string = "Sorry, You cannot" + " '%s'.\n"%(self.action)+ \
                "Type" +Fore.CYAN+" help "+ Fore.WHITE+"to view currently available commands."
                return string
        ##
        ## Message if invalid command was used
        ##
        else:

            string = "Sorry, You cannot" + " '%s'.\n"%(self.action)+ \
            "Type" +Fore.CYAN+" help "+ Fore.WHITE+"to view currently available commands."
            return string
示例#11
0
class Endboss(object):
    def __init__(self):

        self.handler = Stringhandler()
        self.bossList = []
        self.byteBoss = Bosslist.ByteBoss()
        self.hipsterBoss = Bosslist.HipsterBoss()
        self.boss = None

    def randomBoss(self, player):
        self.bossList.append(self.byteBoss)
        self.bossList.append(self.hipsterBoss)
        # self.bossList.append("")
        # self.bossList.append("")
        self.boss = random.choice(self.bossList)
        return self.boss

    def kill(self):
        self.boss.killed = True

    def takeDamage(self, damage, player):
        self.boss.hp -= damage

    def getHP(self):
        return self.boss.hp

    def calcDamage(self):
        damage = self.boss.strength + random.randint(0, 3)
        return damage

    def attackFromPlayer(self, player):
        damage = player.getStrength() + random.randint(0, 3)
        if (self.boss.hp - damage <= 0):
            self.kill()
            player.facesBoss = False
            player.victory = True
            if isinstance(self.boss, ByteBoss):
                return self.handler.strBoss("bDie", player, damage)
            elif isinstance(self.boss, HipsterBoss):
                return self.handler.strBoss("hDie", player, damage)
            else:
                return "Error 404: Boss not found"
        else:
            self.takeDamage(damage, player)

            if isinstance(self.boss, ByteBoss):
                print self.handler.strBoss(
                    "bHit", player,
                    damage) + "\n" + self.handler.strMonsterDamage(
                        "returnHP", self.boss, damage, player)
                return "\n" + self.attack(player)
            elif isinstance(self.boss, HipsterBoss):
                print self.handler.strBoss(
                    "hHit", player,
                    damage) + "\n" + self.handler.strMonsterDamage(
                        "returnHP", self.boss, damage, player) + "\n"
                return self.attack(player)

    def attack(self, player):
        damage = self.calcDamage()
        if isinstance(self.boss, ByteBoss):
            return player.takeDamage(damage, self.boss)
        elif isinstance(self.boss, HipsterBoss):
            return player.takeDamage(damage, self.boss)

    def spawn(self, player):
        player.facesBoss = True
        damage = self.calcDamage()
        if isinstance(self.boss, ByteBoss):
            return self.handler.strBoss("bSpawn", player, damage)
        elif isinstance(self.boss, HipsterBoss):
            return self.handler.strBoss("hSpawn", player, damage)
示例#12
0
class Room(object):
    def __init__(self, difficulty, player):

        self.hasMonster = False
        self.hasBoss = False
        self.hasChest = False
        self.isDone = False
        self.difficulty = difficulty
        self.settings = Settings()
        self.goal = self.settings.getGoal()
        self.player = player
        self.chest = Chest(self.player)
        self.monster = Monster()
        self.inspected = False
        self.handler = Stringhandler()
        self.boss = Endboss()
        self.endboss = self.boss.randomBoss(player)

    # Sets up a new Room and displays some "Intro Text"
    def newRoom(self):
        self.isDone = False
        string = "\n\n#######################################"+"\n\n"+\
        self.handler.strRoom("intro",self)+"\n\n"+\
        "#######################################"+"\n\n"
        for char in string:
            time.sleep(uniform(0.05, 0.01))
            sys.stdout.write('\033[35m' + char)
            sys.stdout.flush()

        print Fore.WHITE

        # Decides whether the room gets a monster or a chest
        if int(self.player.level) <= int(self.goal):
            rnd = random.randint(0, 10)
            if rnd > 1:
                self.hasMonster = True
            else:
                self.hasChest = True

            # Setup monster
            if self.hasMonster:
                if self.difficulty == "easy":
                    self.monster.setup(1, self.player.level)
                else:
                    self.monster.setup(2, self.player.level)

            # Setup chest
            elif self.hasChest:
                if self.difficulty == "easy":
                    self.chest.level = random.randint(1, 10)
                    return self.handler.strActions("roomEmpty", self.player,
                                                   self)
                else:
                    self.chest.level = random.randint(1, 10)
            else:
                self.finish()
        else:
            self.hasBoss = True

            return self.boss.spawn(self.player)

    def getRoom(self, difficulty, player):
        return Room(difficulty, player)

    def getBoss(self):
        return self.boss

    # If the player has used "look around" the room should be set to inspected
    def inspectRoom(self):
        self.inspected = True

    # Kills the monster in this Room, required for the player to be able to continue -> Room set to "Done"
    def killMonster(self):
        self.monster.kill()
        self.player.lvlUp()
        self.finish()

    def attackMonster(self, player):
        room = self
        return self.monster.attack(room, player)

    # Opens the chest, required for the player to be able to continue -> Room set to "Done"
    def openChest(self):
        self.finish()
        return self.chest.open(self.player)

    def is_done(self):
        return self.isDone

    def finish(self):
        self.isDone = True
        if self.hasChest:
            self.chest.is_opened = True
示例#13
0
def play():

    handler = Stringhandler()
    settings = Settings()
    goal = settings.getGoal()
    difficulty = settings.difficulty
    player = Player()
    item = Items()


    intro = handler.strIntro()
    for char in "\n"+intro+"\n":
        time.sleep(uniform(0.05, 0.1))
        sys.stdout.write('\033[35m'+'\033[1m'+char)
        sys.stdout.flush()
    name_input = raw_input (Fore.CYAN +'\n>: ')
    player.name = name_input
#
# Asks for the player Name
#
    print Style.BRIGHT + Fore.WHITE
    greeting = handler.strGreeting(player)
    string = re.sub(r'(\x1b[^m]*m)',"", str(greeting+"\n"))
    pos = string.find(player.name)
    for index, char in enumerate(string):
        time.sleep(uniform(0.05, 0.1))
        if index >= pos and index < pos+len(player.name):
            sys.stdout.write('\033[36m'+char)
        elif index == pos+len(player.name):
            sys.stdout.write('\033[37m'+char)
        else:
            sys.stdout.write('\033[37m'+char)
        sys.stdout.flush()

    if not player.is_in_room:
        player.addItem(item.newPotion(0.2,5))
        room = Room(difficulty,player)
        time.sleep(0.5)
        chest = room.newRoom()
        string = room.monster.spawn(room,player)
        if room.hasMonster:
            player.is_in_room = True
            print str(string)
        else:
            print chest

#
# Game Loop start
#
    while player.is_alive():
        if player.victory:
            print self.handler.strBasic("win")
            end_input = raw_input(Fore.CYAN +"\n"+ player.name+ '>: ')
            if end_input.lower() == "restart":
                print handler.strBasic("restart")
                play()
            elif end_input.lower() == "exit":
                print handler.strBasic("exit")
                break;
        else:
            #print ("\nWhat do you want to do?\n")
            action_input = raw_input(Fore.CYAN +"\n"+ player.name+ '>: ')
            print Fore.WHITE
            if room.is_done() and ("go" in action_input.lower() or "walk" in action_input.lower() or "continue" in action_input.lower()):
                response = actions(action_input,player,room)
                print response
                room = room.getRoom(difficulty,player)
                chest = room.newRoom()
                string = room.monster.spawn(room,player)
                if room.hasMonster:
                    print str(string)
                else:
                    print chest

            elif action_input.lower() == "restart":
                player.alive = True
                print handler.strBasic("restart")
                play()
            elif action_input.lower() == "exit":
                print handler.strBasic("exit")
                break;

            else:
                # The magic happens here:
                time.sleep(0.5)
                print actions(action_input,player,room)

    if player.victory:
        print "Victory!"