Skip to content

Commit

Permalink
Update 1.3.0 (#5)
Browse files Browse the repository at this point in the history
- Added a vassalization choice to the confederation dilemma
- Fixed a bug that caused an error when AI minor factions tried to confederate
- Fixed a bug that prevented player from confederating minor factions
- Updated workshop first image
  • Loading branch information
msolefonte authored Aug 21, 2022
1 parent 69495cb commit 03d23c9
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 19 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Improved logging features for better bug reports
- Added a new MCT section named "Advanced Options"
- Added an `Enable logging` checkbox to MCT
- Added an `Enable logging` checkbox to MCT

## [1.3.0] - 21.08.2022

- Added a vassalization choice to the confederation dilemma
- Fixed a bug that caused an error when AI minor factions tried to confederate
- Fixed a bug that prevented player from confederating minor factions
- Updated workshop first image
Binary file modified dist/wolfy_chaos-confederation.pack
Binary file not shown.
Binary file modified dist/wolfy_chaos-confederation_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified src/db/dilemmas_tables/wolfy_roc_confederation
Binary file not shown.
41 changes: 24 additions & 17 deletions src/script/campaign/mod/wolfy_chaos_confederation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ function is_confederation_possible(victorious_faction_name, defeated_character)
confederable_factions = wcc_dataset.confederable_factions_no_minor[victorious_faction_name];
end

for _, confederable_faction in ipairs(confederable_factions) do
if defeated_character:faction():name() == confederable_faction then
wcc_log("Confederation valid: " .. confederable_faction .. " -> " .. victorious_faction_name);
return true;
if confederable_factions ~= nil then
for _, confederable_faction in ipairs(confederable_factions) do
if defeated_character:faction():name() == confederable_faction then
wcc_log("Confederation valid: " .. confederable_faction .. " -> " .. victorious_faction_name);
return true;
end
end
end
end
Expand All @@ -64,19 +66,27 @@ function force_kill_leader(enemy_leader_family_member_key)
cm:kill_character(character_cqi, false);
end

function listen_for_execution_of_lord(enemy_leader_family_member_key)
function add_dilemma_choice_listeners(victorious_faction, defeated_character)
core:add_listener(
"wcc_dilemma_choice_made_event",
"DilemmaChoiceMadeEvent",
true,
function(context)
wcc_log("Dilemma " .. context:dilemma() .. " choice made. Choice selected: " .. context:choice());
if cm:model():difficulty_level() == -3 and not cm:is_multiplayer() then -- Auto save on legendary
wcc_log("Autosaving on Legendary");
cm:callback(function() cm:autosave_at_next_opportunity() end, 0.5);
end;

if context:dilemma() == wcc_dataset.dilemma_key and context:choice() == wcc_dataset.dilemma_execution_option then
force_kill_leader(enemy_leader_family_member_key);
if context:dilemma() == wcc_dataset.dilemma_key and context:choice() == wcc_dataset.dilemma_choice_execution then
force_kill_leader(defeated_character:family_member():command_queue_index());
end

if (context:dilemma() == wcc_dataset.dilemma_key or context:dilemma() == wcc_dataset.dilemma_key_lls) and
context:choice() == wcc_dataset.dilemma_choice_vassalization then
wcc_log("Force make vassal: " .. victorious_faction:name() .. " -> " .. defeated_character:faction():name());
cm:force_make_vassal(victorious_faction:name(), defeated_character:faction():name())
end
end,
false
);
Expand All @@ -85,20 +95,17 @@ end
function attempt_to_launch_confederate_dilemma(victorious_faction, defeated_character)
if is_confederation_possible(victorious_faction:name(), defeated_character) then
if victorious_faction:is_human() then
local confederate_dilemma_key = wcc_dataset.confederate_dilemma_key;
local confederate_dilemma_key = wcc_dataset.dilemma_key;
if wcc_dataset.confederable_legendary_lords[defeated_character:character_subtype_key()] ~= nil then
confederate_dilemma_key = wcc_dataset.dilemma_key_lls;
end

cm:trigger_dilemma_with_targets(victorious_faction:command_queue_index(),
confederate_dilemma_key,
defeated_character:faction():command_queue_index(),
0,
defeated_character:command_queue_index(),
0,
0,
0,
function() listen_for_execution_of_lord(defeated_character:family_member():command_queue_index()) end);
cm:trigger_dilemma_with_targets(
victorious_faction:command_queue_index(), confederate_dilemma_key,
defeated_character:faction():command_queue_index(), 0, defeated_character:command_queue_index(), 0, 0, 0,
function()
add_dilemma_choice_listeners(victorious_faction, defeated_character);
end);
elseif get_config("enable_ai_confederation") then
wcc_log("Faction ".. victorious_faction:name().." is confederating ".. defeated_character:faction():name());
cm:force_confederation(victorious_faction:name(), defeated_character:faction():name());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ local wcc_dataset = {
"wh3_main_sla_slaanesh",
"wh3_main_tze_tzeentch"
},
dilemma_execution_option = 1,
dilemma_choice_vassalization = 1,
dilemma_choice_execution = 2,
dilemma_key = "wolfy_roc_confederation_generic",
dilemma_key_lls = "wolfy_roc_confederation_generic_no_execution"
}
Expand Down
Binary file modified src/text/db/wolfy_chaos_confederation.loc
Binary file not shown.

0 comments on commit 03d23c9

Please sign in to comment.