-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmagazine_size_fire_rate_functions.py
More file actions
47 lines (33 loc) · 1.07 KB
/
magazine_size_fire_rate_functions.py
File metadata and controls
47 lines (33 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import math
def charge_discharge_magazine_size_fire_rate(a: float, m: float, magazine_percentage: float):
if m < 0.1:
m = 0.1
changing_point = math.log(a+1) / m
fx = 0
if 0 <= magazine_percentage <= changing_point:
fx = math.exp(m * magazine_percentage) - 1
elif changing_point < magazine_percentage <= 100 - changing_point:
fx = a
elif 100 - changing_point < magazine_percentage <= 100:
fx = (a+1) * (1 - math.exp(m * (magazine_percentage - 100)))
if fx == 0:
fx = 1
return fx
def discharge_magazine_size_fire_rate(a: float, m: float, magazine_percentage: float):
if m < 0.1:
m = 0.1
fx = 0
if 0 < magazine_percentage <= 100:
fx = a * (1 - math.exp(-m * magazine_percentage))
if fx == 0:
fx = 1
return fx
def cooldown_magazine_size_fire_rate(a: float, magazine_percentage: float):
fx = 0
if 0 <= magazine_percentage <= a:
fx = magazine_percentage
elif a < magazine_percentage <= 100:
fx = a
if fx == 0:
fx = 1
return fx