Skip to content

Commit

Permalink
* New formula for merchant money and imod quality of merchandise, tak…
Browse files Browse the repository at this point in the history
…ing into account rank, center relation, and trade skill;

* Reduce base amount of loot
  • Loading branch information
In-Vain committed Sep 16, 2020
1 parent 6792c41 commit 7755dab
Show file tree
Hide file tree
Showing 11 changed files with 119 additions and 74 deletions.
86 changes: 43 additions & 43 deletions ModuleSystem/module_constants.py

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions ModuleSystem/module_scripts.py
Expand Up @@ -2167,7 +2167,7 @@ def set_item_score():
(gt,":volunteers",0), # Rafa: a very crude handling of the volunteer's party not being created

# compute ideal number of volunteers #InVain: Adjusted to account for bigger starting garrison sizes, putting more weight on player progress
#current formula is =((garrison/10 + rank*10 + influence*5) * (relation*2+100))/1000 +3
#current formula is =((garrison/10 + rank*10 + leadership*5) * (relation*2+100))/1000 +3
(store_party_size_wo_prisoners, ":to_add", ":town"),
(val_div, ":to_add", 10),
(call_script, "script_get_faction_rank", ":fac"),
Expand Down Expand Up @@ -4724,7 +4724,7 @@ def set_item_score():
(assign, ":can_steal", 1), # can steal objects of own faction or , of no faction
(try_begin), (faction_slot_eq, "$players_kingdom", slot_faction_side, faction_side_good), (assign, ":can_steal", 0),(try_end), # good guys don't steal
# Loot the defeated party
(store_mul, ":loot_probability", player_loot_share, 3),
(store_mul, ":loot_probability", player_loot_share, 2),
(val_mul, ":loot_probability", "$g_strength_contribution_of_player"),
(party_get_skill_level, ":player_party_looting", "p_main_party", "skl_looting"),
(val_add, ":player_party_looting", 10),
Expand Down
2 changes: 1 addition & 1 deletion ModuleSystem/module_skills.py
Expand Up @@ -39,7 +39,7 @@
# If you want to add a new skill, use the reserved skills or use non-hardcoded skills.

skills = [
("trade","Bargainer",sf_base_att_cha|sf_effects_party,10,"Levels of this skill make it possible to claim more equipment for less Resource Points. (Party skill)"),
("trade","Bargainer",sf_base_att_cha|sf_effects_party,10,"Makes smiths and supply masters more cooperative and offer better equipment. (Party skill)"),
("leadership","Leadership",sf_base_att_cha,10,"Every point increases maximum number of troops you can command by 5, increases your party morale and reduces troop wages by 5%%. (Leader skill)"),
("prisoner_management", "Prisoner Management",sf_base_att_cha,10,"Every level of this skill increases maximum number of prisoners by %d. (Leader skill)"),
("reserved_1","Reserved Skill 1",sf_base_att_cha|sf_inactive,10,"This is a reserved skill."),
Expand Down
79 changes: 62 additions & 17 deletions ModuleSystem/module_triggers.py
Expand Up @@ -73,7 +73,7 @@
(store_add,":last_item_plus_one", "itm_ent_body", 1),

# Add Center Relations modifier to Item Quality in Smiths
(assign, ":base_chance", 75),
(assign, ":base_chance", 50),
(store_troop_faction, ":smith_faction", ":cur_merchant"),
(assign, ":smith_found", 0),
(try_for_range, ":center_list", centers_begin, centers_end),
Expand All @@ -83,19 +83,17 @@
(party_slot_eq, ":center_list", slot_town_weaponsmith, ":cur_merchant"),
(assign, ":smith_found", 1),
(party_get_slot, ":center_relation", ":center_list", slot_center_player_relation),
(store_mul, ":quality_modifier", ":center_relation", 2), #Tweakable.
(val_add, ":quality_modifier", ":base_chance"),
(try_end),


#(try_begin), # bad guys have shitty quality shops - modified above
# (neg|faction_slot_eq, ":faction", slot_faction_side, faction_side_good),
# (set_merchandise_modifier_quality, 50),
#(else_try),
# (set_merchandise_modifier_quality,100),
#(try_end),

(set_merchandise_modifier_quality, ":quality_modifier"), #new formula
(call_script, "script_get_faction_rank", ":faction"),
(store_mul, ":rank_modifier", reg0, 10),
(party_get_skill_level, ":player_party_trading", "p_main_party", "skl_trade"),
(store_mul, ":trading_modifier", ":player_party_trading", 10),
(store_add, ":quality_modifier", ":center_relation", ":rank_modifier"),
(val_add, ":quality_modifier", ":trading_modifier"),
(val_add, ":quality_modifier", ":base_chance"),
(set_merchandise_modifier_quality, ":quality_modifier"), #new formula

#swy-- for every item in the list, check if matches the seller's
# faction + subfaction and add it to the probability list if so...
Expand Down Expand Up @@ -191,9 +189,25 @@
#swy-- make room for the new items and give him some extra money if needed...
(troop_ensure_inventory_space,":cur_merchant",merchant_inventory_space),
(troop_sort_inventory, ":cur_merchant"),
(store_troop_gold, ":gold",":cur_merchant"),

#InVain: Scale merchant gold
(store_troop_gold, ":cur_gold",":cur_merchant"),
(troop_get_slot, ":min_gold", ":cur_merchant", slot_troop_shop_gold),
(call_script, "script_get_faction_rank", ":faction"),
(assign, ":rank", reg0),
(val_mul, ":rank", 50),
(val_add, ":min_gold", ":rank"),

#(party_get_slot, ":center_relation", ":town", slot_center_player_relation),
(party_get_skill_level, ":player_party_trading", "p_main_party", "skl_trade"),
(val_mul, ":player_party_trading", 100),
(val_add, ":min_gold", ":player_party_trading"),

(val_mul, ":center_relation", 10),
(val_add, ":min_gold", ":center_relation"),


(lt, ":gold",900),
(lt, ":cur_gold",":min_gold"),
(store_random_in_range,":new_gold",200,400),
(call_script, "script_troop_add_gold",":cur_merchant",":new_gold"),
(try_end),
Expand Down Expand Up @@ -259,7 +273,20 @@
(try_end),
(try_end),
(try_end),


# # Add Center Relations modifier to Item Quality in horse merchants
(assign, ":base_chance", 50),
(party_get_slot, ":center_relation", ":cur_center", slot_center_player_relation),
(call_script, "script_get_faction_rank", ":faction"),
(store_mul, ":rank_modifier", reg0, 10),
(party_get_skill_level, ":player_party_trading", "p_main_party", "skl_trade"),
(store_mul, ":trading_modifier", ":player_party_trading", 10),

(store_add, ":quality_modifier", ":center_relation", ":rank_modifier"),
(val_add, ":quality_modifier", ":trading_modifier"),
(val_add, ":quality_modifier", ":base_chance"),
(set_merchandise_modifier_quality, ":quality_modifier"), #new formula

#swy-- add poneys to the Iron Hills camp merchant, that's it.
# poneys are always cool if there are dwarves over them!

Expand Down Expand Up @@ -313,11 +340,29 @@
(troop_add_merchandise,":cur_merchant",itp_type_goods,":num_goods"),
(troop_ensure_inventory_space,":cur_merchant",merchant_inventory_space), #MV: moved after goods and changed from 65
(troop_sort_inventory, ":cur_merchant"),
(store_troop_gold, ":cur_gold",":cur_merchant"),

#swy-- if the horse/ goods merchant is short of bucks, yo. give somm' money to da biotch!
# don't expect enlightening comments all the way down. this is the jungle!
(lt,":cur_gold",600),
#InVain: Scale merchant gold
(store_troop_gold, ":cur_gold",":cur_merchant"),
(troop_get_slot, ":min_gold", ":cur_merchant", slot_troop_shop_gold),
(val_mul, ":min_gold", 2),
(val_div, ":min_gold", 3), #horse merchants have less base gold than smiths

(call_script, "script_get_faction_rank", ":faction"),
(assign, ":rank", reg0),
(val_mul, ":rank", 50),
(val_add, ":min_gold", ":rank"),

(party_get_slot, ":center_relation", ":cur_center", slot_center_player_relation),
(val_mul, ":center_relation", 10),
(val_add, ":min_gold", ":center_relation"),

(party_get_skill_level, ":player_party_trading", "p_main_party", "skl_trade"),
(val_mul, ":player_party_trading", 100),
(val_add, ":min_gold", ":player_party_trading"),

(lt, ":cur_gold",":min_gold"),
(store_random_in_range,":new_gold",200,400),
(call_script, "script_troop_add_gold",":cur_merchant",":new_gold"),
(try_end),
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_80_wb__dev_^_Bu _rev_80_wb_|_dev_^_Built_2020-09-11_20:25___
qstr__rev_81_wb__dev_^_Bu _rev_81_wb_|_dev_^_Built_2020-09-16_18:09___
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
4 changes: 2 additions & 2 deletions _wb/scripts.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion _wb/skills.txt
@@ -1,5 +1,5 @@
42
skl_trade Bargainer 19 10 Levels_of_this_skill_make_it_possible_to_claim_more_equipment_for_less_Resource_Points._(Party_skill)
skl_trade Bargainer 19 10 Makes_smiths_and_supply_masters_more_cooperative_and_offer_better_equipment._(Party_skill)
skl_leadership Leadership 3 10 Every_point_increases_maximum_number_of_troops_you_can_command_by_5,_increases_your_party_morale_and_reduces_troop_wages_by_5%%._(Leader_skill)
skl_prisoner_management Prisoner_Management 3 10 Every_level_of_this_skill_increases_maximum_number_of_prisoners_by_%d._(Leader_skill)
skl_reserved_1 Reserved_Skill_1 259 10 This_is_a_reserved_skill.
Expand Down
4 changes: 2 additions & 2 deletions _wb/triggers.txt

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions scripts.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion skills.txt
@@ -1,5 +1,5 @@
42
skl_trade Bargainer 19 10 Levels_of_this_skill_make_it_possible_to_claim_more_equipment_for_less_Resource_Points._(Party_skill)
skl_trade Bargainer 19 10 Makes_smiths_and_supply_masters_more_cooperative_and_offer_better_equipment._(Party_skill)
skl_leadership Leadership 3 10 Every_point_increases_maximum_number_of_troops_you_can_command_by_5,_increases_your_party_morale_and_reduces_troop_wages_by_5%%._(Leader_skill)
skl_prisoner_management Prisoner_Management 3 10 Every_level_of_this_skill_increases_maximum_number_of_prisoners_by_%d._(Leader_skill)
skl_reserved_1 Reserved_Skill_1 259 10 This_is_a_reserved_skill.
Expand Down

0 comments on commit 7755dab

Please sign in to comment.