Skip to content

Commit

Permalink
Increase faction AI siege aggressiveness; reduce casualties in autoca…
Browse files Browse the repository at this point in the history
…lc sieges; make attackers less likely to cancel autocalc siege attacks; adjust garrison sizes; add good/evil garrison size swap for capturable centers; add a warning for realistic save mode; fix a missing helmet mesh
  • Loading branch information
In-Vain committed Oct 17, 2020
1 parent 3ed7f12 commit 3620299
Show file tree
Hide file tree
Showing 18 changed files with 71 additions and 45 deletions.
4 changes: 2 additions & 2 deletions Languages/en/ui.csv
Expand Up @@ -80,8 +80,8 @@ ui_next|Next
ui_prev|Prev
ui_learn|Learn
ui_question_saving_policy|What will the game's saving policy be?
ui_saving_policy_realistic|Realistic! No quitting without saving!
ui_saving_policy_nonrealistic|Allow me to quit without saving.
ui_saving_policy_realistic|No quitting without saving! (Not recommended.)
ui_saving_policy_nonrealistic|Quit without saving. (Recommended, keep multiple saves.)
ui_tutorial_character_generation|Now enter your name and distribute your attribute, skill and weapon points. You can click on various elements on the screen to learn how each one will affect your character.
ui_str|STR
ui_agi|AGI
Expand Down
10 changes: 5 additions & 5 deletions ModuleSystem/module_constants.py
Expand Up @@ -1524,13 +1524,13 @@ def concatenate_scripts(block_list):
str_income_very_high = 30

# Center garrison limits (slot_center_garrison_limit), for easy mass tweaking
garrison_limit_low = 170 # for Elves and Dwarves
garrison_limit_low = 250 # for Elves and Dwarves
garrison_limit_med = 300
garrison_limit_high = 450 #capitals
# Evil factions have 20% larger garrisons (quantity vs quality)
# Evil factions have 20% larger garrisons (quantity vs quality) #InVain: garrison sizes are now adjusted via script (so they affect capturable settlements)
garrison_limit_evil_low = garrison_limit_low*120/100 #not used
garrison_limit_evil_med = garrison_limit_med*120/100
garrison_limit_evil_high = garrison_limit_high*150/100 #InVain: 50% for orc garrisons
garrison_limit_evil_med = garrison_limit_med #*120/100
garrison_limit_evil_high = garrison_limit_high #*150/100

