TextRPG / ministory.py

#!/usr/bin/env python
# encoding: utf-8

from rpg_lib.textrpg import *

name = ask("What's your name?")

# First load the chars for better gameflow. 
char2 = Char(source="tag:1w6.org,2008:Nasfar")
char1 = Char(source="tag:1w6.org,2008:" + name)

# Skill competition: 
# won, diff = char1.compete_skill(char2, "cooking")
# won: If we won
# Diff: By how much we won or lost (always positive). 

story('''
Where the sun doesn't shine, 
and the stars flicker and wane, 
and terror reigns over the land, 
a hero is born to save us. 

Or not.

''')

char2.say("""I don't know about life or death or anything. I only know I want to live. 

I don't know about heroes, they come and go, but I persist, and I follow them when they move across the lands. 

Don't hope for the heroes. They will desert you when you need them most, because heroes live to die. 
But I live to live, so don't hope for my help, either. 

Please don't hope for my help.
""")


char1.say("""You're a wimp!
I'll show you "don't hope for my help"!

It's time to die!
""")


won = char1.battle(char2)

if won:
    char1.say("So much for 'you survive'!")
    char1.get_exp(1)
else:
    char2.say("Harr! You won't be the one to kill me!")

story("""And thus ends another battle on the plains of darkness.
""")

story(char1.name + " reached " + str(char1.exp) + " points of experience during these battles.")

if char1.exp >= 13: 
    story("""
which means you won at least 9 concurrent battles! Congratulations!""")
    if not won: 
        story("You can be sure that you'll get a place in the ranks of the best fighters of this place.")

# Try to cook a meal after battle: 
#story("""
#So now it's time to prepare the meal for the evening.""")
#
#success = char1.check_skill("cooking")
#if success: 
#    char1.say("At least he won't spoil my meal now.")
#else: 
#    char1.say("Gah! I shouldn't have tried to cook directly after a battle!")

save([char1, char2])
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.