-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodifiers.py
More file actions
50 lines (38 loc) · 1.53 KB
/
modifiers.py
File metadata and controls
50 lines (38 loc) · 1.53 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
48
49
from alert_level import AlertLevel
from euclidean import manhattan_distance
# situational roll modifiers
def traffic_points_encounter_mod(traffic_points):
return max(traffic_points // 3, 3)
heavy_escort_is_rare = -2
# penalty to torpedo evasion if they are not known about
# NOTE: The offchance of an unknown torpedo to be "evaded" represents targeting errors, duds, etc.
unknown_torpedo_evasion_penalty = -6
# bonus to torpedo evasion if in fast mode
fast_mode_torpedo_evasion_bonus = 2
# penalty to stealth if in fast mode
fast_mode_stealth_penalty = -2
# applies to situations where passive sonar is detecting a torpedo
noisy_torpedo_bonus_to_passive_sonar_detection = 2
# "stealth" skill is much less useful against active sonar
stealth_asonar_penalty = -3
# returns 0 if piloting against an ENGAGED opponent.
# otherwise, a huge bonus.
def pilot_torpedo_alert_mod(alert_level) -> int:
if alert_level == AlertLevel.ENGAGED: return 0
return -4
# Returns a penalty to passive psonar detection if target is in fast mode
# and a bonus or penalty based on observer speed
def moving_psonar_mod(observer, target) -> int:
mod = 0
if observer.momentum == 0:
mod += 3
elif observer.speed_mode == "fast":
mod += -2
if target.momentum == 0:
mod += -3
elif target.speed_mode == "fast":
mod += 2
return mod
def sonar_distance_mod(observer, target) -> int:
# NOTE: This may be a non-linear function down the road
return max(-manhattan_distance(observer.xy_tuple, target.xy_tuple), -3)