# Siegability flag values
tld_siegable_always = 1 # siege if attstr>fac_str_ok
Expand Down Expand Up @@ -1630,7 +1630,7 @@ def concatenate_scripts(block_list):
[icon_mfc_mordor],[500],[2,1,4,1,4,1], str_income_low, garrison_limit_evil_high, 2, tld_siegable_normal),
(p_town_east_osgiliath, [scn_east_osgiliath_center, scn_east_osgiliath_castle, -1, -1, -1, scn_east_osgiliath_siege, mesh_town_osgilliath],
[-1, trp_smith_eosgiliath, trp_merchant_eosgiliath, trp_no_troop, pt_mordor_recruits, trp_mordor_lord, trp_i2_mordor_uruk, trp_i2_mordor_orc, trp_i3_mordor_large_orc, trp_a3_guldur_large_orc_tracker],
[icon_mfc_mordor],[500],[2,1,4,1,4,1], str_income_low, garrison_limit_evil_med*2, 0, tld_siegable_always),
[icon_mfc_mordor],[500],[2,1,4,1,4,1], str_income_low, garrison_limit_med, 0, tld_siegable_always),
# Isengard centers
(p_town_isengard, [scn_isengard_center, scn_isengard_castle, scn_mordor_prison,scn_mordor_tavern, scn_isengard_arena, scn_isengard_siege,mesh_town_isengard],
[trp_barman_isengard, trp_smith_isengard, trp_merchant_isengard, trp_elder_isengard, pt_isengard_recruits, trp_isengard_lord,trp_i2_isen_orc,trp_i3_isen_large_orc,trp_a2_isen_uruk_tracker,trp_i2_isen_uruk],
Expand Down
2 changes: 1 addition & 1 deletion ModuleSystem/module_items.py
Expand Up @@ -1081,7 +1081,7 @@ def heraldic(item_tableau):
["khand_inf_helm_b","Khand_Helm",[("khand_inf_helm_b1",imodbits_armor_bad),("khand_inf_helm_b2",0),("khand_inf_helm_b3",imodbits_armor_good)],itp_type_head_armor|itp_shop,0,600,weight(3)|head_armor(29)|difficulty(0),imodbits_armor| imodbit_cracked],
["khand_inf_helm_c1","Khand_Bowl_Helm",[("khand_inf_helm_c1a",imodbits_armor_bad),("khand_inf_helm_c1b",0),("khand_inf_helm_c1c",imodbits_armor_good)],itp_type_head_armor|itp_shop,0,800,weight(3)|head_armor(31)|difficulty(0),imodbits_armor| imodbit_cracked],
["khand_inf_helm_c2","Khand_Bowl_Helm",[("khand_inf_helm_c2a",imodbits_armor_bad),("khand_inf_helm_c2b",0),("khand_inf_helm_c2c",imodbits_armor_good)],itp_type_head_armor|itp_shop,0,800,weight(3)|head_armor(31)|difficulty(0),imodbits_armor| imodbit_cracked],
["khand_inf_helm_d","Khand_Cone_Helm",[("khand_inf_helm_d1",imodbits_armor_bad),("khand_inf_helm_d2",0),("khand_inf_helm_d3",imodbits_armor_good)],itp_type_head_armor|itp_shop,0,800,weight(3.5)|head_armor(34)|difficulty(0),imodbits_armor| imodbit_cracked],
["khand_inf_helm_d","Khand_Cone_Helm",[("khand_inf_helm_d1",imodbits_armor_bad),("khand_inf_helm_d2",0),("khand_inf_helm_d4",imodbits_armor_good)],itp_type_head_armor|itp_shop,0,800,weight(3.5)|head_armor(34)|difficulty(0),imodbits_armor| imodbit_cracked],
["khand_cav_helm_a","Khand_Rider_Helm",[("khand_cav_helm_a1",imodbits_armor_bad),("khand_cav_helm_a2",0),("khand_cav_helm_a3",imodbits_armor_good)],itp_type_head_armor|itp_shop,0,800,weight(3)|head_armor(33)|difficulty(0),imodbits_armor| imodbit_cracked|imodbit_lordly],
["khand_cav_helm_b","Khand_Rider_Helm",[("khand_cav_helm_b",0),("khand_cav_helm_b2",imodbits_armor_good)],itp_type_head_armor|itp_shop,0,1200,weight(2) |head_armor(33)|difficulty(0),imodbits_armor],
["khand_cav_helm_c","Khand_Decorated_Helm",[("khand_cav_helm_c",0),("khand_cav_helm_c3",imodbits_armor_good)],itp_type_head_armor|itp_shop,0,1500,weight(4) |head_armor(38)|difficulty(0),imodbits_elf_armor],
Expand Down
28 changes: 18 additions & 10 deletions ModuleSystem/module_scripts.py
Expand Up @@ -1724,17 +1724,22 @@ def set_item_score():
(try_end),
(party_set_slot, ":center_no", slot_town_wealth, ":initial_wealth"),

(assign, ":garrison_strength", 13),
(assign, ":garrison_strength", 13),
(store_faction_of_party, ":center_faction", ":center_no"),
(try_begin),
(party_slot_eq, ":center_no", slot_party_type, spt_town),
(assign, ":garrison_strength", 80), #InVain, was 20, increased this to initially counter lowered reinforcement rate for towns.
(try_end),
(try_begin), # TLD: capitals get more #InVain Isn't really needed anymore, since now all centers start at full strength. Keeping it just in case.
(store_faction_of_party, ":center_faction", ":center_no"),
(faction_slot_eq, ":center_faction", slot_faction_capital, ":center_no"),
(assign, ":garrison_strength", 160), #InVain: was 40
(try_end),
(party_get_slot, ":garrison_limit", ":center_no", slot_center_garrison_limit),
(try_begin),
(neg|faction_slot_eq, ":center_faction", slot_faction_side, faction_side_good),
(val_mul, ":garrison_limit", 150),
(val_div, ":garrison_limit", 100),
(try_end),
(try_for_range, ":unused", 0, ":garrison_strength"),
(call_script, "script_cf_reinforce_party", ":center_no"),
(try_begin), #TLD: don't go overboard
Expand Down Expand Up @@ -2467,11 +2472,12 @@ def set_item_score():
#For sieges increase attacker casualties and reduce defender casualties.
(this_or_next|party_slot_eq, ":root_defender_party", slot_party_type, spt_castle),
(party_slot_eq, ":root_defender_party", slot_party_type, spt_town),
(val_mul, ":defender_strength", 123), #it was 1.5 in old version, now it is only 1.23
(val_div, ":defender_strength", 100),
#(val_mul, ":defender_strength", 123), #it was 1.5 in old version, now it is only 1.23
#(val_div, ":defender_strength", 100),

(val_mul, ":attacker_strength", 100), #it was 0.5 in old version, now it is only 1 / 1.23
(val_div, ":attacker_strength", 123),
#(val_mul, ":attacker_strength", 2), #it was 0.5 in old version, now it is only 1 / 1.23
#(val_div, ":attacker_strength", 3),
(val_div, ":attacker_strength", 2),
(try_end),

(call_script, "script_party_count_fit_for_battle", "p_collective_ally", 0),
Expand Down Expand Up @@ -2591,7 +2597,9 @@ def set_item_score():
(eq, "$tld_option_death_npc", 1), # if death option is available
(store_random_in_range,":rnd",0,100),
(try_begin),
(lt,":rnd",5), # die with 5% prob when lost a battle
(store_character_level, ":player_level", "trp_player"),
(val_div, ":player_level", 2),
(lt,":rnd", ":player_level"), # die with 5% prob when lost a battle
(is_between, ":cur_troop_id", "trp_knight_1_1", kingdom_heroes_end), #kings and marshals cannot die for now
(store_troop_faction, ":cur_troop_faction", ":cur_troop_id"),
(neg|faction_slot_eq, ":cur_troop_faction", slot_faction_marshall, ":cur_troop_id"), #make sure it's not a marshall
Expand Down Expand Up @@ -2747,12 +2755,12 @@ def set_item_score():
(call_script, "script_order_best_besieger_party_to_guard_center", ":root_defeated_party", ":winner_faction"),
# add a small garrison
(try_begin),
(eq, ":winner_faction", "fac_player_faction"),
(eq, ":winner_faction", "$players_kingdom"),
(try_for_range, ":unused", 0, 10), #InVain: higher, to counter lowered reinforcement rate. Was 5
(call_script, "script_cf_reinforce_party", ":root_defeated_party"),
(try_end),
(else_try),
(try_for_range, ":unused", 0, 40), #InVain: higher, to counter lowered reinforcement rate. Was 5
(try_for_range, ":unused", 0, 20), #InVain: higher, to counter lowered reinforcement rate. Was 5
(call_script, "script_cf_reinforce_party", ":root_defeated_party"),
(try_end),
(try_end),
Expand Down Expand Up @@ -2822,7 +2830,7 @@ def set_item_score():
(store_random_in_range, ":random_num", 0, 100),

(try_begin),
(lt, ":random_num", 15), #15% is a bit higher than 10% (which is open area escape probability)
(lt, ":random_num", 5), #15% is a bit higher than 10% (which is open area escape probability)
(assign, ":trigger_result", 1), #End battle!

(assign, "$g_recalculate_ais", 1), #added new
Expand Down
25 changes: 16 additions & 9 deletions ModuleSystem/module_scripts_ai.py
Expand Up @@ -368,7 +368,7 @@
(store_sub, ":capital_siegable_str", "$g_fac_str_siegable", fac_str_weak-fac_str_very_weak), #-1000
(this_or_next|lt, ":center_faction_strength", ":capital_siegable_str"), #too much?
#(this_or_next|lt, ":center_faction_strength", fac_str_very_weak), #attack very weak factions regardless of odds (not too smart, but hopefully the player will help out)
(gt, ":center_score", 1200), #siege attacks more likely with worse odds (down to +20% advantage), was 1500 (+50%)
(gt, ":center_score", 400), #siege attacks more likely with worse odds (down to +20% advantage), was 1500 (+50%) #InVain: balanced to reflect TLD's huge garrisons.
(val_min, ":center_score", 20000),#20 times stronger means an easy victory, distance is more important
(try_begin),
(party_slot_eq, ":enemy_walled_center", slot_center_original_faction, ":faction_no"),
Expand All @@ -380,7 +380,8 @@
(try_end),
(try_begin), # if it's a capital, pretty much go for it
(eq, ":siegable", tld_siegable_capital),
(val_mul, ":center_score", 3),
(lt, ":center_faction_strength", ":capital_siegable_str"), #InVain: double check

(lt, ":center_faction_strength", fac_str_dying),
(val_mul, ":center_score", 100),
(try_end),
Expand All @@ -403,7 +404,7 @@

#Center with equal strength at 30 kms away will have a center_score of 1300 (with -40 reln)
(store_div, ":chance_attacking_center", ":best_besiege_center_score", 15),
(val_min, ":chance_attacking_center", 1000),
#(val_min, ":chance_attacking_center", 1000), #InVain: Disbaled: Maybe makes sieging more attractive
(assign, ":target_attacking_center", ":best_besiege_center"),
(try_begin),
(eq, ":old_target_attacking_center", ":target_attacking_center"),
Expand Down Expand Up @@ -481,7 +482,7 @@
(ge, ":best_attack_army", 0),
#Army having with equal strength and 30 kms away will have a best_attack_army_score of 28
(store_mul, ":chance_attacking_enemy_army", ":best_attack_army_score", 2),
#(val_min, ":chance_attacking_enemy_army", 1500), #TLD - too big scores
(val_min, ":chance_attacking_enemy_army", 1500), #TLD - too big scores
(assign, ":target_attacking_enemy_army", ":best_attack_army"),
(try_begin),
(eq, ":old_target_attacking_enemy_army", ":target_attacking_enemy_army"),
Expand Down Expand Up @@ -673,18 +674,18 @@
(assign, ":target_attacking_enemies_around_center", ":capital"),
(try_end),
#MV test code begin
# (try_begin),
# (eq, cheat_switch, 1),
# (this_or_next|eq, ":faction_no", "fac_gondor"),
#(try_begin),
#(eq, cheat_switch, 1),
# (this_or_next|eq, ":faction_no", "fac_gondor"),
# (eq, ":faction_no", "fac_mordor"),
# (assign, reg1, ":chance_defend"),
# (assign, reg2, ":chance_gathering_army"),
# (assign, reg3, ":chance_attacking_center"),
# (assign, reg4, ":chance_attacking_enemy_army"),
# (assign, reg5, ":chance_attacking_enemies_around_center"),
# (str_store_faction_name, s1, ":faction_no"),
# (display_message, "@DEBUG: {s1} chances: D:{reg1} GA:{reg2} AC:{reg3} AEA:{reg4} AEAC:{reg5}.", 0x30FFC8),
# (try_end),
# (display_message, "@DEBUG: {s1} chances: Defend:{reg1} Gather:{reg2} Attack center:{reg3} Attack party:{reg4} Attack around:{reg5}.", 0x30FFC8),
#(try_end),
#MV test code end

(store_random_in_range, ":random_no", 0, ":sum_weights"),
Expand Down Expand Up @@ -3237,6 +3238,12 @@
(party_set_flags, ":party_no", pf_default_behavior, 1),
(party_set_slot, ":party_no", slot_party_ai_substate, 1),
(try_end),
# (try_begin),
# (eq, cheat_switch, 1),
# (str_store_party_name, s1 , ":center_no"),
# (display_message, "@{s1} siege attack!"),
# (try_end),

]),

]
Expand Down
11 changes: 10 additions & 1 deletion ModuleSystem/module_simple_triggers.py
Expand Up @@ -83,7 +83,9 @@
(try_begin),
(eq, "$g_fast_mode", 1),
(assign, "$g_fast_mode", 0),
(add_xp_to_troop,10000,"trp_player"), #emulate some xp gain in test mode (for siege strength relaxation)
(store_character_level, ":player_level", "trp_player"),
(val_mul, ":player_level", 1000),
(add_xp_to_troop, ":player_level","trp_player"), #emulate some xp gain in test mode (for siege strength relaxation)
(try_end),
(assign, "$g_player_icon_state", pis_normal),
(display_message, "@Breaking camp..."),
Expand Down Expand Up @@ -264,13 +266,20 @@

#TLD: above replaced by this
(party_get_slot, ":garrison_limit", ":center_no", slot_center_garrison_limit),
(try_begin),
(neg|faction_slot_eq, ":faction", slot_faction_side, faction_side_good),
(val_mul, ":garrison_limit", 150),
(val_div, ":garrison_limit", 100),
(try_end),
(party_get_num_companions, ":garrison_size", ":center_no"),

(store_random_in_range, ":chance", 0, 100), #InVain Reduce reinforcements for centers
(try_begin),
(gt, ":garrison_limit", ":garrison_size"),
(lt, ":chance", 30),
(call_script, "script_cf_reinforce_party", ":center_no"),
(str_store_party_name, s1, ":center_no"),
#(display_message, "@{s1} reinforced"),
(try_end),
# (val_sub, ":cur_wealth", reinforcement_cost),
# (party_set_slot, ":center_no", slot_town_wealth, ":cur_wealth"),
Expand Down
2 changes: 2 additions & 0 deletions ModuleSystem/module_triggers.py
Expand Up @@ -1169,6 +1169,8 @@
# and reinforce
(assign, ":garrison_strength", 80), #InVain was 13. This is very high so the siegable_always camps don't get razed immediately
(party_get_slot, ":garrison_limit", ":center", slot_center_garrison_limit),
(val_mul, ":garrison_limit", 150),
(val_div, ":garrison_limit", 100),
(try_for_range, ":unused", 0, ":garrison_strength"),
(call_script, "script_cf_reinforce_party", ":center"),
(try_begin), #TLD: don't go overboard
Expand Down
2 changes: 1 addition & 1 deletion _wb/item_kinds1.txt
Expand Up @@ -1923,7 +1923,7 @@ itemsfile version 2
itm_khand_inf_helm_c2 Khand_Bowl_Helm Khand_Bowl_Helm 3 khand_inf_helm_c2a 134 khand_inf_helm_c2b 0 khand_inf_helm_c2c 167772160 65548 0 800 167772294 3 100 31 0 0 0 0 0 0 0 0 0 0
0

itm_khand_inf_helm_d Khand_Cone_Helm Khand_Cone_Helm 3 khand_inf_helm_d1 134 khand_inf_helm_d2 0 khand_inf_helm_d3 167772160 65548 0 800 167772294 3.5 100 34 0 0 0 0 0 0 0 0 0 0
itm_khand_inf_helm_d Khand_Cone_Helm Khand_Cone_Helm 3 khand_inf_helm_d1 134 khand_inf_helm_d2 0 khand_inf_helm_d4 167772160 65548 0 800 167772294 3.5 100 34 0 0 0 0 0 0 0 0 0 0
0

itm_khand_cav_helm_a Khand_Rider_Helm Khand_Rider_Helm 3 khand_cav_helm_a1 134 khand_cav_helm_a2 0 khand_cav_helm_a3 167772160 65548 0 800 704643206 3 100 33 0 0 0 0 0 0 0 0 0 0
Expand Down
2 changes: 1 addition & 1 deletion _wb/quick_strings.txt
Expand Up @@ -84,7 +84,7 @@ qstr_a_MAN^_subjugated_by a_MAN,^_subjugated_by_Sauron
qstr_an_ORC^_serving_the_W an_ORC,^_serving_the_White_Hand
qstr_an_URUK_HAI^_bred_in an_URUK-HAI,^_bred_in_Isengard
qstr_a_MAN_of_Dunland^_th a_MAN_of_Dunland,^_the_Western_Plains
qstr__rev_98_wb__dev_^_Bu _rev_98_wb_|_dev_^_Built_2020-10-11_14:00___
qstr__rev_99_wb__dev_^_Bu _rev_99_wb_|_dev_^_Built_2020-10-17_18:59___
qstr_Click_the_center_but Click_the_center_button_to_toggle_faction^Click_the_avatars_to_view_details_of_them
qstr_Level:_{reg3}^Health Level:_{reg3}^Health:_{reg4}
qstr_Attributes Attributes
Expand Down
6 changes: 3 additions & 3 deletions _wb/scripts.txt

Large diffs are not rendered by default.

0 comments on commit 3620299

Please sign in to comment.