Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##################################################
- ##################################################
- ### ####
- ### Python3 RPG Hero ####
- ### Version 1.4 ####
- ### Codes By: 0rX ####
- ### Description: ####
- ### This a simple RPG game for you. ####
- ### Coded in Python3 language. ####
- ### You need some help with this script ? ####
- ### Come ask me at: ####
- ### http://0rx.chatango.com/ ####
- ### or: ####
- ### http://monosekai.chatango.com/ ####
- ### ####
- ### ####
- ##################################################
- ##################################################
- import random
- import re
- def rpg():
- class Hero:
- def __init__(self, name):
- self.name = name
- self.level = 1
- self.job = "Priest"
- self.title = "Strider of the East"
- if self.job == "Cleric":
- self.critical = 125
- self.str = 50
- self.exp = 254
- self.max1 = 3154
- max2 = self.level*self.max1*2/3
- self.maxHp = int(max2)
- if self.job == "Priest":
- self.critical = 95
- self.str = 20
- self.exp = 254
- self.max1 = 4478
- max2 = self.level*self.max1*2/3
- self.maxHp = int(max2)
- self.health = self.maxHp
- def expGauge(self):
- rexp1 = 3500
- rexp2 = self.level*rexp1*2/3
- gauge1 = self.exp/rexp2
- gauge2 = float(gauge1)*100.00
- self.gauge = int(gauge2)
- def lvl(self):
- rexp1 = 3500
- rexp2 = self.level*rexp1*2/3
- if self.exp >= rexp2:
- self.level = self.level+1
- self.exp = self.exp - rexp2
- max2 = self.level*self.max1*2/3
- self.maxHp = int(max2)
- print("You just leveled up !! Congratulations %s"% self.name)
- else:
- pass
- def heal(self):
- if self.health < self.maxHp:
- if self.job == "Cleric":
- heal1 = 200
- heal2 = self.level*heal1*2
- hell = heal2/3
- heal3 = int(hell)
- heal4 = random.randint(heal3,heal2)
- self.health += heal4
- if self.job == "Priest":
- heal1 = 300
- heal2 = self.level*heal1*2
- hell = heal2/3
- heal3 = int(hell)
- heal4 = random.randint(heal3,heal2)
- self.health += heal4
- if self.health > self.maxHp:
- self.health = self.maxHp
- print ("hp full")
- else:
- print ("hp full")
- def attack(self):
- atta = player.level*player.str
- atte = atta + (self.critical*self.level)
- atti = atte + atta * 2 / 3
- self.dmg = random.randint(atta,int(atti))
- momon.health -= self.dmg
- class Enemy:
- def __init__(self, name):
- self.name = "Zombie"
- self.health = 5000
- self.critical = 35
- self._tasks = set()
- def attack(self):
- self.dmg = random.randint(300,500)
- dmg = self.dmg
- miss = "Zombie attacks but misses"
- atks = ("Zombie attacks and dealt %s damage !!"% dmg)
- chose = random.choice([miss,miss,miss,atks,miss,atks,miss])
- if chose == miss:
- pass
- if chose == atks:
- print(atks)
- player.health -= dmg
- global war
- war = False
- momon = Enemy("Zombie")
- heroname = str(input("Please enter your name: "))
- player = heroname
- if heroname == player:
- player = Hero(heroname)
- print ("Welcome to another world %s !!" %heroname)
- opt = ["help","rest","job 1","job 2","hunt","atk","heal","status"]
- while True:
- choice = str(input("-->"))
- if not choice in opt:
- print("Fail command !")
- player.expGauge()
- if war == True:
- momon.attack()
- if choice == "atk":
- if player.health <= 0:
- player.health = 0
- if player.health and momon.health > 0:
- player.attack()
- if momon.health <= 0 and not player.health <= 0:
- momon.health = 0
- print("You won !!!")
- war = False
- if player.health <= 0:
- player.health = 0
- print("You are dead")
- war = False
- if war == True:
- randex1 = 50
- randex2 = 200
- randex = random.randint(randex1,randex2)
- player.lvl()
- player.exp = player.exp+randex
- php = str(player.health)
- mhp = str(momon.health)
- print("%s's ~Hp: %s ~Damage: %s | %s's ~Hp: %s"% (player.name,php,player.dmg,momon.name,mhp))
- if choice == "heal":
- player.heal()
- php = str(player.health)
- mhp = str(momon.health)
- if player.health < player.maxHp:
- print("%s's HP: %s | %s ~hp: %s"% (player.name,php,momon.name,mhp))
- else:
- pass
- else:
- momon.health = 5000
- if choice == "status":
- apus = ("%s's status :\n~Hp : %s\n~Level : %s\n~Job : %s\n~Title : %s\n~Exp : %i%s"% (player.name,player.health,player.level,player.job,player.title,player.gauge,str("%")))
- print (str(apus))
- if choice == "help":
- print("Here are available commands for you honey: help, rest, job 1, job 2, hunt, atk, heal")
- if choice == "rest":
- player.health = int(player.maxHp)
- print("%s rests under a big cherry tree and recovers from all his wounds"% player.name)
- if choice == "atk":
- print("%s started a fight with a thug and got trashed"% player.name)
- if choice == "job 1":
- player.job = "Priest"
- print("You switched your Job and becomes a holy Priest")
- if choice == "job 2":
- player.job = "Cleric"
- print("You switched your Job and becomes a Mighty Cleric")
- if choice == "hunt":
- print("You approaches a Zombie and initiates a battle !!")
- war = True
- rpg()
Advertisement
Add Comment
Please, Sign In to add comment