-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEloSystem.py
More file actions
47 lines (42 loc) · 1.44 KB
/
EloSystem.py
File metadata and controls
47 lines (42 loc) · 1.44 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
WEAPON_ELO_MULTIPLIER = {
"AIM-9+": 4.0,
"AIM-120C": 1.0,
"AIM-120D": 1.0,
"AIM-54": 6.0,
"AIRS-T": 4.0,
"AIM-9": 4.0,
"GAU-8": 20.0,
"Vulcan": 20.0,
"AIM-7": 8.0,
"AIM-9E": 30.0, #I'm not sure it's 9e or 9E......
"GAU-22": 20.0,
"M230": 20.0,
} #Using fixed multiplier currently to calculate elo change
AIRCRAFT_ELO_MULTIPLIER = {
"F/A-26B": 4.0,
"EF-24G": 8.0,
"F-45A": 8.0,
"T-55": 2.0,
"AV-42C": 1.0,
}
ELO_CILING = 150 #Elo change will be capped at this value
class EloSystem:
def __init__(self):
self.elo_dict = {}
def get_elo(self, playername: str) -> int:
return self.elo_dict.get(playername, 1000)
def set_elo(self, playername: str, elo: int) -> None:
self.elo_dict[playername] = elo
def calculate_elo_change_from_log(self,kill_playername, kill_aircraft, kill_faction, kill_weapon,map_type:str) -> int:
if map_type == "BVR":
mult_weapon = WEAPON_ELO_MULTIPLIER.get(kill_weapon, 1.0)
mult_aircraft = AIRCRAFT_ELO_MULTIPLIER.get(kill_aircraft, 1.0)
total_mult = mult_weapon * mult_aircraft
if total_mult > ELO_CILING:
total_mult = ELO_CILING
elif map_type == "BFM":
total_mult = 1.0 #get 1 or loss 1
elif map_type == "PVE":
total_mult = 0 #no elo change, still need more implementations here
return total_mult
EloSystem = EloSystem()