Esempio n. 1
0
 def readChosenItem(self):
     texty = Texty()           
     while (True):
         read = texty.readOneKeyFromPlayer()
         if (read == "c"):                
             return (-1)
         if (read.isdigit()):
                 intread = int(read)
                 if (intread >= 0 and intread < len(self.itemList)):
                     return self.itemList[intread]
         texty.showPlayer("%s is an invalid input, please try again." %(read))
Esempio n. 2
0
 def selectAction(self, enemy):
     from Game.CommandFactory import CommandFactory 
     texty = Texty()
     validInput = False
     cf = CommandFactory() 
     while (validInput == False):        
         texty.showPlayer("[P]ass, [S]kills, [I]tems, [F]lee, [Q]uit")
         read = texty.readOneKeyFromPlayer()
         read = read.lower() 
         if (read == "p"):
             return cf.create("doNothing", [self, enemy])          
         elif (read == "f"):
             return cf.create("flee", [self, enemy, random()])  
         elif (read == "i"):
             self.printItemMenu()
             item = self.readChosenItem()
             if (item != -1):
                 return cf.create("useItem", [self, enemy, item, random()])
         elif (read == "s"):
             self.printSkillMenu()
             skill = self.readChosenSkill()
             if (skill != -1):
                 return cf.create("useSkill", [self, enemy, skill, random()])
         elif (read == "q"):
             texty.showPlayer("Saving and quitting...")
             cf.create("Quit", [self, enemy, random()])
         else:
             texty.showPlayer("Comando no reconocido.")
Esempio n. 3
0
def analysisPhase(player):
    texty = Texty()
    while True:
        enemy = Unit.Unit("Enemy", 0)
        player.analyze()
        enemy.analyze()
        texty.showPlayer("Do you wish to fight this enemy?")
        read = texty.readOneKeyFromPlayer()
        read = read.lower()
        if read == "y":
            texty.showPlayer("You approach the enemy and fight!")
            return enemy
        else:
            texty.showPlayer("You bravely flee from your foe!")
Esempio n. 4
0
 def updateStatsAndLoot(self, player, enemy):
     texty = Texty()
     didGainStats = False
     if (enemy.str) > (player.str):
         gainedStats = (enemy.str-player.str)/5
         texty.showPlayer("You gained %d strength!" %(gainedStats))
         player.str = player.str + gainedStats
         didGainStats = True
     if (enemy.dex) > (player.dex):
         gainedStats = (enemy.dex-player.dex)/5
         texty.showPlayer("You gained %d dexterity!" %(gainedStats))
         player.dex = player.dex+gainedStats
         didGainStats = True       
     if (enemy.int > player.int):
         gainedStats = (enemy.int-player.int)/5
         texty.showPlayer("You gained %d int!" %(gainedStats))
         player.int = player.int + gainedStats
         didGainStats = True
     if ((didGainStats == False) and (len(enemy.skillList)>0)):
         texty.showPlayer("You got an item!")            
         player.addItem(Item(enemy))
     return didGainStats
Esempio n. 5
0
        enemy = Unit.Unit("Enemy", 0)
        player.analyze()
        enemy.analyze()
        texty.showPlayer("Do you wish to fight this enemy?")
        read = texty.readOneKeyFromPlayer()
        read = read.lower()
        if read == "y":
            texty.showPlayer("You approach the enemy and fight!")
            return enemy
        else:
            texty.showPlayer("You bravely flee from your foe!")


# MAIN

texty = Texty()
texty.setUp("network")
texty.getPlayerConnection()
texty.showPlayer("Hello, and welcome to the Enrichment Center. The Device Has Been Modified.")
playGame = True
gameOverFlag = False
cf = CommandFactory()
savvy = Savvy()
flagLoadedMidfight = False
if savvy.isMidFight():
    texty.showPlayer("Do you want to resume the fight?")
    read = texty.readOneKeyFromPlayer()
    if read == "y":
        cf.load()

        flagLoadedMidfight = True
Esempio n. 6
0
 def printSkillMenu(self):
     texty = Texty()   
     texty.showPlayer("Known skills:")
     for i, skill in enumerate(self.skillList):
         texty.showPlayer("%d) %s" %(i, skill.name))
         if (skill.timeUntilReuse > 0): texty.showPlayer ("On cooldown for %d" %(skill.timeUntilReuse))
Esempio n. 7
0
 def printItemMenu(self):
     texty = Texty()   
     texty.showPlayer("Owned items:")
     for (i, item) in enumerate(self.itemList):
         texty.showPlayer("%d) %s" %(i, item.name))           
Esempio n. 8
0
def stoneskinExpire(attacker, attacked, seed, statSource):
    texty = Texty()
    attacker.defense = attacker.defense-100
    texty.showPlayer("The stone layers crack and peel off your skin, turning to dust as they hit the ground.")
    return True
Esempio n. 9
0
def doBasicAttack(attacker, attacked, seed, statSource):
    texty = Texty()
    hit = attacker.dealDamage()
    attacked.printLoseHP(hit)
    texty.showPlayer("%s attacks for %d damage!" %(attacker.name, hit*attacker.displayScaleFactor))
Esempio n. 10
0
def fireball(attacker, attacked, seed, statSource):
    texty = Texty()
    dmg = seed*2000*statSource.attack
    attacked.hp -= dmg
    texty.showPlayer("The fireball strikes true! You deal "+ str(floor(dmg))+ " damage.")
    return True
Esempio n. 11
0
def stoneskin(attacker, attacked, seed, statSource):
    texty = Texty()
    attacker.defense = attacker.defense+100
    attacker.newEvent(Event.Event(attacker, attacker, 20, doNothing, 10, stoneskinExpire))
    texty.showPlayer("Your skin grows outwards, turning gray and jagged.")
    return True
Esempio n. 12
0
def regen(attacker, attacked, seed, statSource):
    texty = Texty()
    attacker.newEvent(Event.Event(attacker, attacker, 19, hot, 5, doNothing, statSource))
    texty.showPlayer("Healing energies gather around you.")
    return True
Esempio n. 13
0
def hot(attacker, attacked, seed, statSource):
    texty = Texty()
    healed = seed*100*statSource.int*statSource.defense/3
    attacker.hp += healed
    texty.showPlayer("Your spell continues mending your injuries. You recover " + str(floor(healed))+ " hp.")
    return True
Esempio n. 14
0
def heal(attacker, attacked, seed, statSource):
    texty = Texty()
    healed = seed*100*statSource.int*statSource.defense
    attacker.hp += healed
    texty.showPlayer("You heal your wounds! You recover " + str(floor(healed)) + " hp." )
    return True
Esempio n. 15
0
def magicWeaponExpire(attacker, attacked, seed, statSource):
    texty = Texty()
    attacker.attack = statSource.attack-100
    texty.showPlayer("Your weapon's shine fades.")
    return True
Esempio n. 16
0
def magicWeapon(attacker, attacked, seed, statSource):
    texty = Texty()
    attacker.attack = statSource.attack+100*statSource.int   
    attacker.newEvent(Event.Event(attacker, attacker, 20, doNothing, 10, magicWeaponExpire))
    texty.showPlayer("Your weapon glows with sharpening magic!")
    return True