Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 00 - Name
- # 01 - Empire
- # 02 - Type
- # 03 - Max Damage
- # 04 - Max Range
- # 05 - Min Damage
- # 06 - Min Range
- # 07 - Fire Mode
- # 08 - Short Reload
- # 09 - Long Reload
- # 10 - Mag Size
- # 11 - Ammo Pool
- # 12 - Vertical Recoil
- # 13 - Minimum Horizontal Recoil
- # 14 - Maximum Horizontal Recoil
- # 15 - Horizontal Recoil Tolerance
- # 16 - Minimum Recoil Angle
- # 17 - Maximum Recoil Angle
- # 18 - Horizontal Recoil Bias
- # 19 - Recoil Decrease
- # 20 - First Shot Recoil Multiplier
- # 21 - ADS Move Speed Multiplier
- # 22 - ADS COF Stand Still
- # 23 - ADS COF Stand Move
- # 24 - ADS COF Crouch Still
- # 25 - ADS COF Crouch Move
- # 26 - Hip COF Stand Still
- # 27 - Hip COF Stand Move
- # 28 - Hip COF Stand Sprint
- # 29 - Hip COF Crouch Still
- # 30 - Hip COF Crouch Move
- # 31 - ADS COF Bloom
- # 32 - Hip COF Bloom
- # 33 - Rate of Fire
- # 34 - Bullet Speed
- # 35 - Pellet Count
- # 36 - Pellet Spread
- import random, math
- import time as emit
- # Data in
- weps, fail = [], open('weps.txt', 'r')
- for line in fail:
- weps.append(line.split('\t'))
- fail.close()
- for x in range(len(weps)):
- for y in range(len(weps[x])):
- try: weps[x][y] = float(weps[x][y])
- except: pass
- # Approximate target size - target relative to ground and (soon not) approximate middle; all xyz from here on in meters.
- sidehead = [[-0.047, 1.8], [0.166, 1.8], [0.166, 1.562], [0.036, 1.562], [-0.047, 1.645], 2.0]
- sidebody = [[-0.032, 1.63], [0.036, 1.562], [0.083, 1.562], [0.133, 1.367], [0.209, 1.299], [0.137, 1.223], [0.426, 1.151], [0.386, 1.079], [0.076, 1.136], [0.087, 0.963], [-0.173, 0.963], [-0.126, 1.104], [-0.198, 1.288], [-0.191, 1.504], [-0.032, 1.584], 1.0]
- sidelegs = [[-0.173, 0.963], [0.087, 0.963], [0.173, 0.66], [0.076, 0.357], [0.17, 0.278], [0.245, 0.278], [0.245, 0.213], [-0.014, 0.213], [-0.014, 0.548], [0.029, 0.628], [0.018, 0.667], [-0.011, 0.563], [-0.195, 0.227], [-0.162, 0.119], [-0.083, 0.069], [-0.083, 0.025], [-0.17, 0.004], [-0.314, 0.072], [-0.314, 0.249], [-0.137, 0.61], 0.9]
- fronthead = [[-0.095, 1.8], [0.07, 1.8], [0.07, 1.573], [-0.095, 1.573], 2.0]
- frontbody = [[-0.062, 1.573], [0.07, 1.573], [0.227, 1.477], [0.301, 1.147], [0.147, 1.103], [0.154, 1.224], [0.132, 1.356], [0.198, 1.228], [0.154, 1.224], [0.147, 1.103], [0.172, 0.946], [-0.132, 0.946], [-0.125, 1.254], [-0.194, 1.202], [-0.224, 1.257], [-0.29, 1.21], [-0.345, 1.276], [-0.062, 1.51], 1.0]
- frontlegs = [[-0.132, 0.946], [0.172, 0.946], [0.187, 0.583], [0.286, 0.319], [0.286, 0.004], [0.180, 0.004], [0.187, 0.268], [0.048, 0.594], [0.022, 0.851], [-0.066, 0.583], [-0.066, 0.213], [-0.293, 0.176], [-0.315, 0.246], [-0.158, 0.304], [-0.187, 0.781], 0.9]
- for wep in weps: # Replace with cycling through all the weapons (X), as many ranges as possible (X), add mutiple passes for each for an approximation. (Density of ranges and amount of passes is dependent on how much time the program takes.)
- print 'Starting', wep[0]
- for stance in [0, 1, 5]:
- fail = open(str(wep[0]) + ' ' + str(stance) + '.txt', 'w')
- fail.write('\t')
- for x in range(1, 101):
- fail.write(str(x).rjust(3) + '\t')
- fail.write('\n')
- #print wep[0], str(stance) + ':',
- for acc in range(0, 101): # Accuracy skill
- fail.write(str(acc).rjust(3) + '\t')
- for z in range(1, 101): # Range
- ytar = 1.2 + 5.625 * (z / wep[34]) ** 2 # Go through the test program
- xaim, yaim = 0.0, math.atan((ytar - 1.6) / z) # Aim angle
- xrec, yrec, cof = 0.0, 0.0, wep[22 + stance] # Recoil and CoF
- ammo, hp, ttk, aimt = wep[10], 1000.0, -60 / wep[33] + z / wep[34], 60 / wep[33]
- while ammo != 0 and hp > 0:
- # Hit location
- angle = random.uniform(0, 2 * math.pi)
- rad = cof * random.random() ** 0.5
- xang = math.tan((rad * math.sin(angle) + xrec + xaim) / 180 * math.pi)
- yang = math.tan((rad * math.cos(angle) + yrec + yaim) / 180 * math.pi)
- px = z * xang
- py = z * yang + 1.6
- l = (z ** 2 * (1 + xang ** 2 + yang ** 2)) ** 0.5
- py -= 5.625 * (l / wep[34]) ** 2
- # Hit detection
- hit = False
- for target in [fronthead, frontbody, frontlegs]:
- p1x = target[-2][0]
- p1y = target[-2][1]
- for p2x, p2y in target[:-1]:
- if py >= min(p1y, p2y) and py <= max(p1y, p2y) and px >= min(p1x, p2x):
- if p1y != p2y:
- xinter = (py - p1y) * (p2x - p1x) / (p2y - p1y) + p1x
- if p1x == p2x or px >= xinter:
- hit = not hit
- p1x, p1y = p2x, p2y
- if hit:
- if l <= wep[4]:
- hp -= wep[3] * target[-1]
- elif l >= wep[6]:
- hp -= wep[5] * target[-1]
- else:
- hp -= (wep[3] - (l - wep[4]) * ((wep[3] - wep[5]) / (wep[6] - wep[4]))) * target[-1]
- break
- # Recoil
- if xrec >= wep[15]:
- direct = -1
- elif xrec <= -wep[15]:
- direct = 1
- else:
- direct = (-1) ** random.randint(1, 2)
- angle = random.uniform(wep[16], wep[17]) / 180 * math.pi
- horiz = random.uniform(wep[13], wep[14]) * direct
- verti = wep[12]
- if ammo == wep[10]: # First Shot Recoil (Would have to re-do for burst fire.)
- verti *= wep[20]
- xrec += verti * math.sin(angle) + horiz * math.cos(angle)
- yrec += verti * math.cos(angle) - horiz * math.sin(angle)
- stan = (stance + 1) / 5
- if cof <= [3, 7][stan] - wep[31 + stan]:
- cof += wep[31 + stan]
- else:
- cof = [3, 7][stan]
- # Recoil compensation
- angle = (wep[16] + wep[17]) / 360 * math.pi
- angle = random.uniform(angle * acc / 100, 2 * angle - angle * acc / 100)
- verti = wep[12] * acc / 100
- verti = random.uniform(verti, 2 * wep[12] - verti)
- if ammo == wep[10] and acc > 75:
- verti += wep[12] * (wep[20] - 1) * (acc - 75) / 25
- xaim -= verti * math.sin(angle)
- yaim -= verti * math.cos(angle)
- aimt += 60 / wep[33]
- if aimt >= 0.25:
- angle = (-xaim - xrec) * acc / 100
- xaim += random.uniform(angle, 2 * (-xaim - xrec) - angle)
- angle = math.atan((ytar - 1.6) / z) - yaim - yrec
- yaim += random.uniform(angle * acc / 100, 2 * angle - angle * acc / 100)
- aimt -= 0.25
- # Lead moving targets by 0 - 2x with 0 acc, and x with 100 acc
- ammo -= 1
- ttk += 60 / wep[33]
- if hp <= 0:
- fail.write(str(ttk) + '\t')
- #print 'Dead in', ttk, 'sec.'
- else:
- fail.write('999\t')
- #print 'Alive with', hp, 'hp.'
- fail.write('\n')
- fail.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement