From 45de296f149a74d330f507aa4b1424cb6d2ea83f Mon Sep 17 00:00:00 2001 From: K <65287118+katzerax@users.noreply.github.com> Date: Fri, 23 Dec 2022 13:09:16 -0800 Subject: [PATCH] Add files via upload --- main.py | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 main.py diff --git a/main.py b/main.py new file mode 100644 index 0000000..ff1bc87 --- /dev/null +++ b/main.py @@ -0,0 +1,62 @@ +import matplotlib.pyplot as plt + +# Predefined variables used in the functions, modifiable +fireDelay = 0.7 #delay between weapon fires (in seconds) +reloadTime = 0.5 #time per reload (in seconds) +damagePerShot = 56000 #damage per shot +magCap = 7 #shots per magazine +ammoReserve = 20 #total reserve ammo +shotsFired = 0 +nextFire = fireDelay +totalDamage = 0 +dataPoints = 4500 #pls make datapoints and xScale in multiples of 10 +xScale = 45 #scale of the X axis +yScale = 300000 #scale of the Y axis +xIncrements = xScale/dataPoints +timeElapsed = 0 +shotsFiredTotal = 0 + +#graph limits +plt.xlim(0, xScale) +plt.ylim(0, 150000) + +x = [] #establish x array +for i in range(dataPoints): #fills the x axis with standard units based on increments + x.append(round(i*xIncrements, 5)) + +tDMG = [] #establish tDMG array and fill it +for i in range(dataPoints): + if(shotsFiredTotal == ammoReserve): #checking for whether the entire reserve is emptied + totalDamage = totalDamage + else: #if reserve is not emptied, continues to check for next shot + if (shotsFired == magCap): #checking for reload + nextFire += reloadTime + shotsFired = 0 + elif timeElapsed == nextFire: #checking whether or not it is time to fire + totalDamage += damagePerShot + nextFire += fireDelay + nextFire = round(nextFire, 5) + shotsFired += 1 + shotsFiredTotal += 1 + else: #if neither a reload or shot fires, keep value as is + totalDamage = totalDamage + timeElapsed += xIncrements + timeElapsed = round(timeElapsed, 8) #this round CHANGES the graph so careful with it + tDMG.append(totalDamage) + +dps = [0] +for z in range(dataPoints): + if(z==0): + z = z + else: + dps.append(tDMG[z]/x[z]) + +# Plot x axis, dps point on Y +plt.plot(x,dps) +# Add a legend and labels +plt.legend(['dps']) +plt.xlabel('x') +plt.ylabel('value') + +# Show the plot +plt.show() \ No newline at end of file