[text] Buckshot game

Viewer

copydownloadembedprintName: Buckshot game
  1. #Buckshot roulette
  2. import os
  3. import random
  4. import time
  5.  
  6. print()
  7. DEFAULT_HEALTH = 4
  8. dir_path = os.path.dirname(os.path.realpath(__file__))
  9.  
  10. rounds = 0
  11.  
  12. gun_side = open(os.path.join(dir_path,'gun-side.txt'),'r').read()
  13. gun_fwd = open(os.path.join(dir_path,'gun-forwards.txt'),'r').read()
  14. gun_back = open(os.path.join(dir_path,'gun-backwards-small.txt'),'r').read()
  15. explosion = open(os.path.join(dir_path,'explosion.txt'),'r').read()
  16. blank_round = open(os.path.join(dir_path,'blank-round.txt'),'r').read().splitlines()
  17. live_round = open(os.path.join(dir_path,'live-round.txt'),'r').read().splitlines()
  18.  
  19. def displayList(arr):
  20.     for i,s in enumerate(arr):
  21.         time.sleep(0.1)
  22.         print(f"{i+1}) {s}")
  23.  
  24. def displayRounds(live,blank,space=2):
  25.     s = ""
  26.     for line in range(len(blank_round)):
  27.         for _ in range(live):
  28.             s += live_round[line] + " "*space
  29.         for _ in range(blank):
  30.             s += blank_round[line] + " "*space
  31.         s += "\n"
  32.     print(s,end="")
  33.     
  34. def displayHelp():
  35.     print("\n+=====================+\n")
  36.     print("This game is based on the actual game 'buckshot roulette'.\nIn a nutshell, this is russian roulette.\nInfo: https://en.wikipedia.org/wiki/Buckshot_Roulette\n")
  37.     print("INSTRUCTIONS:")
  38.     print("    - OBJECTIVE: SURVIVE.")
  39.     print("    - A shotgun is loaded with a disclosed number of bullets, some of which will be blanks.")
  40.     print("    - Participants are given a set amount of lives (default = 4) to survive.")
  41.     print("    - You and 'The Dealer' will take turns shooting.")
  42.     print("    - Aim at The Dealer or at yourself - shooting yourself with a blank skips the Dealers turn.")
  43.     print("    - Participants are given items to help out. Use them wisely.")
  44.     print("    - if you have chosen wrongly, type 'q'/'quit'/'back' to go back.")
  45.     print()
  46.     print("ITEMS:")
  47.     print("    • 🚬 = Gives the user an extra life.")
  48.     print("    • 🍺 = Racks the shotgun and the bullet inside will be discarded.")
  49.     print("    • 🔪 = Shotgun will deal double damage for one turn.")
  50.     print("    • 🔍 = User will see what bullet is in the chamber.")
  51.     print("    • ⛓ = Handcuffs the other person so they miss their next turn.")
  52.     print("\nGood Luck.\n")
  53.     print("+=====================+")
  54.  
  55.  
  56. class Shotgun():
  57.     def __init__(self):
  58.         self.damage = 1
  59.         self.rounds = []
  60.     def doubleDamage(self):
  61.         self.damage = 2
  62.     def resetDamage(self):
  63.         self.damage = 1
  64.     
  65.     def addRounds(self,live=0,blank=0):
  66.         self.rounds.extend([True]*live)
  67.         self.rounds.extend([False]*blank)
  68.         random.shuffle(self.rounds)
  69.             
  70.     def pickRound(self):
  71.         l = len(self.rounds)
  72.         if not l: return
  73.         return self.rounds.pop()
  74.     
  75. class Player():
  76.     def __init__(self,health=DEFAULT_HEALTH,items=[]):
  77.         self.health = health
  78.         self.items = items
  79.         self.turnsWaiting = 0
  80.         
  81.     def takeDamage(self,dmg=1):
  82.         self.health = self.health - dmg
  83.         return (not self.health)
  84.     
  85.     def addHealth(self,health=1):
  86.         self.health = self.health +health
  87.     
  88.     def addRandomItems(self,n=None):
  89.         if not n:
  90.             n = random.randint(1,4)
  91.         items = ["⛓","🔪","🍺","🚬","🔍"]
  92.         self.items = [items[random.randint(0,4)] for _ in range(n)]
  93.             
  94.     def useItem(self,item, gun, effector):
  95.         if not item in self.items:
  96.             return False
  97.         
  98.         temp = self.items
  99.         temp.remove(item)
  100.         self.items = temp
  101.         print(f"[{name}] USED:",item)
  102.         time.sleep(1)
  103.         match item:
  104.             case '🔪':
  105.                 gun.doubleDamage()
  106.                 print("Shotgun now does 2 damage.")
  107.  
  108.             case '🔍':
  109.                 print("Shhhh~~~")
  110.                 time.sleep(1)
  111.                 print(".. The next round is..")
  112.                 time.sleep(2)
  113.                 print(["blank.", "LIVE."][gun.rounds[-1]])
  114.                 time.sleep(1)
  115.                 print("~~~~~~~~~~")
  116.  
  117.             case '⛓':
  118.                 if not effector: return False
  119.                 effector.missTurns(1)
  120.                 print("Dealer will now miss a turn.")
  121.             
  122.             case '🍺':
  123.                 print("Shotgun has been racked.")
  124.                 r = gun.pickRound()
  125.                 time.sleep(1)
  126.                 print("Round was..")
  127.                 time.sleep(1.5)
  128.                 print(["blank.","LIVE."][r])
  129.  
  130.             case '🚬':
  131.                 self.addHealth()
  132.                 print(self.health)
  133.  
  134.             case _:
  135.                 print("uhm....")
  136.                 time.sleep(3)
  137.                 print("Game does not recognise the item.")
  138.                 return False
  139.         time.sleep(1)
  140.         return True
  141.     
  142.     def missTurns(self,n=1):
  143.         self.turnsWaiting = n
  144.     
  145. class AI(Player):
  146.     def useItem(self,item,effector=None,gun=None):
  147.  
  148.         if item not in self.items or (
  149.                 item == '⛓' and effector.turnsWaiting) or (
  150.                 item == '🔪' and sg.damage != 1
  151.                 ): return False
  152.         temp = self.items
  153.         temp.remove(item)
  154.         self.items = temp
  155.  
  156.         print("[DEALER] used",item)
  157.         time.sleep(1.5)
  158.  
  159.         match item:
  160.             case '⛓':
  161.                 effector.missTurns()
  162.                 print("[DEALER] cuffed you.")
  163.             case '🔪':
  164.                 gun.doubleDamage()
  165.                 time.sleep(0.7)
  166.                 print("Shotgun now does 2 damage.")
  167.             case '🚬':
  168.                 self.addHealth()
  169.                 time.sleep(0.7)
  170.                 print("[DEALER] now has",self.health,"lives.")
  171.             case '🍺':
  172.                 print("Gun has been racked.")
  173.                 r = gun.pickRound()
  174.                 time.sleep(0.5)
  175.                 print("THE ROUND IS..")
  176.                 time.sleep(0.7)
  177.                 print()
  178.                 time.sleep(0.7)
  179.                 print(["blank.","LIVE."][r])
  180.             case '🔍':
  181.                 r = gun.rounds[-1]
  182.                 print("[DEALER] has inspected the gun 🔍...")
  183.                 time.sleep(1)
  184.                 print("##############################",r)
  185.                 if r:
  186.                     self.useItem('🔪',gun=gun)
  187.                     self.shoot(gun,effector)
  188.                     return True
  189.                 self.shoot(gun)
  190.                 return True
  191.                 
  192.         time.sleep(1)
  193.         return True
  194.  
  195.     def shoot(self,gun,effector=None):
  196.         r = gun.pickRound()
  197.  
  198.         if effector:
  199.             print("\n",gun_back,"\n")
  200.             time.sleep(2.3)
  201.             if r:
  202.                 if effector.health - gun.damage < 1:
  203.                     time.sleep(2)
  204.                     
  205.                 effector.takeDamage(gun.damage)
  206.                 print("\n",explosion,"\n")
  207.  
  208.                 if effector.health > 0:
  209.                     print("BOOM")
  210.                     time.sleep(0.8)
  211.                     print("You got shot.")
  212.                     time.sleep(1.4)
  213.                     print("Lives left:", effector.health)
  214.                     time.sleep(3)
  215.                     gun.resetDamage()
  216.                 return
  217.         else:
  218.             print("\n",gun_fwd,"\n")
  219.             time.sleep(2)
  220.             if r:
  221.                 self.takeDamage(1)
  222.                 print("\n",explosion,"\n")
  223.                 print("BOOM")
  224.                 time.sleep(0.5)
  225.                 print("Dealer was shot.")
  226.                 time.sleep(0.8)
  227.                 print("Dealer has", self.health ,"lives left.")
  228.                 time.sleep(1)
  229.                 gun.resetDamage()
  230.                 return
  231.         print("*click*")
  232.         time.sleep(0.8)
  233.         print("round was blank.")
  234.         time.sleep(1.5)
  235.         gun.resetDamage()
  236.  
  237.  
  238. sg = Shotgun()
  239. p1 = Player(DEFAULT_HEALTH)
  240. dealer = AI(DEFAULT_HEALTH)
  241.  
  242. time.sleep(1)
  243.  
  244. print("[DEALER]: PLEASE SIGN THE WAIVER.")
  245. askforhelp = ''
  246.  
  247. while askforhelp not in ["a","b"]:
  248.     askforhelp = input("(a) Read Waiver or (b) Sign and continue? ").lower().strip(" ")
  249.  
  250. if askforhelp == "a":
  251.     displayHelp()
  252.     input("READY? ")
  253.  
  254. name = ""
  255. while name in ["GOD","DEALER","SATAN"] or not (3 < len(name) < 10):
  256.     if name:
  257.         print("INVALID NAME.")
  258.     name = input("ENTER NAME: ").strip(" ").upper()
  259.  
  260.  
  261.  
  262.  
  263. while p1.health > 0 and dealer.health > 0:
  264.     # load the shotgun
  265.     live = random.randint(1,3)
  266.     blank =  random.randint(1,3)
  267.     sg.addRounds(live, blank)
  268.     print("\n",gun_side)
  269.     displayRounds(live,blank)
  270.     time.sleep(0.5)
  271.     print(f"{live} LIVE, {blank} BLANK\n")
  272.     time.sleep(4)
  273.  
  274.     if not rounds:
  275.         print("\"I INSERT THE SHELLS IN AN UNKNOWN ORDER.\"")
  276.     else:
  277.         print("\"THEY ENTER THE CHAMBER IN A HIDDEN SEQUENCE.\"")
  278.     time.sleep(4)
  279.     
  280.     #give the players items
  281.     p1.addRandomItems()
  282.     dealer.addRandomItems()
  283.     print("\nYour inventory:")
  284.     displayList(p1.items)
  285.     time.sleep(4)
  286.     print("\nDealer's inventory:")
  287.     displayList(dealer.items)
  288.     time.sleep(3)
  289.     
  290.     #start turns
  291.     turn = random.choice([True,False])
  292.     
  293.     
  294.     while sg.rounds and p1.health and dealer.health:
  295.         
  296.         if (turn and (not p1.turnsWaiting)) or dealer.turnsWaiting:
  297.             # =========> PLAYERS TURN TO CHOOSE
  298.             opt = ""
  299.             inp = ""
  300.  
  301.             if dealer.turnsWaiting:
  302.                 print("\n*Dealer skips their turn*")
  303.                 turn = not turn
  304.                 time.sleep(0.5)
  305.                 dealer.turnsWaiting = dealer.turnsWaiting - 1
  306.             
  307.             while sg.rounds:
  308.                 opt = ""
  309.  
  310.                 if p1.items:
  311.                     print("\n+==============+")
  312.                     print("Your items:")
  313.                     displayList(p1.items)
  314.                     print("+==============+")
  315.                     time.sleep(1)
  316.                     print("\nIT IS YOUR TURN.")
  317.                     print("(a) Use item")
  318.                     print("(b) Shoot")
  319.  
  320.                     while opt.lower().strip(" ") not in ["a","b"]:
  321.                         opt = input(" ").lower().strip(" ")
  322.  
  323.                 #endif
  324.  
  325.                 if opt == "a": # ======== > PLAYER USE ITEM
  326.                     inp = ""
  327.                     while (not inp.isdigit() or int(inp) < 1 or int(inp) > len(p1.items)) and inp not in ["quit","q","back","x"]:
  328.                         inp = input("Use: ")
  329.                         
  330.                     if inp not in ["quit","q","back","x"]:
  331.                         use = p1.useItem(p1.items[int(inp)-1],sg,dealer)
  332.                         
  333.                         if not use:
  334.                             print(inp,"not used.\n\n\n\n")
  335.                     time.sleep(1)
  336.  
  337.                 else: # ============= > PLAYER SHOOT
  338.                     print("\nShooting yourself will skip Dealer's turn if round is blank.\n")
  339.                     print("Shoot:")
  340.                     time.sleep(0.6)
  341.                     print("(a) DEALER")
  342.                     time.sleep(0.6)
  343.                     print("(b) YOU")
  344.                     inp = ""
  345.  
  346.                     while inp not in ["a","b","back","q","quit","x"]:
  347.                         inp = input(" ").lower().strip(" ")
  348.  
  349.                     
  350.                     time.sleep(0.5)
  351.                     
  352.                     if inp == "a": # shoot DEALER
  353.                         r = sg.pickRound()
  354.                         print("\n",gun_fwd,"\n")
  355.                         time.sleep(1.8)
  356.                         if r:
  357.                             dealer.takeDamage(sg.damage)
  358.                             print("\n",explosion,"\n")
  359.                             time.sleep(0.5)
  360.                             print("[DEALER] was shot.")
  361.                             print("Dealers health:", dealer.health)
  362.                             time.sleep(1.2)
  363.                         else:
  364.                             print("*click*")
  365.                             time.sleep(0.5)
  366.                             print("round was blank.")
  367.                             time.sleep(0.5)
  368.                             print()
  369.                         break
  370.                     elif inp == "b": # shoot YOURSELF
  371.                         r = sg.pickRound()
  372.                         print("\n",gun_back,"\n")
  373.                         time.sleep(2.5)
  374.                         if p1.health - sg.damage < 1:
  375.                             time.sleep(2)
  376.                         if r:
  377.                             p1.takeDamage(sg.damage)
  378.                             print("\n",explosion,"\n")
  379.                             if p1.health > 0 :
  380.                                 time.sleep(0.5)
  381.                                 print("You got shot.")
  382.                                 print(f"YOUR HEALTH:", p1.health)
  383.                                 time.sleep(1.2)
  384.                             break
  385.                         else:
  386.                             print("*click*")
  387.                             time.sleep(0.5)
  388.                             print("round was blank.")
  389.                             time.sleep(0.5)
  390.                             
  391.                     
  392.         else: #DEALERS turn
  393.             if p1.turnsWaiting:
  394.                 print("\nYou skip this turn.")
  395.                 turn = not turn
  396.                 time.sleep(1.5)
  397.                 p1.turnsWaiting = p1.turnsWaiting - 1
  398.  
  399.             print("\nDEALERS TURN.")
  400.             time.sleep(2)
  401.  
  402.             while sg.rounds:
  403.                 r = sg.rounds[-1]
  404.  
  405.                 # BEGIN AI DECIDING
  406.                 print("[DEALER] is chosing...")
  407.                 time.sleep(random.randint(15,45)/10)
  408.                 
  409.                 if False not in sg.rounds:
  410.                     dealer.useItem('🔪',gun=sg)
  411.                     dealer.shoot(sg,p1)
  412.                     break
  413.  
  414.                 if True not in sg.rounds:
  415.                     dealer.shoot(sg)
  416.                     continue
  417.                 
  418.                 if dealer.health < DEFAULT_HEALTH:
  419.                     if dealer.useItem('🚬'): continue
  420.  
  421.                 roundsLeft = len(sg.rounds)
  422.                 if roundsLeft < 5:
  423.                     if (sg.rounds.count(True)/roundsLeft) >= 0.5:
  424.                         if dealer.useItem('⛓',p1): continue
  425.                         if not p1.turnsWaiting and dealer.useItem('🔍',gun=sg): continue
  426.                         if random.choice(sg.rounds) and dealer.useItem('🔪',gun=sg): continue
  427.                         
  428.                         dealer.shoot(sg,p1)
  429.                         break
  430.                     
  431.                 
  432.                 # ⛓, mag.g, knf, cg, 🍺
  433.                 if random.choice([True,False]):
  434.                     dealer.useItem(random.choice(dealer.items),p1,sg)
  435.                     continue
  436.  
  437.                 temp = [None,p1][random.choice(sg.rounds)]
  438.                 dealer.shoot(sg,temp)
  439.                 sg.resetDamage()
  440.                 if temp != None:
  441.                     break
  442.                 if r: break
  443.  
  444.         turn = not turn
  445.         sg.resetDamage()
  446.         
  447.  
  448.     sg.resetDamage()
  449.     p1.turnsWaiting = 0
  450.     rounds +=1
  451.     dealer.turnsWaiting = 0
  452.     if p1.health > 0 and dealer.health > 0:
  453.         print("~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~")
  454.         print("..NEXT ROUND..")
  455.         time.sleep(2)
  456.         print("DEALER'S HEALTH:")
  457.         time.sleep(1)
  458.         print(dealer.health)
  459.         time.sleep(2)
  460.         print("YOUR HEALTH:")
  461.         time.sleep(1)
  462.         print(p1.health)
  463.         time.sleep(2)
  464.  
  465.  
  466.  
  467. c = 0
  468. while c < 700000:
  469.     c+=1
  470.     print("█",end="")
  471.  
  472. if not dealer.health:
  473.     print("\n\n\n\nThe dealer died.")
  474.     print("You win..")
  475. else:
  476.     print("\n\n\n\nYOU DIED.")#Buckshot roulette
  477. import os
  478. import random
  479. import time
  480.  
  481. print()
  482. DEFAULT_HEALTH = 4
  483. dir_path = os.path.dirname(os.path.realpath(__file__))
  484.  
  485. rounds = 0
  486.  
  487. gun_side = open(os.path.join(dir_path,'gun-side.txt'),'r').read()
  488. gun_fwd = open(os.path.join(dir_path,'gun-forwards.txt'),'r').read()
  489. gun_back = open(os.path.join(dir_path,'gun-backwards-small.txt'),'r').read()
  490. explosion = open(os.path.join(dir_path,'explosion.txt'),'r').read()
  491. blank_round = open(os.path.join(dir_path,'blank-round.txt'),'r').read().splitlines()
  492. live_round = open(os.path.join(dir_path,'live-round.txt'),'r').read().splitlines()
  493.  
  494. def displayList(arr):
  495.     for i,s in enumerate(arr):
  496.         time.sleep(0.1)
  497.         print(f"{i+1}) {s}")
  498.  
  499. def displayRounds(live,blank,space=2):
  500.     s = ""
  501.     for line in range(len(blank_round)):
  502.         for _ in range(live):
  503.             s += live_round[line] + " "*space
  504.         for _ in range(blank):
  505.             s += blank_round[line] + " "*space
  506.         s += "\n"
  507.     print(s,end="")
  508.     
  509. def displayHelp():
  510.     print("\n+=====================+\n")
  511.     print("This game is based on the actual game 'buckshot roulette'.\nIn a nutshell, this is russian roulette.\nInfo: https://en.wikipedia.org/wiki/Buckshot_Roulette\n")
  512.     print("INSTRUCTIONS:")
  513.     print("    - OBJECTIVE: SURVIVE.")
  514.     print("    - A shotgun is loaded with a disclosed number of bullets, some of which will be blanks.")
  515.     print("    - Participants are given a set amount of lives (default = 4) to survive.")
  516.     print("    - You and 'The Dealer' will take turns shooting.")
  517.     print("    - Aim at The Dealer or at yourself - shooting yourself with a blank skips the Dealers turn.")
  518.     print("    - Participants are given items to help out. Use them wisely.")
  519.     print("    - if you have chosen wrongly, type 'q'/'quit'/'back' to go back.")
  520.     print()
  521.     print("ITEMS:")
  522.     print("    • 🚬 = Gives the user an extra life.")
  523.     print("    • 🍺 = Racks the shotgun and the bullet inside will be discarded.")
  524.     print("    • 🔪 = Shotgun will deal double damage for one turn.")
  525.     print("    • 🔍 = User will see what bullet is in the chamber.")
  526.     print("    • ⛓ = Handcuffs the other person so they miss their next turn.")
  527.     print("\nGood Luck.\n")
  528.     print("+=====================+")
  529.  
  530.  
  531. class Shotgun():
  532.     def __init__(self):
  533.         self.damage = 1
  534.         self.rounds = []
  535.     def doubleDamage(self):
  536.         self.damage = 2
  537.     def resetDamage(self):
  538.         self.damage = 1
  539.     
  540.     def addRounds(self,live=0,blank=0):
  541.         self.rounds.extend([True]*live)
  542.         self.rounds.extend([False]*blank)
  543.         random.shuffle(self.rounds)
  544.             
  545.     def pickRound(self):
  546.         l = len(self.rounds)
  547.         if not l: return
  548.         return self.rounds.pop()
  549.     
  550. class Player():
  551.     def __init__(self,health=DEFAULT_HEALTH,items=[]):
  552.         self.health = health
  553.         self.items = items
  554.         self.turnsWaiting = 0
  555.         
  556.     def takeDamage(self,dmg=1):
  557.         self.health = self.health - dmg
  558.         return (not self.health)
  559.     
  560.     def addHealth(self,health=1):
  561.         self.health = self.health +health
  562.     
  563.     def addRandomItems(self,n=None):
  564.         if not n:
  565.             n = random.randint(1,4)
  566.         items = ["⛓","🔪","🍺","🚬","🔍"]
  567.         self.items = [items[random.randint(0,4)] for _ in range(n)]
  568.             
  569.     def useItem(self,item, gun, effector):
  570.         if not item in self.items:
  571.             return False
  572.         
  573.         temp = self.items
  574.         temp.remove(item)
  575.         self.items = temp
  576.         print(f"[{name}] USED:",item)
  577.         time.sleep(1)
  578.         match item:
  579.             case '🔪':
  580.                 gun.doubleDamage()
  581.                 print("Shotgun now does 2 damage.")
  582.  
  583.             case '🔍':
  584.                 print("Shhhh~~~")
  585.                 time.sleep(1)
  586.                 print(".. The next round is..")
  587.                 time.sleep(2)
  588.                 print(["blank.", "LIVE."][gun.rounds[-1]])
  589.                 time.sleep(1)
  590.                 print("~~~~~~~~~~")
  591.  
  592.             case '⛓':
  593.                 if not effector: return False
  594.                 effector.missTurns(1)
  595.                 print("Dealer will now miss a turn.")
  596.             
  597.             case '🍺':
  598.                 print("Shotgun has been racked.")
  599.                 r = gun.pickRound()
  600.                 time.sleep(1)
  601.                 print("Round was..")
  602.                 time.sleep(1.5)
  603.                 print(["blank.","LIVE."][r])
  604.  
  605.             case '🚬':
  606.                 self.addHealth()
  607.                 print(self.health)
  608.  
  609.             case _:
  610.                 print("uhm....")
  611.                 time.sleep(3)
  612.                 print("Game does not recognise the item.")
  613.                 return False
  614.         time.sleep(1)
  615.         return True
  616.     
  617.     def missTurns(self,n=1):
  618.         self.turnsWaiting = n
  619.     
  620. class AI(Player):
  621.     def useItem(self,item,effector=None,gun=None):
  622.  
  623.         if item not in self.items or (
  624.                 item == '⛓' and effector.turnsWaiting) or (
  625.                 item == '🔪' and sg.damage != 1
  626.                 ): return False
  627.         temp = self.items
  628.         temp.remove(item)
  629.         self.items = temp
  630.  
  631.         print("[DEALER] used",item)
  632.         time.sleep(1.5)
  633.  
  634.         match item:
  635.             case '⛓':
  636.                 effector.missTurns()
  637.                 print("[DEALER] cuffed you.")
  638.             case '🔪':
  639.                 gun.doubleDamage()
  640.                 time.sleep(0.7)
  641.                 print("Shotgun now does 2 damage.")
  642.             case '🚬':
  643.                 self.addHealth()
  644.                 time.sleep(0.7)
  645.                 print("[DEALER] now has",self.health,"lives.")
  646.             case '🍺':
  647.                 print("Gun has been racked.")
  648.                 r = gun.pickRound()
  649.                 time.sleep(0.5)
  650.                 print("THE ROUND IS..")
  651.                 time.sleep(0.7)
  652.                 print()
  653.                 time.sleep(0.7)
  654.                 print(["blank.","LIVE."][r])
  655.             case '🔍':
  656.                 r = gun.rounds[-1]
  657.                 print("[DEALER] has inspected the gun 🔍...")
  658.                 time.sleep(1)
  659.                 print("##############################",r)
  660.                 if r:
  661.                     self.useItem('🔪',gun=gun)
  662.                     self.shoot(gun,effector)
  663.                     return True
  664.                 self.shoot(gun)
  665.                 return True
  666.                 
  667.         time.sleep(1)
  668.         return True
  669.  
  670.     def shoot(self,gun,effector=None):
  671.         r = gun.pickRound()
  672.  
  673.         if effector:
  674.             print("\n",gun_back,"\n")
  675.             time.sleep(2.3)
  676.             if r:
  677.                 if effector.health - gun.damage < 1:
  678.                     time.sleep(2)
  679.                     
  680.                 effector.takeDamage(gun.damage)
  681.                 print("\n",explosion,"\n")
  682.  
  683.                 if effector.health > 0:
  684.                     print("BOOM")
  685.                     time.sleep(0.8)
  686.                     print("You got shot.")
  687.                     time.sleep(1.4)
  688.                     print("Lives left:", effector.health)
  689.                     time.sleep(3)
  690.                     gun.resetDamage()
  691.                 return
  692.         else:
  693.             print("\n",gun_fwd,"\n")
  694.             time.sleep(2)
  695.             if r:
  696.                 self.takeDamage(1)
  697.                 print("\n",explosion,"\n")
  698.                 print("BOOM")
  699.                 time.sleep(0.5)
  700.                 print("Dealer was shot.")
  701.                 time.sleep(0.8)
  702.                 print("Dealer has", self.health ,"lives left.")
  703.                 time.sleep(1)
  704.                 gun.resetDamage()
  705.                 return
  706.         print("*click*")
  707.         time.sleep(0.8)
  708.         print("round was blank.")
  709.         time.sleep(1.5)
  710.         gun.resetDamage()
  711.  
  712.  
  713. sg = Shotgun()
  714. p1 = Player(DEFAULT_HEALTH)
  715. dealer = AI(DEFAULT_HEALTH)
  716.  
  717. time.sleep(1)
  718.  
  719. print("[DEALER]: PLEASE SIGN THE WAIVER.")
  720. askforhelp = ''
  721.  
  722. while askforhelp not in ["a","b"]:
  723.     askforhelp = input("(a) Read Waiver or (b) Sign and continue? ").lower().strip(" ")
  724.  
  725. if askforhelp == "a":
  726.     displayHelp()
  727.     input("READY? ")
  728.  
  729. name = ""
  730. while name in ["GOD","DEALER","SATAN"] or not (3 < len(name) < 10):
  731.     if name:
  732.         print("INVALID NAME.")
  733.     name = input("ENTER NAME: ").strip(" ").upper()
  734.  
  735.  
  736.  
  737.  
  738. while p1.health > 0 and dealer.health > 0:
  739.     # load the shotgun
  740.     live = random.randint(1,3)
  741.     blank =  random.randint(1,3)
  742.     sg.addRounds(live, blank)
  743.     print("\n",gun_side)
  744.     displayRounds(live,blank)
  745.     time.sleep(0.5)
  746.     print(f"{live} LIVE, {blank} BLANK\n")
  747.     time.sleep(4)
  748.  
  749.     if not rounds:
  750.         print("\"I INSERT THE SHELLS IN AN UNKNOWN ORDER.\"")
  751.     else:
  752.         print("\"THEY ENTER THE CHAMBER IN A HIDDEN SEQUENCE.\"")
  753.     time.sleep(4)
  754.     
  755.     #give the players items
  756.     p1.addRandomItems()
  757.     dealer.addRandomItems()
  758.     print("\nYour inventory:")
  759.     displayList(p1.items)
  760.     time.sleep(4)
  761.     print("\nDealer's inventory:")
  762.     displayList(dealer.items)
  763.     time.sleep(3)
  764.     
  765.     #start turns
  766.     turn = random.choice([True,False])
  767.     
  768.     
  769.     while sg.rounds and p1.health and dealer.health:
  770.         
  771.         if (turn and (not p1.turnsWaiting)) or dealer.turnsWaiting:
  772.             # =========> PLAYERS TURN TO CHOOSE
  773.             opt = ""
  774.             inp = ""
  775.  
  776.             if dealer.turnsWaiting:
  777.                 print("\n*Dealer skips their turn*")
  778.                 turn = not turn
  779.                 time.sleep(0.5)
  780.                 dealer.turnsWaiting = dealer.turnsWaiting - 1
  781.             
  782.             while sg.rounds:
  783.                 opt = ""
  784.  
  785.                 if p1.items:
  786.                     print("\n+==============+")
  787.                     print("Your items:")
  788.                     displayList(p1.items)
  789.                     print("+==============+")
  790.                     time.sleep(1)
  791.                     print("\nIT IS YOUR TURN.")
  792.                     print("(a) Use item")
  793.                     print("(b) Shoot")
  794.  
  795.                     while opt.lower().strip(" ") not in ["a","b"]:
  796.                         opt = input(" ").lower().strip(" ")
  797.  
  798.                 #endif
  799.  
  800.                 if opt == "a": # ======== > PLAYER USE ITEM
  801.                     inp = ""
  802.                     while (not inp.isdigit() or int(inp) < 1 or int(inp) > len(p1.items)) and inp not in ["quit","q","back","x"]:
  803.                         inp = input("Use: ")
  804.                         
  805.                     if inp not in ["quit","q","back","x"]:
  806.                         use = p1.useItem(p1.items[int(inp)-1],sg,dealer)
  807.                         
  808.                         if not use:
  809.                             print(inp,"not used.\n\n\n\n")
  810.                     time.sleep(1)
  811.  
  812.                 else: # ============= > PLAYER SHOOT
  813.                     print("\nShooting yourself will skip Dealer's turn if round is blank.\n")
  814.                     print("Shoot:")
  815.                     time.sleep(0.6)
  816.                     print("(a) DEALER")
  817.                     time.sleep(0.6)
  818.                     print("(b) YOU")
  819.                     inp = ""
  820.  
  821.                     while inp not in ["a","b","back","q","quit","x"]:
  822.                         inp = input(" ").lower().strip(" ")
  823.  
  824.                     
  825.                     time.sleep(0.5)
  826.                     
  827.                     if inp == "a": # shoot DEALER
  828.                         r = sg.pickRound()
  829.                         print("\n",gun_fwd,"\n")
  830.                         time.sleep(1.8)
  831.                         if r:
  832.                             dealer.takeDamage(sg.damage)
  833.                             print("\n",explosion,"\n")
  834.                             time.sleep(0.5)
  835.                             print("[DEALER] was shot.")
  836.                             print("Dealers health:", dealer.health)
  837.                             time.sleep(1.2)
  838.                         else:
  839.                             print("*click*")
  840.                             time.sleep(0.5)
  841.                             print("round was blank.")
  842.                             time.sleep(0.5)
  843.                             print()
  844.                         break
  845.                     elif inp == "b": # shoot YOURSELF
  846.                         r = sg.pickRound()
  847.                         print("\n",gun_back,"\n")
  848.                         time.sleep(2.5)
  849.                         if p1.health - sg.damage < 1:
  850.                             time.sleep(2)
  851.                         if r:
  852.                             p1.takeDamage(sg.damage)
  853.                             print("\n",explosion,"\n")
  854.                             if p1.health > 0 :
  855.                                 time.sleep(0.5)
  856.                                 print("You got shot.")
  857.                                 print(f"YOUR HEALTH:", p1.health)
  858.                                 time.sleep(1.2)
  859.                             break
  860.                         else:
  861.                             print("*click*")
  862.                             time.sleep(0.5)
  863.                             print("round was blank.")
  864.                             time.sleep(0.5)
  865.                             
  866.                     
  867.         else: #DEALERS turn
  868.             if p1.turnsWaiting:
  869.                 print("\nYou skip this turn.")
  870.                 turn = not turn
  871.                 time.sleep(1.5)
  872.                 p1.turnsWaiting = p1.turnsWaiting - 1
  873.  
  874.             print("\nDEALERS TURN.")
  875.             time.sleep(2)
  876.  
  877.             while sg.rounds:
  878.                 r = sg.rounds[-1]
  879.  
  880.                 # BEGIN AI DECIDING
  881.                 print("[DEALER] is chosing...")
  882.                 time.sleep(random.randint(15,45)/10)
  883.                 
  884.                 if False not in sg.rounds:
  885.                     dealer.useItem('🔪',gun=sg)
  886.                     dealer.shoot(sg,p1)
  887.                     break
  888.  
  889.                 if True not in sg.rounds:
  890.                     dealer.shoot(sg)
  891.                     continue
  892.                 
  893.                 if dealer.health < DEFAULT_HEALTH:
  894.                     if dealer.useItem('🚬'): continue
  895.  
  896.                 roundsLeft = len(sg.rounds)
  897.                 if roundsLeft < 5:
  898.                     if (sg.rounds.count(True)/roundsLeft) >= 0.5:
  899.                         if dealer.useItem('⛓',p1): continue
  900.                         if not p1.turnsWaiting and dealer.useItem('🔍',gun=sg): continue
  901.                         if random.choice(sg.rounds) and dealer.useItem('🔪',gun=sg): continue
  902.                         
  903.                         dealer.shoot(sg,p1)
  904.                         break
  905.                     
  906.                 
  907.                 # ⛓, mag.g, knf, cg, 🍺
  908.                 if random.choice([True,False]):
  909.                     dealer.useItem(random.choice(dealer.items),p1,sg)
  910.                     continue
  911.  
  912.                 temp = [None,p1][random.choice(sg.rounds)]
  913.                 dealer.shoot(sg,temp)
  914.                 sg.resetDamage()
  915.                 if temp != None:
  916.                     break
  917.                 if r: break
  918.  
  919.         turn = not turn
  920.         sg.resetDamage()
  921.         
  922.  
  923.     sg.resetDamage()
  924.     p1.turnsWaiting = 0
  925.     rounds +=1
  926.     dealer.turnsWaiting = 0
  927.     if p1.health > 0 and dealer.health > 0:
  928.         print("~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~")
  929.         print("..NEXT ROUND..")
  930.         time.sleep(2)
  931.         print("DEALER'S HEALTH:")
  932.         time.sleep(1)
  933.         print(dealer.health)
  934.         time.sleep(2)
  935.         print("YOUR HEALTH:")
  936.         time.sleep(1)
  937.         print(p1.health)
  938.         time.sleep(2)
  939.  
  940.  
  941.  
  942. c = 0
  943. while c < 700000:
  944.     c+=1
  945.     print("█",end="")
  946.  
  947. if not dealer.health:
  948.     print("\n\n\n\nThe dealer died.")
  949.     print("You win..")
  950. else:
  951.     print("\n\n\n\nYOU DIED.")#Buckshot roulette
  952. import os
  953. import random
  954. import time
  955.  
  956. print()
  957. DEFAULT_HEALTH = 4
  958. dir_path = os.path.dirname(os.path.realpath(__file__))
  959.  
  960. rounds = 0
  961.  
  962. gun_side = open(os.path.join(dir_path,'gun-side.txt'),'r').read()
  963. gun_fwd = open(os.path.join(dir_path,'gun-forwards.txt'),'r').read()
  964. gun_back = open(os.path.join(dir_path,'gun-backwards-small.txt'),'r').read()
  965. explosion = open(os.path.join(dir_path,'explosion.txt'),'r').read()
  966. blank_round = open(os.path.join(dir_path,'blank-round.txt'),'r').read().splitlines()
  967. live_round = open(os.path.join(dir_path,'live-round.txt'),'r').read().splitlines()
  968.  
  969. def displayList(arr):
  970.     for i,s in enumerate(arr):
  971.         time.sleep(0.1)
  972.         print(f"{i+1}) {s}")
  973.  
  974. def displayRounds(live,blank,space=2):
  975.     s = ""
  976.     for line in range(len(blank_round)):
  977.         for _ in range(live):
  978.             s += live_round[line] + " "*space
  979.         for _ in range(blank):
  980.             s += blank_round[line] + " "*space
  981.         s += "\n"
  982.     print(s,end="")
  983.     
  984. def displayHelp():
  985.     print("\n+=====================+\n")
  986.     print("This game is based on the actual game 'buckshot roulette'.\nIn a nutshell, this is russian roulette.\nInfo: https://en.wikipedia.org/wiki/Buckshot_Roulette\n")
  987.     print("INSTRUCTIONS:")
  988.     print("    - OBJECTIVE: SURVIVE.")
  989.     print("    - A shotgun is loaded with a disclosed number of bullets, some of which will be blanks.")
  990.     print("    - Participants are given a set amount of lives (default = 4) to survive.")
  991.     print("    - You and 'The Dealer' will take turns shooting.")
  992.     print("    - Aim at The Dealer or at yourself - shooting yourself with a blank skips the Dealers turn.")
  993.     print("    - Participants are given items to help out. Use them wisely.")
  994.     print("    - if you have chosen wrongly, type 'q'/'quit'/'back' to go back.")
  995.     print()
  996.     print("ITEMS:")
  997.     print("    • 🚬 = Gives the user an extra life.")
  998.     print("    • 🍺 = Racks the shotgun and the bullet inside will be discarded.")
  999.     print("    • 🔪 = Shotgun will deal double damage for one turn.")
  1000.     print("    • 🔍 = User will see what bullet is in the chamber.")
  1001.     print("    • ⛓ = Handcuffs the other person so they miss their next turn.")
  1002.     print("\nGood Luck.\n")
  1003.     print("+=====================+")
  1004.  
  1005.  
  1006. class Shotgun():
  1007.     def __init__(self):
  1008.         self.damage = 1
  1009.         self.rounds = []
  1010.     def doubleDamage(self):
  1011.         self.damage = 2
  1012.     def resetDamage(self):
  1013.         self.damage = 1
  1014.     
  1015.     def addRounds(self,live=0,blank=0):
  1016.         self.rounds.extend([True]*live)
  1017.         self.rounds.extend([False]*blank)
  1018.         random.shuffle(self.rounds)
  1019.             
  1020.     def pickRound(self):
  1021.         l = len(self.rounds)
  1022.         if not l: return
  1023.         return self.rounds.pop()
  1024.     
  1025. class Player():
  1026.     def __init__(self,health=DEFAULT_HEALTH,items=[]):
  1027.         self.health = health
  1028.         self.items = items
  1029.         self.turnsWaiting = 0
  1030.         
  1031.     def takeDamage(self,dmg=1):
  1032.         self.health = self.health - dmg
  1033.         return (not self.health)
  1034.     
  1035.     def addHealth(self,health=1):
  1036.         self.health = self.health +health
  1037.     
  1038.     def addRandomItems(self,n=None):
  1039.         if not n:
  1040.             n = random.randint(1,4)
  1041.         items = ["⛓","🔪","🍺","🚬","🔍"]
  1042.         self.items = [items[random.randint(0,4)] for _ in range(n)]
  1043.             
  1044.     def useItem(self,item, gun, effector):
  1045.         if not item in self.items:
  1046.             return False
  1047.         
  1048.         temp = self.items
  1049.         temp.remove(item)
  1050.         self.items = temp
  1051.         print(f"[{name}] USED:",item)
  1052.         time.sleep(1)
  1053.         match item:
  1054.             case '🔪':
  1055.                 gun.doubleDamage()
  1056.                 print("Shotgun now does 2 damage.")
  1057.  
  1058.             case '🔍':
  1059.                 print("Shhhh~~~")
  1060.                 time.sleep(1)
  1061.                 print(".. The next round is..")
  1062.                 time.sleep(2)
  1063.                 print(["blank.", "LIVE."][gun.rounds[-1]])
  1064.                 time.sleep(1)
  1065.                 print("~~~~~~~~~~")
  1066.  
  1067.             case '⛓':
  1068.                 if not effector: return False
  1069.                 effector.missTurns(1)
  1070.                 print("Dealer will now miss a turn.")
  1071.             
  1072.             case '🍺':
  1073.                 print("Shotgun has been racked.")
  1074.                 r = gun.pickRound()
  1075.                 time.sleep(1)
  1076.                 print("Round was..")
  1077.                 time.sleep(1.5)
  1078.                 print(["blank.","LIVE."][r])
  1079.  
  1080.             case '🚬':
  1081.                 self.addHealth()
  1082.                 print(self.health)
  1083.  
  1084.             case _:
  1085.                 print("uhm....")
  1086.                 time.sleep(3)
  1087.                 print("Game does not recognise the item.")
  1088.                 return False
  1089.         time.sleep(1)
  1090.         return True
  1091.     
  1092.     def missTurns(self,n=1):
  1093.         self.turnsWaiting = n
  1094.     
  1095. class AI(Player):
  1096.     def useItem(self,item,effector=None,gun=None):
  1097.  
  1098.         if item not in self.items or (
  1099.                 item == '⛓' and effector.turnsWaiting) or (
  1100.                 item == '🔪' and sg.damage != 1
  1101.                 ): return False
  1102.         temp = self.items
  1103.         temp.remove(item)
  1104.         self.items = temp
  1105.  
  1106.         print("[DEALER] used",item)
  1107.         time.sleep(1.5)
  1108.  
  1109.         match item:
  1110.             case '⛓':
  1111.                 effector.missTurns()
  1112.                 print("[DEALER] cuffed you.")
  1113.             case '🔪':
  1114.                 gun.doubleDamage()
  1115.                 time.sleep(0.7)
  1116.                 print("Shotgun now does 2 damage.")
  1117.             case '🚬':
  1118.                 self.addHealth()
  1119.                 time.sleep(0.7)
  1120.                 print("[DEALER] now has",self.health,"lives.")
  1121.             case '🍺':
  1122.                 print("Gun has been racked.")
  1123.                 r = gun.pickRound()
  1124.                 time.sleep(0.5)
  1125.                 print("THE ROUND IS..")
  1126.                 time.sleep(0.7)
  1127.                 print()
  1128.                 time.sleep(0.7)
  1129.                 print(["blank.","LIVE."][r])
  1130.             case '🔍':
  1131.                 r = gun.rounds[-1]
  1132.                 print("[DEALER] has inspected the gun 🔍...")
  1133.                 time.sleep(1)
  1134.                 print("##############################",r)
  1135.                 if r:
  1136.                     self.useItem('🔪',gun=gun)
  1137.                     self.shoot(gun,effector)
  1138.                     return True
  1139.                 self.shoot(gun)
  1140.                 return True
  1141.                 
  1142.         time.sleep(1)
  1143.         return True
  1144.  
  1145.     def shoot(self,gun,effector=None):
  1146.         r = gun.pickRound()
  1147.  
  1148.         if effector:
  1149.             print("\n",gun_back,"\n")
  1150.             time.sleep(2.3)
  1151.             if r:
  1152.                 if effector.health - gun.damage < 1:
  1153.                     time.sleep(2)
  1154.                     
  1155.                 effector.takeDamage(gun.damage)
  1156.                 print("\n",explosion,"\n")
  1157.  
  1158.                 if effector.health > 0:
  1159.                     print("BOOM")
  1160.                     time.sleep(0.8)
  1161.                     print("You got shot.")
  1162.                     time.sleep(1.4)
  1163.                     print("Lives left:", effector.health)
  1164.                     time.sleep(3)
  1165.                     gun.resetDamage()
  1166.                 return
  1167.         else:
  1168.             print("\n",gun_fwd,"\n")
  1169.             time.sleep(2)
  1170.             if r:
  1171.                 self.takeDamage(1)
  1172.                 print("\n",explosion,"\n")
  1173.                 print("BOOM")
  1174.                 time.sleep(0.5)
  1175.                 print("Dealer was shot.")
  1176.                 time.sleep(0.8)
  1177.                 print("Dealer has", self.health ,"lives left.")
  1178.                 time.sleep(1)
  1179.                 gun.resetDamage()
  1180.                 return
  1181.         print("*click*")
  1182.         time.sleep(0.8)
  1183.         print("round was blank.")
  1184.         time.sleep(1.5)
  1185.         gun.resetDamage()
  1186.  
  1187.  
  1188. sg = Shotgun()
  1189. p1 = Player(DEFAULT_HEALTH)
  1190. dealer = AI(DEFAULT_HEALTH)
  1191.  
  1192. time.sleep(1)
  1193.  
  1194. print("[DEALER]: PLEASE SIGN THE WAIVER.")
  1195. askforhelp = ''
  1196.  
  1197. while askforhelp not in ["a","b"]:
  1198.     askforhelp = input("(a) Read Waiver or (b) Sign and continue? ").lower().strip(" ")
  1199.  
  1200. if askforhelp == "a":
  1201.     displayHelp()
  1202.     input("READY? ")
  1203.  
  1204. name = ""
  1205. while name in ["GOD","DEALER","SATAN"] or not (3 < len(name) < 10):
  1206.     if name:
  1207.         print("INVALID NAME.")
  1208.     name = input("ENTER NAME: ").strip(" ").upper()
  1209.  
  1210.  
  1211.  
  1212.  
  1213. while p1.health > 0 and dealer.health > 0:
  1214.     # load the shotgun
  1215.     live = random.randint(1,3)
  1216.     blank =  random.randint(1,3)
  1217.     sg.addRounds(live, blank)
  1218.     print("\n",gun_side)
  1219.     displayRounds(live,blank)
  1220.     time.sleep(0.5)
  1221.     print(f"{live} LIVE, {blank} BLANK\n")
  1222.     time.sleep(4)
  1223.  
  1224.     if not rounds:
  1225.         print("\"I INSERT THE SHELLS IN AN UNKNOWN ORDER.\"")
  1226.     else:
  1227.         print("\"THEY ENTER THE CHAMBER IN A HIDDEN SEQUENCE.\"")
  1228.     time.sleep(4)
  1229.     
  1230.     #give the players items
  1231.     p1.addRandomItems()
  1232.     dealer.addRandomItems()
  1233.     print("\nYour inventory:")
  1234.     displayList(p1.items)
  1235.     time.sleep(4)
  1236.     print("\nDealer's inventory:")
  1237.     displayList(dealer.items)
  1238.     time.sleep(3)
  1239.     
  1240.     #start turns
  1241.     turn = random.choice([True,False])
  1242.     
  1243.     
  1244.     while sg.rounds and p1.health and dealer.health:
  1245.         
  1246.         if (turn and (not p1.turnsWaiting)) or dealer.turnsWaiting:
  1247.             # =========> PLAYERS TURN TO CHOOSE
  1248.             opt = ""
  1249.             inp = ""
  1250.  
  1251.             if dealer.turnsWaiting:
  1252.                 print("\n*Dealer skips their turn*")
  1253.                 turn = not turn
  1254.                 time.sleep(0.5)
  1255.                 dealer.turnsWaiting = dealer.turnsWaiting - 1
  1256.             
  1257.             while sg.rounds:
  1258.                 opt = ""
  1259.  
  1260.                 if p1.items:
  1261.                     print("\n+==============+")
  1262.                     print("Your items:")
  1263.                     displayList(p1.items)
  1264.                     print("+==============+")
  1265.                     time.sleep(1)
  1266.                     print("\nIT IS YOUR TURN.")
  1267.                     print("(a) Use item")
  1268.                     print("(b) Shoot")
  1269.  
  1270.                     while opt.lower().strip(" ") not in ["a","b"]:
  1271.                         opt = input(" ").lower().strip(" ")
  1272.  
  1273.                 #endif
  1274.  
  1275.                 if opt == "a": # ======== > PLAYER USE ITEM
  1276.                     inp = ""
  1277.                     while (not inp.isdigit() or int(inp) < 1 or int(inp) > len(p1.items)) and inp not in ["quit","q","back","x"]:
  1278.                         inp = input("Use: ")
  1279.                         
  1280.                     if inp not in ["quit","q","back","x"]:
  1281.                         use = p1.useItem(p1.items[int(inp)-1],sg,dealer)
  1282.                         
  1283.                         if not use:
  1284.                             print(inp,"not used.\n\n\n\n")
  1285.                     time.sleep(1)
  1286.  
  1287.                 else: # ============= > PLAYER SHOOT
  1288.                     print("\nShooting yourself will skip Dealer's turn if round is blank.\n")
  1289.                     print("Shoot:")
  1290.                     time.sleep(0.6)
  1291.                     print("(a) DEALER")
  1292.                     time.sleep(0.6)
  1293.                     print("(b) YOU")
  1294.                     inp = ""
  1295.  
  1296.                     while inp not in ["a","b","back","q","quit","x"]:
  1297.                         inp = input(" ").lower().strip(" ")
  1298.  
  1299.                     
  1300.                     time.sleep(0.5)
  1301.                     
  1302.                     if inp == "a": # shoot DEALER
  1303.                         r = sg.pickRound()
  1304.                         print("\n",gun_fwd,"\n")
  1305.                         time.sleep(1.8)
  1306.                         if r:
  1307.                             dealer.takeDamage(sg.damage)
  1308.                             print("\n",explosion,"\n")
  1309.                             time.sleep(0.5)
  1310.                             print("[DEALER] was shot.")
  1311.                             print("Dealers health:", dealer.health)
  1312.                             time.sleep(1.2)
  1313.                         else:
  1314.                             print("*click*")
  1315.                             time.sleep(0.5)
  1316.                             print("round was blank.")
  1317.                             time.sleep(0.5)
  1318.                             print()
  1319.                         break
  1320.                     elif inp == "b": # shoot YOURSELF
  1321.                         r = sg.pickRound()
  1322.                         print("\n",gun_back,"\n")
  1323.                         time.sleep(2.5)
  1324.                         if p1.health - sg.damage < 1:
  1325.                             time.sleep(2)
  1326.                         if r:
  1327.                             p1.takeDamage(sg.damage)
  1328.                             print("\n",explosion,"\n")
  1329.                             if p1.health > 0 :
  1330.                                 time.sleep(0.5)
  1331.                                 print("You got shot.")
  1332.                                 print(f"YOUR HEALTH:", p1.health)
  1333.                                 time.sleep(1.2)
  1334.                             break
  1335.                         else:
  1336.                             print("*click*")
  1337.                             time.sleep(0.5)
  1338.                             print("round was blank.")
  1339.                             time.sleep(0.5)
  1340.                             
  1341.                     
  1342.         else: #DEALERS turn
  1343.             if p1.turnsWaiting:
  1344.                 print("\nYou skip this turn.")
  1345.                 turn = not turn
  1346.                 time.sleep(1.5)
  1347.                 p1.turnsWaiting = p1.turnsWaiting - 1
  1348.  
  1349.             print("\nDEALERS TURN.")
  1350.             time.sleep(2)
  1351.  
  1352.             while sg.rounds:
  1353.                 r = sg.rounds[-1]
  1354.  
  1355.                 # BEGIN AI DECIDING
  1356.                 print("[DEALER] is chosing...")
  1357.                 time.sleep(random.randint(15,45)/10)
  1358.                 
  1359.                 if False not in sg.rounds:
  1360.                     dealer.useItem('🔪',gun=sg)
  1361.                     dealer.shoot(sg,p1)
  1362.                     break
  1363.  
  1364.                 if True not in sg.rounds:
  1365.                     dealer.shoot(sg)
  1366.                     continue
  1367.                 
  1368.                 if dealer.health < DEFAULT_HEALTH:
  1369.                     if dealer.useItem('🚬'): continue
  1370.  
  1371.                 roundsLeft = len(sg.rounds)
  1372.                 if roundsLeft < 5:
  1373.                     if (sg.rounds.count(True)/roundsLeft) >= 0.5:
  1374.                         if dealer.useItem('⛓',p1): continue
  1375.                         if not p1.turnsWaiting and dealer.useItem('🔍',gun=sg): continue
  1376.                         if random.choice(sg.rounds) and dealer.useItem('🔪',gun=sg): continue
  1377.                         
  1378.                         dealer.shoot(sg,p1)
  1379.                         break
  1380.                     
  1381.                 
  1382.                 # ⛓, mag.g, knf, cg, 🍺
  1383.                 if random.choice([True,False]):
  1384.                     dealer.useItem(random.choice(dealer.items),p1,sg)
  1385.                     continue
  1386.  
  1387.                 temp = [None,p1][random.choice(sg.rounds)]
  1388.                 dealer.shoot(sg,temp)
  1389.                 sg.resetDamage()
  1390.                 if temp != None:
  1391.                     break
  1392.                 if r: break
  1393.  
  1394.         turn = not turn
  1395.         sg.resetDamage()
  1396.         
  1397.  
  1398.     sg.resetDamage()
  1399.     p1.turnsWaiting = 0
  1400.     rounds +=1
  1401.     dealer.turnsWaiting = 0
  1402.     if p1.health > 0 and dealer.health > 0:
  1403.         print("~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~")
  1404.         print("..NEXT ROUND..")
  1405.         time.sleep(2)
  1406.         print("DEALER'S HEALTH:")
  1407.         time.sleep(1)
  1408.         print(dealer.health)
  1409.         time.sleep(2)
  1410.         print("YOUR HEALTH:")
  1411.         time.sleep(1)
  1412.         print(p1.health)
  1413.         time.sleep(2)
  1414.  
  1415.  
  1416.  
  1417. c = 0
  1418. while c < 700000:
  1419.     c+=1
  1420.     print("█",end="")
  1421.  
  1422. if not dealer.health:
  1423.     print("\n\n\n\nThe dealer died.")
  1424.     print("You win..")
  1425. else:
  1426.     print("\n\n\n\nYOU DIED.")

Editor

You can edit this paste and save as new:


File Description
  • Buckshot game
  • Paste Code
  • 17 Apr-2024
  • 47.06 Kb
You can Share it: