Advertisement
Guest User

Warmachine Khador competitive lists generator

a guest
Feb 12th, 2017
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.21 KB | None | 0 0
  1.  
  2. # -*- coding: utf-8 -*-
  3. from random import randint
  4.  
  5. competitiveJacks = [(" * Marauder",10), (" * Juggernaut", 12), (" * Devastator", 14), (" * Destroyer", 14), (" * Kodiak", 13)]
  6. badJacks = [(" * Ruin   ", 17, 1), (" * Behemoth", 25, 1), (" * Spriggan", 19, 1)]
  7.  
  8. jackFilling = [("Battle Mechs (4)",3), ("Battle Mechs (6)",5), ("Gobber Tinker",2), ("Orin Midwinter", 5), ("Ogrun bokur", 5)]
  9.  
  10. jackCasters = [("Karchev", -30), ("Harkevich",-28), ("Malakov 2",-28)]
  11. badCasters = [("Butcher 1", -28), ("Butcher 2", -28), ("Butcher 3", -22), ("Irusk 1", -27), ("Irusk 2", -27), ("Kozlov 1", -28), ("Old Witch", -18), ("Sorcha 1", -29), ("Sorcha 2", -27), ("Strakov", -28), ("Vladimir 1", -28), ("Vladimir 2", -27), ("Vladimir 3", -27), ("Zerkova 1", -28), ("Zerkova 2", -27)]
  12. badFilling = [("Gun carriage", 18, 2), ("Kayazi Elim", 5, 2), ("MoW Drakhun", 9, 2), ("Orin Midwinter", 5, 1), ("Ogrun bokur", 5, 2)]
  13.  
  14. def generateJackSpam():
  15.     list = []
  16.     caster = jackCasters[randint(0, len(jackCasters)-1)]
  17.     list.append(caster)
  18.     points = caster[1]
  19.     while points < 65:
  20.         warjack = competitiveJacks[randint(0, len(competitiveJacks)-1)]
  21.         cost = warjack[1]
  22.         if cost + points < 75:
  23.             list.append(warjack)
  24.             points += cost
  25.     while points < 71:
  26.         filling = jackFilling[randint(0, len(jackFilling)-1)]
  27.         cost = filling[1]
  28.         if cost + points < 75:
  29.             list.append(filling)
  30.             points += cost
  31.     printList(list)
  32.  
  33. def generateScareList():
  34.     allJacks = competitiveJacks + badJacks
  35.     list = []
  36.     caster = badCasters[randint(0, len(badCasters)-1)]
  37.     list.append(caster)
  38.     points = caster[1]
  39.     restriction = {}
  40.     while points < 0:
  41.         warjack = allJacks[randint(0, len(allJacks)-1)]
  42.         cost = warjack[1]
  43.         if cost + points <= 75 and passRestriction(restriction, warjack):
  44.             updateRestriction(restriction, warjack)
  45.             list.append(warjack)
  46.             points += cost
  47.     list.append((" * Reinholt  ",4))
  48.     list.append(("Rifflecorps (6)",8))
  49.     list.append((" * Rocketeer",2))
  50.     list.append((" * Rocketeer",2))
  51.     list.append((" * Rocketeer",2))
  52.     list.append(("Rifflecorps (6)",8))
  53.     list.append((" * Rocketeer",2))
  54.     list.append((" * Rocketeer",2))
  55.     list.append((" * Rocketeer",2))
  56.     list.append(("Rifflecorps (6)",8))
  57.     list.append((" * Rocketeer",2))
  58.     list.append((" * Rocketeer",2))
  59.     list.append((" * Rocketeer",2))
  60.     points += 46
  61.     while points < 71:
  62.         filling = badFilling[randint(0, len(badFilling)-1)]
  63.         cost = filling[1]
  64.         if cost + points <= 75 and passRestriction(restriction, filling):
  65.             updateRestriction(restriction, filling)
  66.             list.append(filling)
  67.             points += cost
  68.     printList(list)
  69.  
  70. def passRestriction(restriction, reference):
  71.     if len(reference) == 2 :
  72.         return True
  73.     elif reference not in restriction :
  74.         return True
  75.     else:
  76.         return restriction[reference] < reference [2]
  77.    
  78. def updateRestriction(restriction, reference):
  79.     if reference in restriction:
  80.         restriction[reference] += 1
  81.     else :
  82.         restriction[reference] = 1
  83.     return restriction
  84.    
  85. def printList(list):
  86.     print
  87.     total = 0
  88.     for each in list :
  89.         total +=each[1]
  90.         print each[0], "\t", each[1], "\t", total
  91.  
  92.  
  93. if __name__ == "__main__":
  94.     print "\nYour pairing is :"
  95.     generateJackSpam()
  96.     generateScareList()
  97.     print "\nRemember to ask your friends for missing refs, don't buy those !"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement