Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- import random
- import sys
- """
- ALPHA STAGE:
- DESKEMON SPECIAL ATTACKS 1
- MORE DESKEMONS 2
- RANDOM ROOMS 3
- BUG FIX & COMBAT IMPROVEMENTS 4
- ALPHA 1.4 RELEASE
- MORE RANDOM ROOMS 5
- IMPROVE STORY 6
- CODE STRUCTURE CLEAN-UP 7
- ALPHA 1.7 RELEASE
- BETA STAGE:
- DESKEMON EVOLUTION 1
- """
- game_key = random.randrange(11111, 99999)
- ### Combat System ---------
- def deskemon_selection_menu():
- print("DESKEMON MENU:\n")
- print("\t(1) TAMOSHA")
- print("Capable of fast attacks and accuracy, low defense and average health pool.")
- print("Special attack: QUIKHEAL. Sacrifice a percentage your attack accuracy to increase your health.\n")
- print("\t(2) PICKAPOO")
- print("All rounder in attack, strength and defense, but has low stamina with a decent health pool.")
- print("Special attack: FLATULENCE BOLTS. Fire bolts of high concentrations of flatulence but decrease a percentage of your attack accuracy\n")
- print("\t(3) LILWILLY")
- print("High strength and health pool, low attack, defense and mobility.")
- print("Special attack: WHITE LIES. Use with a high accuracy, high strength attack but sacrifing some of your health.\n")
- print("\t(4) BIGGBOI")
- print("Very low attack accuracy, decent strength, but very high levels of defense and constitution.")
- print("Special attack: STEEL PUNCH. Jab your opponent with a terrifying blow! Whilst drastically losing your health.")
- print("\nEnter your selection code:")
- ## BASIC COMBAT
- class Deskemon(object):
- def __init__(self, name, health, damage, defense):
- self.base_name = name
- self.base_health = health
- self.base_damage = damage
- self.base_defense = defense
- self.name = self.base_name
- self.health = self.base_health
- self.damage = self.base_damage
- self.defense = self.base_defense
- def attack(self):
- return random.randrange(*self.damage)
- def defend(self):
- return random.randrange(*self.defense)
- def specialattack(self, opponent):
- return self.attack()
- def is_alive(self):
- self.is_dead = self.health <= 0
- return not self.is_dead
- def revive(self):
- self.health = self.base_health
- return True
- def run_away(self):
- R = float( self.defense[1] - self.defense[0] ) / self.defense[0]
- return R <= random.random()
- def __repr__(self):
- return self.name
- ## DEFINE OBJECTS
- # CHIPHEAD
- Jack = Deskemon('CHIPHEAD', 300, (1, 10), (1, 5))
- # BOSS
- Boss = Deskemon('DR GALLASWAG', 700, (10, 15), (15, 20))
- def boss_specialattack(opponent):
- if opponent.defense != 1:
- opponent.defense = map(lambda x: x - 10, opponent.defense)
- print('{} defense have fallen sharply!'.upper().format(opponent))
- return 1
- Boss.specialattack = boss_specialattack
- # TAMOSHA
- TAMOSHA = Deskemon('TAMOSHA', 500, (75, 100), (25, 30))
- def tamosha_specialattack(opponent):
- print("TAMOSHA's QUIKHEAL WAS EFFECTIVE")
- self.defense -= float(self.defense / 30)
- self.health += float(self.health / 30)
- print("\nTAMOSHA's DEFENSE RATING WAS DECREASED BY 30%")
- print("TAMOSHA's DEFENSE RATING IS NOW {}".format(str(self.defense)))
- print("\nTAMOSHA's HEALTH WAS INCREASED BY 30%")
- print("TAMOSHA's HEALTH IS NOW {}".format(str(self.health)))
- return self.defense and self.health
- TAMOSHA.specialattack = tamosha_specialattack
- # PICKAPOO
- PICKAPOO = Deskemon('PICKAPOO', 750, (65, 90), (30, 45))
- def pickapoo_specialattack(opponent):
- print("PICKAPOO's FLATULENCE BOLTS WAS EFFECTIVE")
- self.damage -= float(self.damage / 20)
- damage_dealt = random.randrange(200, 250)
- defender.health -= damage_dealt
- print("\nPICKAPOO's DAMAGE RATING WAS DECREASED BY 20%")
- print("PICKAPOO's DAMAGE RATING IS NOW {}".format(str(self.damage)))
- return self.damage
- print("PICKAPOO HAS INFLICTED {} TO {}".format(attacker, damage_dealt, defender))
- PICKAPOO.specialattack = pickapoo_specialattack
- # LILWILLY
- LILWILLY = Deskemon('LILWILLY', 1000, (70, 115), (10, 15))
- def lilwilly_specialattack(opponent):
- print("LILWILLY's WHITE LIES WAS EFFECTIVE")
- if opponent.name == 'DR GALLASWAG':
- damage_dealt = opponent.health
- opponent.health = 0
- return damage_dealt
- self.health -= float(self.health / 30)
- return self.health
- print("\nLILWILLY's HEALTH WAS DECREASED BY 30%")
- print("LILWILLY's HEALTH IS NOW {}".format(str(self.health)))
- damage_dealt = random.randrange(175, 200)
- defender.health -= damage_dealt
- print("LILWILLY HAS INFLICTED {} TO {}".format(attacker, damage_dealt, defender))
- LILWILLY.specialattack = lilwilly_specialattack
- # BIGGBOI
- BIGGBOI = Deskemon('BIGGBOI', 2000, (40, 65), (50, 60))
- def biggboi_specialattack(opponent):
- print("BIGGBOI's STEEL PUNCH WAS EFFECTIVE")
- damage_dealt = 500
- self.health -= float(self.health / 30)
- print("\nBIGGBOI's HEALTH WAS DECREASED BY 30%")
- print("BIGGBOI's HEALTH IS NOW {}".format(str(self.health)))
- defender.health -= damage_dealt
- return self.health
- print("BIGGBOI HAS INFLICTED {} TO {}".format(attacker, damage_dealt, defender))
- BIGGBOI.specialattack = biggboi_specialattack
- def battle_menu(D2):
- print("BATTLE MENU:\n")
- print("\t(1) ATTACK")
- print("\t(2) SPECIAL ATTACK")
- print("\t(3) RUN AWAY")
- def Battle(D1, D2):
- print("LET'S BATTLE!")
- while D1.is_alive() and D2.is_alive():
- battle_menu(D2)
- choice = input("> ")
- if choice == '1':
- Deskemon_Attack(D1, D2)
- elif choice == '2':
- Deskemon_Attack(D1, D2, special=(random.randrange(1, 100) <= 45))
- elif choice == '3':
- if D2.name == "CHIPHEAD" or "DR GALLASWAG":
- print("{} prevents you from escaping!".upper().format(D2))
- elif D2.name != "CHIPHEAD" or "DR GALLASWAG":
- print("{} attempts to run away!".upper().format(D1))
- if D1.run_away():
- print('{} has sucessfully ran away!'.upper().format(D1))
- break
- else:
- print('{} failed to run away!'.upper().format(D1))
- else:
- break
- else:
- continue
- time.sleep(1)
- print("...")
- time.sleep(1)
- print("...")
- time.sleep(1)
- print("...")
- time.sleep(1)
- Deskemon_Attack(D2, D1, special=(random.randrange(1, 100) <= 30))
- def Deskemon_Attack(attacker, defender, special=False):
- if attacker.is_dead:
- if defender.name == "CHIPHEAD":
- print("Your DESKEMON has died in his first battle.\nObviously, you are not ready.")
- print("Program terminated.")
- print("Have a nice day!")
- time.sleep(2)
- sys.exit(0)
- return False
- if special == True:
- if attacker.name == "TAMOSHA":
- print("{} ATTEMPTS QUIKHEAL".format(attacker))
- elif attacker.name == "PICKAPOO":
- print("{} ATTEMPTS FLATULENCE BOLTS".format(attacker))
- elif attacker.name == "LILWILLY":
- print("{} ATTEMPTS WHITE LIES".format(attacker))
- elif attacker.name == "BIGGBOI":
- print("{} ATTEMPTS STEEL PUNCH".format(attacker))
- if special <= 45:
- if attacker.name == "TAMOSHA":
- tamosha_specialattack(defender)
- elif attacker.name == "PICKAPOO":
- pickapoo_specialattack(defender)
- elif attacker.name == "LILWILLY":
- lilwilly_specialattack(defender)
- elif attacker.name == "BIGGBOI":
- biggboi_specialattack(defender)
- else:
- if attacker.name == "TAMOSHA":
- print("{} FAILED QUIKHEAL".format(attacker))
- elif attacker.name == "PICKAPOO":
- print("{} FAILED FLATULENCE BOLTS".format(attacker))
- elif attacker.name == "LILWILLY":
- print("{} FAILED WHITE LIES".format(attacker))
- elif attacker.name == "BIGGBOI":
- print("{} FAILED STEEL PUNCH".format(attacker))
- else:
- damage_dealt = max(0, attacker.attack() - defender.defend())
- defender.health -= damage_dealt
- print("{} HAS INFLICTED {} TO {}".format(attacker, damage_dealt, defender))
- if defender.is_alive():
- print("{} HAS {} HITPOINTS LEFT!".format(defender, defender.health))
- return True
- else:
- print("{} HAS BEEN SLAIN BY {}!".format(defender, attacker))
- return True
- # ---------------------
- print("Welcome to Deskemon Pre-Alpha V1.2".upper())
- print("What is your name?")
- name = input("> ")
- print("\n\nYou walk up to the console and switches on, 4 different types of Deskemon pops up on the screen.")
- time.sleep(1)
- print("...")
- time.sleep(1)
- print("...")
- time.sleep(1)
- print("...")
- time.sleep(1)
- print("\nWELCOME TO THE DESKEMON SELECTION CONSOLE V3.1")
- print("WITH ADDED COMMON COURTESY")
- time.sleep(1)
- print("\nWE HAVE A TOTAL OF 4 DESKEMONS READY FOR TAMING")
- time.sleep(1)
- if '__main__' == __name__:
- while True:
- deskemon_selection_menu()
- deskemon_selection_input = input("> ")
- if deskemon_selection_input == "1":
- deskemon = TAMOSHA
- elif deskemon_selection_input == "2":
- deskemon = PICKAPOO
- elif deskemon_selection_input == "3":
- deskemon = LILWILLY
- elif deskemon_selection_input == "4":
- deskemon = BIGGBOI
- else:
- continue
- print("You have selected {} as your Deskemon".upper().format(deskemon))
- break
- print("Professor Andrew: Alright Jack, it's time to pick your Deskemon.")
- time.sleep(1)
- print("Jack: Hell yeah!.")
- time.sleep(1)
- print("JACK CHOSE CHIPHEAD!")
- time.sleep(1)
- print("Jack: OI! " + name + "!")
- time.sleep(1)
- Battle(deskemon, Jack)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement