-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_campaign_rpg_mode.py
More file actions
63 lines (47 loc) · 1.93 KB
/
test_campaign_rpg_mode.py
File metadata and controls
63 lines (47 loc) · 1.93 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
"""This file contains a test for the existence and sanity of rpg_mode.txt.
Imports From:
campaign.py
report.py
Functions:
test_campaign_data_events()
"""
from campaign import Campaign
from report import Report
def test_campaign_rpg_mode(current_campaign: Campaign) -> Report:
"""Test the campaign's RPG Mode file for sanity.
Parameters:
current_campaign: Campaign | The parsed campaign to be tested
Returns:
Report | The completed Report to be returned
"""
report = Report()
rpg_mode = None
if current_campaign.language_info.events.rpg_mode is not None:
rpg_mode = current_campaign.language_info.events.rpg_mode
if not current_campaign.summary.rpg_mode:
report.infos.append(
"INFO: rpg_mode.txt is specified but RPG Mode is disabled "
"in summary.txt."
)
if not rpg_mode.xo_names:
report.errors.append("ERORR: No XO names specified in rpg_mde.txt.")
if len(rpg_mode.xp_for_next_level) % 4 != 0:
report.infos.append(
"INFO: RPG Mode crew cannot all reach max level because number "
"of xp levels is not a multiple of 4."
)
if len(rpg_mode.crew_levels) != len(rpg_mode.crew_level_messages):
report.errors.append(
"ERROR: RPG Mode crew qualites do not all have a valid description."
)
if not rpg_mode.xp_message:
report.errors.append("ERROR: No ExpForMission message specified.")
if not rpg_mode.level_up_message:
report.errors.append("ERROR: No NewLevelGained message specified.")
elif current_campaign.summary.rpg_mode:
report.errors.append(
f"ERROR: RPG Mode enabled in summary.txt "
f"but language_{current_campaign.language_info.language}//events"
"//content//rpg_mode.txt not found."
)
return report