The_Filip

Avatar Legends - Random NPC move Choice

Aug 20th, 2023
814
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.59 KB | Gaming | 0 0
  1. import random, sys
  2.  
  3. # Get user input for seed, or generate a random one if not provided
  4. x = input("Enter Seed: ")
  5. if len(x) == 0:
  6.     seed = random.randrange(1,999999999999999999)
  7. else:
  8.     seed = int(x)
  9.  
  10. # Set the random seed for consistent random number generation
  11. random.seed(int(seed), version=2)
  12.  
  13. # Initialize modifiers for style and mentality
  14. styleMod = 0
  15. mentalityMod = 0
  16.  
  17. # Possible moves for each action type
  18. DefMoves = ["Own Special/Ready","Ready","Retaliate","Seize a Position"]
  19. EvaMoves = ["Own Special/Test Balance","Bolster or Hinder","Commit"]
  20. AtkMoves = ["Own Special/Strike","Strike","Pressure","Smash"]
  21.  
  22. # Function to modify the style modifier based on the chosen style
  23. def styleModifier():
  24.     global styleMod
  25.     if style == "Offense":
  26.         styleMod = 2
  27.     elif style == "Off-Support":
  28.         styleMod = 1
  29.     elif style == "Def-Support":
  30.         styleMod = -1
  31.     elif style == "Defense":
  32.         styleMod = -2
  33.  
  34. # Function to modify the mentality modifier based on the chosen mentality
  35. def mentalityModifier():
  36.     global mentalityMod
  37.     if mentality == "Positive Jing":
  38.         mentalityMod = 2
  39.     elif mentality == "Neutral Jing":
  40.         mentalityMod = 0
  41.     elif mentality == "Negative Jing":
  42.         mentalityMod = -2
  43.  
  44. # Main function to determine character's action and move
  45. def main(cName,cStyle,cMentality):
  46.     global style, mentality, action, name
  47.     global roll1, roll2
  48.  
  49.     # Get character information or user input
  50.     if cName == None:
  51.         name = input("Character Name:")
  52.     else:
  53.         name = cName
  54.  
  55.     # Get character style or user input
  56.     if cStyle == None:
  57.         style = input("Offense\nOff-Support\nDef-Support\nDefense\nFighting Style:")
  58.     else:
  59.         style = cStyle
  60.  
  61.     # Get character mentality or user input
  62.     if cMentality == None:
  63.         mentality = input("Positive Jing\nNeutral Jing\nNegative Jing\nMentality:")
  64.     else:
  65.         mentality = cMentality
  66.  
  67.     # Apply style and mentality modifiers
  68.     styleModifier()
  69.     mentalityModifier()
  70.  
  71.     # Calculate the roll for turn action
  72.     roll1 = (random.randrange(1,20)+(styleMod+mentalityMod))
  73.  
  74.     action = None
  75.     # Decide action based on the roll
  76.     print("--------------------------------------------------------")
  77.     print(name)
  78.     print("if 2 the same, then second is own move if possible.")
  79.     if roll1 <= 7:
  80.         print("Def")
  81.         print("1 - ",(random.choice(DefMoves)))
  82.         print("2 - ",(random.choice(DefMoves)))
  83.         print("3 - ",(random.choice(DefMoves)))
  84.         print("4 - ",(random.choice(DefMoves)))
  85.         action = "Def"
  86.     elif roll1 >= 8 and roll1 <= 13:
  87.         print("Eva")
  88.         action = "Eva"
  89.         print("1 - ",(random.choice(EvaMoves)))
  90.         print("2 - ",(random.choice(EvaMoves)))
  91.         print("3 - ",(random.choice(DefMoves)))
  92.         print("4 - ",(random.choice(DefMoves)))
  93.     elif roll1 >= 14:
  94.         print("Atk")
  95.         action = "Atk"
  96.         print("1 - ",(random.choice(AtkMoves)))
  97.         print("2 - ",(random.choice(AtkMoves)))
  98.         print("3 - ",(random.choice(DefMoves)))
  99.         print("4 - ",(random.choice(DefMoves)))
  100.  
  101. # Lists to store characters' actions
  102. _eva = []
  103. _def = []
  104. _atk = []
  105.  
  106. # Characters with their styles and mentalities
  107. template = ["Name","Style","Mentality"]
  108. # Earth
  109. Yuka = ["Yuka","Offense","Positive Jing"]
  110. Asuka = ["Asuka","Def-Support","Neutral Jing"]
  111. Renji = ["Renji","Off-Support","Negative Jing"]
  112. JinHo = ["Jin-Ho","Offense","Neutral Jing"]
  113. Kaito = ["Kaito","Def-Support","Positive Jing"]
  114. Mei = ["Mei","Def-Support","Neutral Jing"]
  115.  
  116. # Fire
  117. Manami = ["Manami","Offense","Negative Jing"]
  118.  
  119. # Water
  120. Aputi = ["Aputi","Off-Support","Positive Jing"]
  121.  
  122. # Team composition for the match
  123. team1 = [Yuka,Asuka,Renji]
  124. team2 = [JinHo,Kaito,Mei]
  125.  
  126. # Combine both teams for the match
  127. list = [team1[0],team1[1],team1[2],team2[0],team2[1],team2[2]]
  128.  
  129. # Iterate through characters and determine their actions
  130. for i in range(6):
  131.     currentC = None
  132.     currentC = list[0]
  133.     list.pop(0)
  134.  
  135.     mName = currentC[0]
  136.     mStyle = currentC[1]
  137.     mMentality = currentC[2]
  138.     main(mName,mStyle,mMentality)
  139.  
  140.     # Append character's action to respective lists
  141.     if action == "Def":
  142.         _def.append(name)
  143.     if action == "Atk":
  144.         _atk.append(name)
  145.     if action == "Eva":
  146.         _eva.append(name)
  147.  
  148. # Print the results of the match
  149. print("--------------------------------------------------------")
  150. print("--------------------------------------------------------")
  151. print("seed: ",seed)
  152. print("Def - ",_def)
  153. print("Atk - ",_atk)
  154. print("Eva - ",_eva)
  155.  
Advertisement
Add Comment
Please, Sign In to add comment