示例#1
0
 def die(self):
     output.exclaim("Death...")
     input.pause()
     if self.settings["permadeath"]:
         self.alive = False
         output.exclaim("And darkness reigns...")
         input.pause()
         input.close()
         return
     output.exclaim(
         "Great streaks of light swirl around you... seep inside you... revive you..."
     )
     input.pause()
     if self.location.name != self.reviveLocation.name:
         output.exclaim("The light lifts you... moves you...")
         self.changeLocation(self.reviveLocation)
         input.pause()
     if self.level >= 5:
         output.exclaim("But for now you are still weak...")
         input.pause()
         output.separate()
         self.clearEffects()
         self.addEffect(
             effect.HealthBuff("summoning sickness of health", 100, -0.2))
         self.addEffect(
             effect.StrengthBuff("summoning sickness of strength", 100,
                                 -0.2))
         self.addEffect(
             effect.ArmorBuff("summoning sickness of armor", 100, -0.2))
     self.health = self.stats.health.getValue()
     output.bar()
示例#2
0
 def interact(self):
     if self.health <= 0:
         self.die(
         )  # player death here is arbitrary, but it will always occur because of the return statement at the beginning of self.act
         return
     # Make sure the player is up to date.
     self.updateAttributes()
     interaction = self.getInteraction()
     if interaction.activate() == "nothing":
         output.bar()
         return False
     # Make sure the player is up to date.
     self.updateAttributes()
     output.bar()
     return True
示例#3
0
 def start(self):
     self.initGame()
     while self.player.alive:
         try:
             self.player.act()
             self.player.interact()
         except Exception:
             output.bar()
             output.declare("! ERROR !")
             output.bar()
             output.bellow("Adventure has crashed. The program will quit after you answer this question. See Python traceback?")
             if input.yesNo():
                 traceback.print_exc()
                 input.getInput("end")
             break
     input.close()
示例#4
0
 def attack(self, target):
     if self.health < 100 and not self.calledDogs:
         # The player fights two of Aricnea's dogs when Aricnea gets low on health.
         self.calledDogs = True
         output.bar()
         output.exclaim(
             "Ha! You insect think to best me? Finish the swine, dogs!")
         output.bar()
         for i in range(2):  # player fights two dogs
             player.update()
             if self.dogFight.activate():  # if player dies, stop fight
                 return
         output.bellow(
             "Aaaah! You shall not defeat the forces of the undead... we are eternal!"
         )
         self.addEffect(
             effect.HealOverTime("glory for the undead", 2, 30, 50))
         self.addEffect(effect.StrengthBuff("battle rage", 9, 0.6))
     else:
         self.abilities.getOption(
             lambda ability: not ability.onCooldown()).activate(
                 self, target)
示例#5
0
 def start(self):
     self.monster.reset(
     )  # the same instance of the monster may have already been fought
     output.bar()
     output.declare("You have been attacked by " + self.monster.a + "!")
     output.bar()