TextRPG /

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

from rpg_lib.textrpg import *

hero = Char() # a generic human :)
peasant = Char(template=True) # A random human with random name. 
enemy = Char() # another generic human :)

story("""Welcome to the world of easy RPG scripting. 

I hope you enjoy your stay!

hero.say("""And welcome from me, too!

I hope we'll be able to go adventuring, soon!

besides: I'm Darjad Merejn.""") = "Darjad Merejn"

hero.say("""So now you know my name. Would you tell me yours?""")

name = ask("Your name:")

player = Char(source=",2008:" + name)

hero.say("So this time in style: Welcome " + + "!")

enemy.say("""How nice to see you. I hope you enjoy your glee. 

It won't last too long.

hero.say("""How dare you come here! 

I'll splatter your guts, Granash Barn!""") = "Granash Barn"

enemy.say("""Well well, try it!""")

hero.attack = 18 # A quite formidable fighter. 
enemy.attack = 18 # Same goes for him

peasant.attack = 6 # Knows not to grab a dagger from the wrong side. 

peasant.act("tries to get out of the way of " +

story( + " attacks " +

won = enemy.fight_round(peasant)[0]
if won: 
else: enemy.say("""Damn peasant.""")

hero.say("""How dare you! I'll taste your blood!""")

hero.act("attacks " +

while and 

   hero.say("""That's what they call villain these days. 

So now to you. You look kinda sorry for him. 

Seems I'll have to kill you, too.""")
   won = player.battle(hero)
   if not won: 
       story("""And so the adventure of """ + + """ended quite early.""")
   enemy.say("""So much for heroes. 

I hope you didn't stand with that bastard. I'm leaving. 

Want to come with me?""")

   join_the_enemy = ask("""Come with him? (Yes, no)""")

   if join_the_enemy.lower() in ["yes", "y", ""]: 
      enemy.say("""A wise decision. Now carry my bag.""")
      enemy.say("""That's too bad. Good luck for your future. 

And don't trust the heroes.

Do you want to fight me, then?""")

   fight = ask("Fight him? (Yes, no)")
   fight = "No"
if fight.lower() in ["yes", "y", ""]:
   won = player.battle(enemy)
   if not won:
      story("Sorry, you lost.")
   enemy.say("""A good fight.""")