Advertisement
Raggie

(old) DESKEMON PRE-ALPHA 1

May 8th, 2014
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 10.14 KB | None | 0 0
  1. import time
  2. import random
  3. import sys
  4.  
  5. """
  6. ALPHA STAGE:
  7.    DESKEMON SPECIAL ATTACKS 1
  8.    MORE DESKEMONS 2
  9.    RANDOM ROOMS 3
  10.    BUG FIX & COMBAT IMPROVEMENTS 4
  11.        ALPHA 1.4 RELEASE
  12.    MORE RANDOM ROOMS 5
  13.    IMPROVE STORY 6
  14.    CODE STRUCTURE CLEAN-UP 7
  15.        ALPHA 1.7 RELEASE
  16.  
  17. BETA STAGE:
  18.    DESKEMON EVOLUTION 1
  19.  
  20. """
  21.  
  22. game_key = random.randrange(11111, 99999)
  23.  
  24. ### Combat System ---------
  25.  
  26. def deskemon_selection_menu():
  27.     print("DESKEMON MENU:\n")
  28.     print("\t(1) TAMOSHA")
  29.     print("Capable of fast attacks and accuracy, low defense and average health pool.")
  30.     print("Special attack: QUIKHEAL. Sacrifice a percentage your attack accuracy to increase your health.\n")
  31.     print("\t(2) PICKAPOO")
  32.     print("All rounder in attack, strength and defense, but has low stamina with a decent health pool.")
  33.     print("Special attack: FLATULENCE BOLTS. Fire bolts of high concentrations of flatulence but decrease a percentage of your attack accuracy\n")
  34.     print("\t(3) LILWILLY")
  35.     print("High strength and health pool, low attack, defense and mobility.")
  36.     print("Special attack: WHITE LIES. Use with a high accuracy, high strength attack but sacrifing some of your health.\n")
  37.     print("\t(4) BIGGBOI")
  38.     print("Very low attack accuracy, decent strength, but very high levels of defense and constitution.")
  39.     print("Special attack: STEEL PUNCH. Jab your opponent with a terrifying blow! Whilst drastically losing your health.")
  40.     print("\nEnter your selection code:")
  41.  
  42.     ## BASIC COMBAT
  43.  
  44. class Deskemon(object):
  45.     def __init__(self, name, health, damage, defense):
  46.  
  47.         self.base_name = name
  48.         self.base_health = health
  49.         self.base_damage = damage
  50.         self.base_defense = defense
  51.  
  52.         self.name = self.base_name
  53.         self.health = self.base_health
  54.         self.damage = self.base_damage
  55.         self.defense = self.base_defense
  56.        
  57.     def attack(self):
  58.         return random.randrange(*self.damage)
  59.        
  60.     def defend(self):
  61.         return random.randrange(*self.defense)
  62.    
  63.     def specialattack(self, opponent):
  64.         return self.attack()
  65.      
  66.     def is_alive(self):
  67.         self.is_dead = self.health <= 0
  68.         return not self.is_dead
  69.        
  70.     def revive(self):
  71.         self.health = self.base_health
  72.         return True
  73.    
  74.     def run_away(self):
  75.         R = float( self.defense[1] - self.defense[0] )  / self.defense[0]  
  76.         return R <= random.random()
  77.          
  78.     def __repr__(self):
  79.         return self.name
  80.            
  81.     ## DEFINE OBJECTS
  82.  
  83.         # CHIPHEAD                
  84. Jack = Deskemon('CHIPHEAD', 300, (1, 10), (1, 5))
  85.  
  86.         # BOSS
  87. Boss = Deskemon('DR GALLASWAG', 700, (10, 15), (15, 20))
  88.  def boss_specialattack(opponent):
  89.     if opponent.defense != 1:
  90.         opponent.defense = map(lambda x: x - 10, opponent.defense)
  91.         print('{} defense have fallen sharply!'.upper().format(opponent))
  92.         return 1
  93. Boss.specialattack = boss_specialattack
  94.  
  95.         # TAMOSHA
  96.  
  97. TAMOSHA = Deskemon('TAMOSHA', 500, (75, 100), (25, 30))
  98. def tamosha_specialattack(opponent):
  99.     print("TAMOSHA's QUIKHEAL WAS EFFECTIVE")
  100.     self.defense -= float(self.defense / 30)
  101.     self.health += float(self.health / 30)
  102.     print("\nTAMOSHA's DEFENSE RATING WAS DECREASED BY 30%")
  103.     print("TAMOSHA's DEFENSE RATING IS NOW {}".format(str(self.defense)))
  104.     print("\nTAMOSHA's HEALTH WAS INCREASED BY 30%")
  105.     print("TAMOSHA's HEALTH IS NOW {}".format(str(self.health)))
  106.     return self.defense and self.health
  107. TAMOSHA.specialattack = tamosha_specialattack
  108.  
  109.         # PICKAPOO
  110.    
  111. PICKAPOO = Deskemon('PICKAPOO', 750, (65, 90), (30, 45))
  112. def pickapoo_specialattack(opponent):
  113.     print("PICKAPOO's FLATULENCE BOLTS WAS EFFECTIVE")
  114.     self.damage -= float(self.damage / 20)
  115.     damage_dealt = random.randrange(200, 250)
  116.     defender.health -= damage_dealt
  117.     print("\nPICKAPOO's DAMAGE RATING WAS DECREASED BY 20%")
  118.     print("PICKAPOO's DAMAGE RATING IS NOW {}".format(str(self.damage)))
  119.     return self.damage
  120.     print("PICKAPOO HAS INFLICTED {} TO {}".format(attacker, damage_dealt, defender))
  121. PICKAPOO.specialattack = pickapoo_specialattack
  122.  
  123.         # LILWILLY
  124.    
  125. LILWILLY = Deskemon('LILWILLY', 1000, (70, 115), (10, 15))
  126. def lilwilly_specialattack(opponent):
  127.     print("LILWILLY's WHITE LIES WAS EFFECTIVE")
  128.     if opponent.name == 'DR GALLASWAG':
  129.         damage_dealt = opponent.health
  130.         opponent.health = 0
  131.         return damage_dealt
  132.     self.health -= float(self.health / 30)
  133.     return self.health
  134.     print("\nLILWILLY's HEALTH WAS DECREASED BY 30%")
  135.     print("LILWILLY's HEALTH IS NOW {}".format(str(self.health)))
  136.     damage_dealt = random.randrange(175, 200)
  137.     defender.health -= damage_dealt
  138.     print("LILWILLY HAS INFLICTED {} TO {}".format(attacker, damage_dealt, defender))
  139. LILWILLY.specialattack = lilwilly_specialattack
  140.  
  141.         # BIGGBOI
  142.    
  143. BIGGBOI = Deskemon('BIGGBOI', 2000, (40, 65), (50, 60))
  144. def biggboi_specialattack(opponent):
  145.     print("BIGGBOI's STEEL PUNCH WAS EFFECTIVE")
  146.     damage_dealt = 500
  147.     self.health -= float(self.health / 30)
  148.     print("\nBIGGBOI's HEALTH WAS DECREASED BY 30%")
  149.     print("BIGGBOI's HEALTH IS NOW {}".format(str(self.health)))
  150.     defender.health -= damage_dealt
  151.     return self.health
  152.     print("BIGGBOI HAS INFLICTED {} TO {}".format(attacker, damage_dealt, defender))
  153. BIGGBOI.specialattack = biggboi_specialattack
  154.  
  155. def battle_menu(D2):
  156.     print("BATTLE MENU:\n")
  157.     print("\t(1) ATTACK")
  158.     print("\t(2) SPECIAL ATTACK")
  159.     print("\t(3) RUN AWAY")
  160.  
  161. def Battle(D1, D2):
  162.     print("LET'S BATTLE!")
  163.     while D1.is_alive() and D2.is_alive():
  164.         battle_menu(D2)
  165.         choice = input("> ")
  166.         if choice == '1':
  167.             Deskemon_Attack(D1, D2)
  168.         elif choice == '2':
  169.             Deskemon_Attack(D1, D2, special=(random.randrange(1, 100) <= 45))            
  170.         elif choice == '3':
  171.             if D2.name == "CHIPHEAD" or "DR GALLASWAG":
  172.                 print("{} prevents you from escaping!".upper().format(D2))
  173.             elif D2.name != "CHIPHEAD" or "DR GALLASWAG":
  174.                 print("{} attempts to run away!".upper().format(D1))
  175.                 if D1.run_away():
  176.                     print('{} has sucessfully ran away!'.upper().format(D1))
  177.                     break
  178.                 else:
  179.                     print('{} failed to run away!'.upper().format(D1))
  180.             else:
  181.                 break                
  182.         else:
  183.             continue
  184.         time.sleep(1)
  185.         print("...")
  186.         time.sleep(1)
  187.         print("...")
  188.         time.sleep(1)
  189.         print("...")
  190.         time.sleep(1)
  191.         Deskemon_Attack(D2, D1, special=(random.randrange(1, 100) <= 30))
  192.  
  193. def Deskemon_Attack(attacker, defender, special=False):
  194.     if attacker.is_dead:
  195.         if defender.name == "CHIPHEAD":
  196.             print("Your DESKEMON has died in his first battle.\nObviously, you are not ready.")
  197.             print("Program terminated.")
  198.             print("Have a nice day!")
  199.             time.sleep(2)
  200.             sys.exit(0)
  201.         return False
  202.        
  203.     if special == True:
  204.         if attacker.name == "TAMOSHA":
  205.             print("{} ATTEMPTS QUIKHEAL".format(attacker))
  206.         elif attacker.name == "PICKAPOO":
  207.             print("{} ATTEMPTS FLATULENCE BOLTS".format(attacker))
  208.         elif attacker.name == "LILWILLY":
  209.             print("{} ATTEMPTS WHITE LIES".format(attacker))
  210.         elif attacker.name == "BIGGBOI":
  211.             print("{} ATTEMPTS STEEL PUNCH".format(attacker))
  212.  
  213.         if special <= 45:
  214.             if attacker.name == "TAMOSHA":
  215.                 tamosha_specialattack(defender)
  216.             elif attacker.name == "PICKAPOO":
  217.                 pickapoo_specialattack(defender)
  218.             elif attacker.name == "LILWILLY":
  219.                 lilwilly_specialattack(defender)
  220.             elif attacker.name == "BIGGBOI":
  221.                 biggboi_specialattack(defender)
  222.         else:
  223.             if attacker.name == "TAMOSHA":
  224.                 print("{} FAILED QUIKHEAL".format(attacker))
  225.             elif attacker.name == "PICKAPOO":
  226.                 print("{} FAILED FLATULENCE BOLTS".format(attacker))
  227.             elif attacker.name == "LILWILLY":
  228.                 print("{} FAILED WHITE LIES".format(attacker))
  229.             elif attacker.name == "BIGGBOI":
  230.                 print("{} FAILED STEEL PUNCH".format(attacker))
  231.  
  232.     else:
  233.         damage_dealt = max(0, attacker.attack() - defender.defend())
  234.         defender.health -= damage_dealt
  235.         print("{} HAS INFLICTED {} TO {}".format(attacker, damage_dealt, defender))
  236.     if defender.is_alive():
  237.         print("{} HAS {} HITPOINTS LEFT!".format(defender, defender.health))
  238.         return True    
  239.     else:
  240.         print("{} HAS BEEN SLAIN BY {}!".format(defender, attacker))
  241.         return True
  242.  
  243. # ---------------------
  244.  
  245. print("Welcome to Deskemon Pre-Alpha V1.2".upper())
  246. print("What is your name?")
  247. name = input("> ")
  248. print("\n\nYou walk up to the console and switches on, 4 different types of Deskemon pops up on the screen.")
  249. time.sleep(1)
  250. print("...")
  251. time.sleep(1)
  252. print("...")
  253. time.sleep(1)
  254. print("...")
  255. time.sleep(1)
  256. print("\nWELCOME TO THE DESKEMON SELECTION CONSOLE V3.1")
  257. print("WITH ADDED COMMON COURTESY")
  258. time.sleep(1)
  259. print("\nWE HAVE A TOTAL OF 4 DESKEMONS READY FOR TAMING")
  260. time.sleep(1)
  261.  
  262. if '__main__' == __name__:
  263.     while True:
  264.         deskemon_selection_menu()
  265.         deskemon_selection_input = input("> ")
  266.         if deskemon_selection_input == "1":
  267.             deskemon = TAMOSHA
  268.         elif deskemon_selection_input == "2":
  269.             deskemon = PICKAPOO
  270.         elif deskemon_selection_input == "3":
  271.             deskemon = LILWILLY
  272.         elif deskemon_selection_input == "4":
  273.             deskemon = BIGGBOI
  274.         else:
  275.             continue
  276.         print("You have selected {} as your Deskemon".upper().format(deskemon))
  277.         break
  278.  
  279. print("Professor Andrew: Alright Jack, it's time to pick your Deskemon.")
  280. time.sleep(1)
  281. print("Jack: Hell yeah!.")
  282. time.sleep(1)
  283. print("JACK CHOSE CHIPHEAD!")
  284. time.sleep(1)
  285. print("Jack: OI! " + name + "!")
  286. time.sleep(1)
  287.  
  288. Battle(deskemon, Jack)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement