Advertisement
gruntfutuk

rpgjhkjhjkh

Oct 26th, 2023
709
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 17.84 KB | None | 0 0
  1.     import random
  2.     from dataclasses import dataclass
  3.    
  4.    
  5.     @dataclass
  6.     class Response:
  7.         # detect player response
  8.         playerResponse: str
  9.    
  10.    
  11.     @dataclass
  12.     class Player:
  13.         # player stats
  14.         playerAC: int
  15.         playerMaxHealth: int
  16.         playerHealth: int
  17.         playerStrength: int
  18.         playerMagicka: int
  19.         playerCrit: int
  20.         playerPhysical: int
  21.         playerMagic: int
  22.    
  23.         def __str__(self):
  24.             return (
  25.                 f"\n##YOUR STATS##\n"
  26.                 f"AC: {self.playerAC}\n"
  27.                 f"Health: {self.playerHealth}/{myPlayer.playerMaxHealth}\n"
  28.                 f"Strength: {self.playerStrength}\n"
  29.                 f"magicka: {self.playerMagicka}\n"
  30.                 f"Crit Chance: {self.playerCrit}\n"
  31.                 f"Physical Resistance: {self.playerPhysical}\n"
  32.                 f"Magical Resistance: {self.playerMagic}\n"
  33.             )
  34.    
  35.    
  36.     @dataclass
  37.     class Ramsey:
  38.         # Ramsey Stats
  39.         ramseyAC: int
  40.         ramseyMaxHealth: int
  41.         ramseyHealth: int
  42.         ramseyStrength: int
  43.         ramseyMagicka: int
  44.         ramseyCrit: int
  45.         ramseyPhysical: int
  46.         ramseyMagic: int
  47.         ramseyClass: str
  48.         ramseyAbility: str
  49.         ramseyTick1: bool
  50.         ramseyTick2: bool
  51.         ramseyTick3: bool
  52.         ramseySanguineTreat: bool
  53.    
  54.    
  55.     @dataclass
  56.     class Room:
  57.         # rooms
  58.         room1: bool
  59.         room1pt2: bool
  60.         room2: bool
  61.         room3: bool
  62.         room4: bool
  63.         room4bite: bool
  64.         room4resist: bool
  65.         room5: bool
  66.         room5eat: bool
  67.         room5decline: bool
  68.         room6: bool
  69.         room7: bool
  70.         room8: bool
  71.         room9: bool
  72.         room10: bool
  73.    
  74.    
  75.     @dataclass
  76.     class Interactions:
  77.         room4int: int
  78.         firstFight: int
  79.    
  80.    
  81.     @dataclass
  82.     class Weapons:
  83.         punch: int
  84.    
  85.    
  86.     @dataclass
  87.     class Mechanics:
  88.         playerDamageToDeal: int
  89.         playerDamageDone: int
  90.         enemyDamageToDeal: int
  91.         enemyDamageDone: int
  92.         playerCritHit: int
  93.         enemyCritHit: int
  94.         playerRollToHit: int
  95.         enemyRollToHit: int
  96.         gameStarted: int
  97.    
  98.    
  99.     def statsDisplay():
  100.         # display stats to player
  101.         print(myPlayer)
  102.         myResponse.playerResponse = input("What would you like to do next: ")
  103.         print("")
  104.    
  105.    
  106.     # rooms and interactions
  107.     def firstFight():
  108.         print("Welcome to your first fight in the Vampire Manor!")
  109.         print("")
  110.         print("##HOW FIGHTS WORK##")
  111.         print("____________________")
  112.         print("Fights are one time and are unescapable, meaning once a fight has started, you must survive, so be careful!")
  113.         print("1. Your enemies stats will be shown so plan out your attack.")
  114.         print(
  115.             "2. Enemies have the same stats as you. Class and Special Ability: The class can help determine what type of enemy you are fighting, the special ability gives you a warning on the enemy's strongest move. AC: AC or armour class is the number you have to get to be able to hit the enemy which will be determined by a random D20 roll. Health: Once the enemy's health is reduced to 0, you win! Strength and Magicka: Strength is the stat that determines how much physical damage they do, and vice versa for magicka, certain weapons use different damage stats, so it's adivsed to build your character around one of these stats. Physical Resistance and Magic Resistance: These are the stats that protect the enemy, or you, from certain attacks, typically one resistance will be much lower than the other, so abuse it! Critical Chance: The higher you or your enemy's crit chance is, the more likely they are to deal double damage in one turn.")
  116.         print("3. Each round, you will have a choice of attacks to choose from, pick wisely, some have cooldowns.")
  117.         print("Good Luck!")
  118.         myInteraction.firstFight = True
  119.    
  120.    
  121.     def playRoom1():
  122.         myRoom.room1 = True
  123.         print("__________________________________________")
  124.         print("")
  125.         print(
  126.             "You awake from a coarse slumber, sat wreathed in your own blood. Your face feels cold and lifeless, your skin, a pale blue, and an intense hunger rages deep inside you. You lay inside an enclosed space, the walls are laid with soft pillow that feels quite comfortable, apart from the warm stickiness of your own blood, you’re locked in a coffin. Despite the stark appearance of your body, you feel unparalleled strength, hopefully enough to break yourself out.")
  127.         print("")
  128.         print("Enter: attack")
  129.         print("")
  130.         myResponse.playerResponse = input()
  131.    
  132.    
  133.     def playRoom1pt2():
  134.         myRoom.room1pt2 = True
  135.         print("__________________________________________")
  136.         print("")
  137.         print(
  138.             "As you look around, you see that the coffin you were in is placed in the centre of a small room. The building is cold and has an intricately designed gothic architecture, it’s dark, with small torches illuminating the surrounding area. There is only one exit, to your east.")
  139.         print("")
  140.         print("Exits: E")
  141.         print("")
  142.         print("Enter 'E' or 'east'")
  143.         print("")
  144.         myResponse.playerResponse = input()
  145.    
  146.    
  147.     def playRoom2():
  148.         myRoom.room2 = True
  149.         print("__________________________________________")
  150.         print("")
  151.         print(
  152.             "You enter into a large intersection, once again dimly lit with torches. To the south is an open archway that leads to another room. To the east is an open door and to the north is a large, locked gateway, adorned with silver and engraved with a symbol you don’t remember but it still feels familiar.")
  153.         print("")
  154.         print("Exits: E, S")
  155.         print("")
  156.         myResponse.playerResponse = input()
  157.    
  158.    
  159.     def playRoom4():
  160.         myRoom.room4 = True
  161.         if myInteraction.room4int == False:
  162.             print("__________________________________________")
  163.             print("")
  164.             print(
  165.                 "As you enter this room, a strong smell of flesh wafts over you, and as you look down, you see a lifeless human laying in a pool of their own blood. You feel an intense urge to fulfill your hunger, the body does seem fresh, however you know what you want to do is wrong.")
  166.             print("")
  167.             print("Enter: 'bite' or 'resist'")
  168.             print("")
  169.             myInteraction.room4int = True
  170.             myResponse.playerResponse = input()
  171.         elif myInteraction.room4int == True:
  172.             print("__________________________________________")
  173.             print("")
  174.             print("You're back in this room, the lifeless body lies here, staring blankly into space")
  175.             print("")
  176.             print("Exits: E, W, N")
  177.             print("")
  178.             myResponse.playerResponse = input()
  179.    
  180.    
  181.     def playRoom4bite():
  182.         myRoom.room4bite = True
  183.         print("__________________________________________")
  184.         print("")
  185.         print("You dig your fangs into the corpse, and as you do, you start to feel stronger and happier.")
  186.         print("")
  187.         print("Your corruption increases by 20%, but your health increases by 15")
  188.         print("")
  189.         print("Exits: E, W, N")
  190.         print("")
  191.         myResponse.playerResponse = input()
  192.    
  193.    
  194.     def playRoom4resist():
  195.         myRoom.room4resist = True
  196.         print("__________________________________________")
  197.         print("")
  198.         print("You resist the urge, the hunger still rages, but you feel slightly more at ease")
  199.         print("")
  200.         print("Exits: E, W, N")
  201.         print("")
  202.         myResponse.playerResponse = input()
  203.    
  204.    
  205.     def playRoom5():
  206.         myRoom.room5 = True
  207.         print("__________________________________________")
  208.         print("")
  209.         print(
  210.             "As you enter this room a soft and sweet smell wafts over you. As you look closer, you see a table laid with sanguine cloth and a vase of roses sits in the middle. The table holds an assortment of deserts, some puddings, some cake, some pastries, but all of them seem to have a hint of red.")
  211.         print("")
  212.         print("You see a woman, dressed in chef’s clothes walk towards you.")
  213.         print("")
  214.         print(
  215.             "Lady Ramsey: 'Oh hello newborn, looking for a meal?' She peers closer, her eyes giving an uncanny valley feel. 'They're fresh.'")
  216.         print("")
  217.         print("Enter: 'eat' or 'decline'")
  218.         print("")
  219.         myResponse.playerResponse = input()
  220.    
  221.    
  222.     def playRoom5eat():
  223.         myRoom.room5eat = True
  224.         print("__________________________________________")
  225.         print("")
  226.         print("Lady Ramsey: 'Isn’t it tasty? Made fresh with human blood.'")
  227.         print("")
  228.         print("Your corruption increases by 15%, but your  max health increases by 10")
  229.         print("")
  230.         print("Exits: E")
  231.         print("")
  232.         myResponse.playerResponse = input()
  233.    
  234.    
  235.     def playerDamage():
  236.         attack = input("What attack would you like to do?: ")
  237.         if attack == "punch":
  238.             myMechanics.playerDamageToDeal = myWeapons.punch
  239.    
  240.    
  241.     def ramseyDamage():
  242.         ramseyCritChance = random.randint(1, 100)
  243.         if myRamsey.ramseyTick1 == False and myRamsey.ramseyTick2 == False and myRamsey.ramseyTick3 == False:
  244.             myRamsey.ramseySanguineTreat = False
  245.             myRamsey.ramseyTick1 = True
  246.    
  247.             myMechanics.enemyDamageToDeal = myRamsey.ramseyMagicka
  248.             if ramseyCritChance > myRamsey.ramseyCrit:
  249.                 myMechanics.enemyDamageToDeal / 2
  250.    
  251.         elif myRamsey.ramseyTick1 and myRamsey.ramseyTick2 == False and myRamsey.ramseyTick3 == False:
  252.             myRamsey.ramseyTick2 = True
  253.    
  254.             myMechanics.enemyDamageToDeal = myRamsey.ramseyMagicka
  255.             if ramseyCritChance > myRamsey.ramseyCrit:
  256.                 myMechanics.enemyDamageToDeal / 2
  257.    
  258.         elif myRamsey.ramseyTick1 and myRamsey.ramseyTick2 and myRamsey.ramseyTick3 == False:
  259.             myRamsey.ramseyTick3 = True
  260.    
  261.             myMechanics.enemyDamageToDeal = myRamsey.ramseyMagicka
  262.             if ramseyCritChance > myRamsey.ramseyCrit:
  263.                 myMechanics.enemyDamageToDeal / 2
  264.    
  265.         elif myRamsey.ramseyTick1 and myRamsey.ramseyTick2 and myRamsey.ramseyTick3:
  266.             myRamsey.ramseySanguineTreat = True
  267.             myRamsey.ramseyTick1 = False
  268.             myRamsey.ramseyTick2 = False
  269.             myRamsey.ramseyTick3 = False
  270.    
  271.    
  272.     def ramseyHealthCheck():
  273.         if myRamsey.ramseyHealth > myRamsey.ramseyMaxHealth:
  274.             myRamsey.ramseyHealth = myRamsey.ramseyMaxHealth
  275.    
  276.    
  277.     def ramseyFight():
  278.         while myPlayer.playerHealth > 0 and myRamsey.ramseyHealth > 0:
  279.             playerDamage()
  280.             ramseyDamage()
  281.             myMechanics.playerRollToHit = random.randint(1, 20)
  282.             if myMechanics.playerRollToHit > myRamsey.ramseyAC:
  283.                 myRamsey.ramseyHealth = myRamsey.ramseyHealth - myMechanics.playerDamageToDeal
  284.                 print("You dealt Ramsey", myMechanics.playerDamageToDeal, "damage!")
  285.             elif myMechanics.playerRollToHit == 1:
  286.                 myPlayer.playerHealth = myPlayer.playerHealth - myMechanics.playerDamageToDeal / 2
  287.                 print("Critical miss! You dealt yourself", myMechanics.playerDamageToDeal / 2, "damage!")
  288.             elif myMechanics.playerRollToHit == 20:
  289.                 myRamsey.ramseyHealth = myRamsey.ramseyHealth - myMechanics.playerDamageToDeal * 1.5
  290.                 print("Critical hit! You dealt Ramsey", myMechanics.playerDamageToDeal * 1.5)
  291.             print("")
  292.             if myRamsey.ramseySanguineTreat == True:
  293.                 ramseyHeal = myPlayer.playerHealth * 0.2
  294.                 myPlayer.playerHealth = myPlayer.playerHealth - myPlayer.playerHealth * 0.2
  295.                 myRamsey.ramseyHealth = myRamsey.ramseyHealth + ramseyHeal
  296.                 ramseyHealthCheck()
  297.             elif myRamsey.ramseySanguineTreat == False:
  298.                 myMechanics.enemyRollToHit = random.randint(1, 20)
  299.                 if myMechanics.enemyRollToHit > myPlayer.playerAC:
  300.                     myPlayer.playerHealth = myPlayer.playerHealth - myMechanics.enemyDamageToDeal
  301.                     print("Ramsey dealt you", myMechanics.enemyDamageToDeal, "damage!")
  302.                 elif myMechanics.enemyRollToHit == 1:
  303.                     myRamsey.ramseyHealth = myRamsey.ramseyHealth - myMechanics.enemyDamageToDeal / 2
  304.                     print("Critical miss! Ramsey dealt herself", myMechanics.enemyDamageToDeal / 2, "damage!")
  305.                 elif myMechanics.enemyRollToHit == 20:
  306.                     myPlayer.playerHealth = myPlayer.playerHealth - myMechanics.enemyDamageToDeal * 1.5
  307.                     print("Critical hit! Ramsey dealt you", myMechanics.enemyDamageToDeal * 1.5, "damage!")
  308.         print("Well done! You have defeated Ramsey the Cook!")
  309.    
  310.    
  311.     def playRoom5decline():
  312.         myRoom.room5decline = True
  313.         print("__________________________________________")
  314.         print("")
  315.         print("Lady Ramsey: 'Wrong choice'")
  316.         print("")
  317.         if myInteraction.firstFight == False:
  318.             firstFight()
  319.             ramseyFight()
  320.         elif myInteraction.firstFight == True:
  321.             print("Good Luck!")
  322.             ramseyFight()
  323.    
  324.    
  325.     myResponse = Response(playerResponse="")
  326.     myResponse.playerResponse = input(
  327.         "Welcome brave adventurer, to get started enter 'start' but if you wish to familiarize yourself with your character, enter 'stats': ")
  328.     myPlayer = Player(playerAC=14, playerMaxHealth=100, playerHealth=100, playerStrength=30, playerMagicka=30,
  329.                       playerCrit=15, playerPhysical=20, playerMagic=5)
  330.     myRamsey = Ramsey(ramseyAC=12, ramseyMaxHealth=90, ramseyHealth=90, ramseyStrength=10, ramseyMagicka=40, ramseyCrit=10,
  331.                       ramseyPhysical=5, ramseyMagic=15, ramseyClass="Mage - Cook",
  332.                       ramseyAbility="Special Ability: Sanguine Treat – Lady Ramsey throws one of her special treats at her enemy, it deals damage equal to 10% of the enemy's total health and Lady Ramsey heals that much.",
  333.                       ramseyTick1=False, ramseyTick2=False, ramseyTick3=False, ramseySanguineTreat=False)
  334.     myRoom = Room(room1=False, room1pt2=False, room2=False, room3=False, room4=False, room4bite=False, room4resist=False,
  335.                   room5=False, room5eat=False, room5decline=False, room6=False, room7=False, room8=False, room9=False,
  336.                   room10=False)
  337.     myInteraction = Interactions(room4int=False, firstFight=False)
  338.     myWeapons = Weapons(punch=1)
  339.     # weapon calculations
  340.     while myPlayer.playerHealth > 0:
  341.         myWeapons.punch = myWeapons.punch * myPlayer.playerStrength / 2
  342.     myMechanics = Mechanics(playerDamageToDeal=0, playerDamageDone=False, enemyDamageToDeal=0, enemyDamageDone=False,
  343.                             playerCritHit=False, enemyCritHit=False, playerRollToHit=0, enemyRollToHit=0, gameStarted=False)
  344.    
  345.     while myPlayer.playerHealth > 0:
  346.         if myResponse.playerResponse == "stats":
  347.             myResponse.playerResponse = ""
  348.             statsDisplay()
  349.         elif myResponse.playerResponse == "start" and gameStarted == False:
  350.             myResponse.playerResponse = ""
  351.             gameStarted = True
  352.             playRoom1()
  353.         elif myResponse.playerResponse == "attack" and myRoom.room1 == True:
  354.             myResponse.playerResponse = ""
  355.             print("")
  356.             myRoom.room1 = False
  357.             playRoom1pt2()
  358.         elif ((myResponse.playerResponse == "E" or myResponse.playerResponse == "east") and myRoom.room1pt2 == True) or (
  359.                 (myResponse.playerResponse == "N" or myResponse.playerResponse == "north") and myRoom.room4 == True):
  360.             myResponse.playerResponse = ""
  361.             print("")
  362.             myRoom.room1pt2 = False
  363.             myRoom.room4 = False
  364.             playRoom2()
  365.         elif ((myResponse.playerResponse == "S" or myResponse.playerResponse == "south") and myRoom.room2 == True) or ((
  366.                                                                                                                                myResponse.playerResponse == "E" or myResponse.playerResponse == "east") and myRoom.room5 == True or myRoom.room5eat == True or myRoom.room5decline == True):
  367.             myResponse.playerResponse = ""
  368.             print("")
  369.             myRoom.room2 = False
  370.             myRoom.room5 = False
  371.             playRoom4()
  372.         elif myResponse.playerResponse == "bite" and myRoom.room4 == True:
  373.             myResponse.playerResponse = ""
  374.             print("")
  375.             myRoom.room4 = False
  376.             playRoom4bite()
  377.         elif myResponse.playerResponse == "resist" and myRoom.room4 == True:
  378.             myResponse.playerResponse = ""
  379.             print("")
  380.             myRoom.room4 = False
  381.             playRoom4resist()
  382.         elif ((myResponse.playerResponse == "W" or myResponse.playerResponse == "west") and (
  383.                 myRoom.room4 == True or myRoom.room4bite == True or myRoom.room4resist == True)):
  384.             myResponse.playerResponse = ""
  385.             print("")
  386.             myRoom.room4 = False
  387.             myRoom.room4bite = False
  388.             myRoom.room4resist = False
  389.             playRoom5()
  390.         elif myResponse.playerResponse == "eat" and myRoom.room5 == True:
  391.             myResponse.playerResponse = ""
  392.             print("")
  393.             myRoom.room5 = False
  394.             playRoom5eat()
  395.         elif myResponse.playerResponse == "decline" and myRoom.room5 == True:
  396.             myResponse.playerResponse = ""
  397.             print("")
  398.             myRoom.room5 = False
  399.             playRoom5decline()
  400.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement