示例#1
0
 def shield(self, value):
     current = self._shield
     if value <= 0:
         self._shield = 0
     elif value > self.max_shield:
         self._shield = self.max_shield
     else:
         self._shield = int(value)
         
     if current < value:
         post_output(f"{self.name} gains {value - current} shield")
     else:
         post_output(f"{self.name} loses {current - value} shield")
示例#2
0
 def interaction(self, world):
     post_output(
         "oi m8 shank that gobbo in the back and I'll give you a key")
     answer = yes_or_no()
     if answer:
         post_output("Nice")
         QM.start_quest("KillGoblin")
     else:
         post_output("No? Then die!")
         world.initiate_battle([self])
         raise EndGame("You win!",
                       victory=True,
                       reason=EndgameReason.victory)
示例#3
0
def l5_reward(levels, player):
    post_output("You leveled up to 5!")
    player.add_to_inventory(Sword())
示例#4
0
player = Player(
    max_health=100,
    damage=3,
    defense=2,
    max_energy=15,
    experience=ExperienceLevels(
        requirement=100, 
        modifier=1.2, 
        max_level=10, 
        reward=basic_reward,
        r3=lambda levels: levels.player.add_ability(HealSpell()),
        r5=lambda levels: levels.player.add_ability(WarRoarSpell()),
        r7=lambda levels: levels.player.add_ability(FireballSpell()),
    ),
    money=100,
    inventory=Inventory(items=[Sword()])
)
world = World(locations=[tavern, market, island, temple, docks, hidden, shop, beach, alley], player=player, start=market)

if __name__ == '__main__':
    QM.start_quest("KillBigGoblin")
    
    player.add_to_inventory(Sword())
    
    post_output("="*15)
    post_output("WELCOME TO TEMPLATE ZORK")
    post_output("="*15)
    post_output("The realm is in terrible danger. With entire kingdom on the border of chaos you, Generic Protagonist #12, must slay the Big Golbin in the temple, on the island south of the market.")
    input("press enter to begin")
    game_loop(world)
    
示例#5
0
 def reward(self, player, world):
     post_output("You have discovered a secret entrance to the temple")
     temple.two_way_connect(Direction.west, hidden)
示例#6
0
def reward(levels):
    levels.player.add_to_inventory(Sword())
    post_output(f"You are now level {levels.level}")
示例#7
0
def special_level5_reward(levels):
    post_output(f"Your power grows! You have reached level 5")
    levels.player.base_damage *= 1.5
    levels.player.base_defense *= 1.5
示例#8
0
 def interaction(self, world):
     if self.interacted:
         post_output("There is nothing left")
     else:
         post_output("You find a key in the drawer.")
         world.player.add_to_inventory(Key())
示例#9
0
 def print_interaction(self, world):
     post_output(
         "- Check the drawers of a weird looking table in the corner")
示例#10
0
 def print_interaction(self, world):
     post_output("- Talk to the old man in the corner")