From 099a82efd387115941414823ec80e58a0054704f Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Sun, 7 Dec 2025 20:20:57 +0000 Subject: [PATCH 01/31] multipart questing --- objects/obj_en_fleet/Create_0.gml | 1 + .../scr_fleet_functions.gml | 2 +- .../scr_forge_world_functions.gml | 24 ++++--- .../scr_imperial_navy_functions.gml | 14 +++++ .../scr_marine_struct/scr_marine_struct.gml | 31 +++++++-- .../scr_mission_functions.gml | 63 ++++++++++++++++--- .../scr_roman_numerals/scr_roman_numerals.gml | 7 ++- 7 files changed, 119 insertions(+), 23 deletions(-) diff --git a/objects/obj_en_fleet/Create_0.gml b/objects/obj_en_fleet/Create_0.gml index 9d4dedc716..1fa49d218f 100644 --- a/objects/obj_en_fleet/Create_0.gml +++ b/objects/obj_en_fleet/Create_0.gml @@ -22,6 +22,7 @@ ii_check=floor(random(5))+1; etah=0; safe=0; last_turn_check = 0; +uid = scr_uuid_generate(); //TODO set up special save method for faction specific fleet variables inquisitor=-1; diff --git a/scripts/scr_fleet_functions/scr_fleet_functions.gml b/scripts/scr_fleet_functions/scr_fleet_functions.gml index ee1e9f941a..e12876aad0 100644 --- a/scripts/scr_fleet_functions/scr_fleet_functions.gml +++ b/scripts/scr_fleet_functions/scr_fleet_functions.gml @@ -49,7 +49,7 @@ function fleets_next_location(fleet = "none", visited = []) { array_push(visited, fleet.id); // Check if the fleet has a 'target' variable - if (variable_instance_exists(fleet, "target")) { + if (action != "" && variable_instance_exists(fleet, "target")) { // If the target is valid and not already in the visited list, proceed recursively var fleet_target_valid = scr_valid_fleet_target(fleet.target); if (!fleet_target_valid) { diff --git a/scripts/scr_forge_world_functions/scr_forge_world_functions.gml b/scripts/scr_forge_world_functions/scr_forge_world_functions.gml index cb8caf3b9e..34e2b21182 100644 --- a/scripts/scr_forge_world_functions/scr_forge_world_functions.gml +++ b/scripts/scr_forge_world_functions/scr_forge_world_functions.gml @@ -3,12 +3,7 @@ function imperial_navy_fleet_construction(){ // ** Check number of navy fleets ** - var new_navy_fleets = []; - with(obj_en_fleet){ - if (owner==eFACTION.Imperium) and (navy==1) { - array_push(new_navy_fleets, id); - } - } + var new_navy_fleets = get_imperial_navy_fleets(); //delete navy fleets if more than required var navy_fleet_count = array_length(new_navy_fleets); var cur_fleet; @@ -22,12 +17,16 @@ function imperial_navy_fleet_construction(){ navy_fleet_count--; array_delete(new_navy_fleets, i, 1); i--; - if (navy_fleet_count<=target_navy_number) then break; + if (navy_fleet_count<=target_navy_number){ + break; + } } } //if system needs more navy fleets get forge world to make some } else if (navy_fleet_count 15 && array_length(_navy_fleets)){ + _pop_data = { + trophy_owner : array_random_element(_successful_hunters), + system: self.name, + planet : targ_planet, + target_fleet : array_random_element(_navy_fleets) + }; + + var _options = { + choice_func : init_deliver_trophy_mission, + str1 : "Continue", + } + } if (_success){ _mission_string = $"The mission was a success and a great number of beasts rounded up and slain, your marines were able to gain great skills and the prestige of your chapter has increased greatly across the planets populace." if (_deaths){ @@ -532,13 +549,45 @@ function complete_beast_hunt_mission(targ_planet, problem_index){ _mission_string = $"The mission was a failiure. The governor is disapointed and the legend of your chapter has undoubtedly been diminished"; _mission_string += $"\n{_unit_report_string}"; } - scr_popup($"Beast Hunt on {planet_numeral_name(i)}",_mission_string,"",""); + scr_popup($"Beast Hunt on {planet_numeral_name(i)}",_mission_string,"",_pop_data); remove_planet_problem(targ_planet, "hunt_beast"); + } else { remove_planet_problem(targ_planet, "hunt_beast"); } } +function init_deliver_trophy_mission(){ + text = $"After your marines return there is a great feast to honour them. Much fanfare is made of the great trophy {_pop_data.trophy_owner.name_role()} bears, a great monstrous head as tall as he is that the governor proclaims must be the largest of it's kind and the momst fearsome beast in the sector."; + + text += $"\n\nAn astropathic message is later recieved from the Commander of an Imperial Navy fleet explaining that his fleet is currrently home to the {irandom_numeral(100)},{irandom_numeral(100)} and {irandom_numeral(100)} {_pop_data.system} Regiments and pleads that the trophy be delivered to his fleet in order to boost the moral of the regiments and fleet in general"; + + replace_options([ + { + str1 : "Refuse and place the trophy into the Librarium", + choice_func : function(){ + + } + + }, + { + str1 : "Accept", + choice_func : function(){ + text = $"You Send a reply to tell the commander you accept and will ensure the trophy is delivered in person by the marine that slew the beast"; + var _targ_fleet = pop_data.target_fleet; + + var _targ_fleet_intercept = fleets_next_location(_targ_fleet); + if (_targ_fleet.action==""){ + text += $"\n\n the fleet in question is currently active around the {_targ_fleet_intercept.name} system"; + } else { + text += $"\n\n the fleet will next be accessible around the {_targ_fleet_intercept.name} system"; + } + reset_popup_options(); + } + } + ]) + +} //TODO allow most of these functions to be condensed and allow arrays of problems or planets and maybe increase filtering options //filtering options could be done via universal methods that all the filters to be passed to many other game systems function has_any_problem_planet(planet, star="none"){ diff --git a/scripts/scr_roman_numerals/scr_roman_numerals.gml b/scripts/scr_roman_numerals/scr_roman_numerals.gml index 203470c107..2850803ae0 100644 --- a/scripts/scr_roman_numerals/scr_roman_numerals.gml +++ b/scripts/scr_roman_numerals/scr_roman_numerals.gml @@ -20,7 +20,7 @@ function int_to_roman(_num) { return ""; } - var _roman_numerals = [ + static _roman_numerals = [ 100, "C", 90, "XC", 50, "L", 40, "XL", 10, "X", 9, "IX", 5, "V", 4, "IV", 1, "I" ]; @@ -39,3 +39,8 @@ function int_to_roman(_num) { return _result; } + + +function irandom_numeral(max_val){ + return int_to_roman(irandom_range(1, max_val)); +} \ No newline at end of file From f16c6867d782252ed99e3d07820934d7c71df07d Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Tue, 9 Dec 2025 21:22:54 +0000 Subject: [PATCH 02/31] create FleetEvent constructor --- ChapterMaster.yyp | 1 + objects/obj_controller/Alarm_5.gml | 8 ++ objects/obj_en_fleet/Create_0.gml | 43 ++++++++++- objects/obj_en_fleet/Destroy_0.gml | 2 + scripts/instance_create/instance_create.gml | 5 ++ scripts/scr_fleet_events/scr_fleet_events.gml | 59 ++++++++++++++ scripts/scr_fleet_events/scr_fleet_events.yy | 13 ++++ .../scr_fleet_functions.gml | 12 +++ .../scr_load_controller.gml | 7 -- .../scr_mission_functions.gml | 76 ++++++++++++++++++- .../scr_save_controller.gml | 6 -- 11 files changed, 216 insertions(+), 16 deletions(-) create mode 100644 scripts/scr_fleet_events/scr_fleet_events.gml create mode 100644 scripts/scr_fleet_events/scr_fleet_events.yy diff --git a/ChapterMaster.yyp b/ChapterMaster.yyp index 9ab5a14aed..71eb64e857 100644 --- a/ChapterMaster.yyp +++ b/ChapterMaster.yyp @@ -819,6 +819,7 @@ {"id":{"name":"scr_flavor","path":"scripts/scr_flavor/scr_flavor.yy",},}, {"id":{"name":"scr_flavor2","path":"scripts/scr_flavor2/scr_flavor2.yy",},}, {"id":{"name":"scr_fleet_advisor","path":"scripts/scr_fleet_advisor/scr_fleet_advisor.yy",},}, + {"id":{"name":"scr_fleet_events","path":"scripts/scr_fleet_events/scr_fleet_events.yy",},}, {"id":{"name":"scr_fleet_functions","path":"scripts/scr_fleet_functions/scr_fleet_functions.yy",},}, {"id":{"name":"scr_forge_world_functions","path":"scripts/scr_forge_world_functions/scr_forge_world_functions.yy",},}, {"id":{"name":"scr_garrison","path":"scripts/scr_garrison/scr_garrison.yy",},}, diff --git a/objects/obj_controller/Alarm_5.gml b/objects/obj_controller/Alarm_5.gml index 2dc4e54fd1..c676504a97 100644 --- a/objects/obj_controller/Alarm_5.gml +++ b/objects/obj_controller/Alarm_5.gml @@ -549,12 +549,20 @@ location_viewer.update_mission_log(); init_ork_waagh(); return_lost_ships_chance(); //complex route plotting for player fleets + +with (obj_en_fleet){ + if (array_length(events)){ + check_events(); + } +} + with (obj_p_fleet){ if (array_length(complex_route)>0 && action == ""){ set_new_player_fleet_course(complex_route); } } + }); if (helpful_places != false){ diff --git a/objects/obj_en_fleet/Create_0.gml b/objects/obj_en_fleet/Create_0.gml index 1fa49d218f..24b35af45d 100644 --- a/objects/obj_en_fleet/Create_0.gml +++ b/objects/obj_en_fleet/Create_0.gml @@ -23,6 +23,36 @@ etah=0; safe=0; last_turn_check = 0; uid = scr_uuid_generate(); + +events = []; + +add_event = function(event){ + event.fleet_uid = uid; + array_push(events, event); +} + +check_events = function(){ + for (var i=array_length(events)-1;i>=0;i--){ + var _event = events[i]; + + _event.turn_sequence(); + + if (_event.state == "destroy"){ + array_delete(events,i,1); + } + + } +} + +check_events_destructions = function(){ + for (var i=array_length(events)-1;i>=0;i--){ + var _event = events[i]; + + _event.destroy_sequence(); + + array_delete(events,i,1); + } +} //TODO set up special save method for faction specific fleet variables inquisitor=-1; @@ -103,7 +133,7 @@ serialize = function(){ return save_data; } deserialize = function(save_data){ - var exclusions = ["id","cargo_data"]; // skip automatic setting of certain vars, handle explicitly later + var exclusions = ["id","cargo_data","events"]; // skip automatic setting of certain vars, handle explicitly later // Automatic var setting var all_names = struct_get_names(save_data); @@ -132,6 +162,17 @@ deserialize = function(save_data){ } } + if (save_data, "events"){ + for (var i=0;i 0){ + timer--; + + if (timer == 0 ){ + if (struct_exists(self,"timer_end")){ + call_fleet_event_function(timer_end); + } + state = "destroy"; + } + } + } + + static destroy_sequence = function(){ + if (struct_exists(self , "destroy")){ + call_fleet_event_function(destroy); + } + } + + static call_fleet_event_function = function(_func_name){ + if (struct_exists(fleet_event_functions,_func_name)){ + fleet_event_functions[$ _func_name](); + } + } + + static fleet_event_functions = { + "deliver_trophy_mission_timed_out" : deliver_trophy_mission_timed_out, + "deliver_trophy_mission_fleet_destroyed" : deliver_trophy_mission_fleet_destroyed, + "deliver_trophy_end_turn_check" :deliver_trophy_end_turn_check, + } + + +} \ No newline at end of file diff --git a/scripts/scr_fleet_events/scr_fleet_events.yy b/scripts/scr_fleet_events/scr_fleet_events.yy new file mode 100644 index 0000000000..9ab241e722 --- /dev/null +++ b/scripts/scr_fleet_events/scr_fleet_events.yy @@ -0,0 +1,13 @@ +{ + "$GMScript":"v1", + "%Name":"scr_fleet_events", + "isCompatibility":false, + "isDnD":false, + "name":"scr_fleet_events", + "parent":{ + "name":"fleet", + "path":"folders/Scripts/fleet.yy", + }, + "resourceType":"GMScript", + "resourceVersion":"2.0", +} \ No newline at end of file diff --git a/scripts/scr_fleet_functions/scr_fleet_functions.gml b/scripts/scr_fleet_functions/scr_fleet_functions.gml index e12876aad0..633f22b598 100644 --- a/scripts/scr_fleet_functions/scr_fleet_functions.gml +++ b/scripts/scr_fleet_functions/scr_fleet_functions.gml @@ -37,6 +37,18 @@ function scr_valid_fleet_target(target) { return valid; } +function get_fleet_uid = function(search_uid){ + var _fleet = -1; + with (obj_en_fleet){ + if (uid == search_uid){ + _fleet =id; + break; + } + } + + return _fleet; +} + function fleets_next_location(fleet = "none", visited = []) { var targ_location = "none"; diff --git a/scripts/scr_load_controller/scr_load_controller.gml b/scripts/scr_load_controller/scr_load_controller.gml index f20fc9877e..bbfaa523cf 100644 --- a/scripts/scr_load_controller/scr_load_controller.gml +++ b/scripts/scr_load_controller/scr_load_controller.gml @@ -325,13 +325,6 @@ function scr_load_controller(save_id){ obj_controller.turns_ignored[g]=ini_read_real("Factions","turns_ignored"+string(g),0); } // - var g;g=0; - repeat(50){g+=1; - obj_controller.quest[g]=ini_read_string("Ongoing","quest"+string(g),""); - obj_controller.quest_faction[g]=ini_read_real("Ongoing","quest_faction"+string(g),0); - obj_controller.quest_end[g]=ini_read_real("Ongoing","quest_end"+string(g),0); - } - // obj_controller.justmet=0; obj_controller.check_number=ini_read_real("Controller","check_number",0); obj_controller.year_fraction=ini_read_real("Controller","year_fraction",0); diff --git a/scripts/scr_mission_functions/scr_mission_functions.gml b/scripts/scr_mission_functions/scr_mission_functions.gml index 23759c67a2..f09a9f95e6 100644 --- a/scripts/scr_mission_functions/scr_mission_functions.gml +++ b/scripts/scr_mission_functions/scr_mission_functions.gml @@ -559,7 +559,7 @@ function complete_beast_hunt_mission(targ_planet, problem_index){ function init_deliver_trophy_mission(){ text = $"After your marines return there is a great feast to honour them. Much fanfare is made of the great trophy {_pop_data.trophy_owner.name_role()} bears, a great monstrous head as tall as he is that the governor proclaims must be the largest of it's kind and the momst fearsome beast in the sector."; - text += $"\n\nAn astropathic message is later recieved from the Commander of an Imperial Navy fleet explaining that his fleet is currrently home to the {irandom_numeral(100)},{irandom_numeral(100)} and {irandom_numeral(100)} {_pop_data.system} Regiments and pleads that the trophy be delivered to his fleet in order to boost the moral of the regiments and fleet in general"; + text += $"\n\nAn astropathic message is later recieved from the Commander of an Imperial Navy fleet explaining that his fleet is currrently home to the {irandom_numeral(100)},{irandom_numeral(100)} and {irandom_numeral(100)} {_pop_data.system} Regiments and pleads that the trophy be handed over to his fleet in order to boost the moral of the regiments and fleet in general"; replace_options([ { @@ -582,12 +582,84 @@ function init_deliver_trophy_mission(){ text += $"\n\n the fleet will next be accessible around the {_targ_fleet_intercept.name} system"; } + pop_data.target_fleet = target_fleet.uid; + + var _fleet_event = new FleetEvent(pop_data); + + _fleet_event.turn_end = "deliver_trophy_end_turn_check"; + _fleet_event.destroy = "deliver_trophy_mission_fleet_destroyed"; + _fleet_event.timer_end = "deliver_trophy_mission_timed_out"; + + _fleet_event.timer = 120; + + _targ_fleet.add_event(_fleet_event); + + reset_popup_options(); } } - ]) + ]); + +} + + +///@mixin FleetEvent +function deliver_trophy_mission_timed_out(){ + scr_popup( + "Objective Forgotten", + $"It has been so long in the life of a mortal that the commanders that once saught your delivery of the trophy from the hunt on {event_data.system} have now all either died or moved to greener pastures. The trophy will instead remain in the chapters possession", + ); +} + +///@mixin FleetEvent +function deliver_trophy_mission_fleet_destroyed(){ + scr_popup( + "Fleet Destroyed", + $"With the Imperial Navy fleet containing the regiments from {event_data.system} destroyed there is no reason to now deliver the trophy from the hunt to them The trophy will instead remain in the chapters possession", + ); +} + +///@mixin FleetEvent +function deliver_trophy_end_turn_check(){ + var _navy_fleet = get_fleet_uid(fleet_uid); + if (!instance_exists(_navy_fleet)){ + deliver_trophy_mission_fleet_destroyed(); + return; + } + + var _ratio =0; + with (_navy_fleet){ + _ratio = fleet_remaining_guard_ratio(); + } + + if (_ratio<=0){ + scr_popup( + "Regiments Destroyed ", + $"The guard Regiments from {event_data.system} serving in the imperial navy fleet have been annihilated wholesale there is no reason to now deliver the trophy from the hunt to them The trophy will instead remain in the chapters possession", + ); + return; + } + if (is_orbiting(_navy_fleet)){ + var _nearest_player = instance_at_location(_navy_fleet.x,_navy_fleet.y,obj_p_fleet); + if (instance_exists(_nearest_player)){ + var _ships = fleet_full_ship_array(_nearest_player); + var _marine = get_unit_uid(event_data.trophy_owner); + var _present = _marine.is_at_location("", 0, _ships); + var _meet_point = _navy_fleet.orbiting; + if (_present){ + var _text = "{_marine.role(name)} is able to rendevous with the imperial navy at {_meet_point.name}." + _text += $" The guard regiments of {event_data.system} are overjoyed at the delivery of the trophy and find the beast that the head came from adorns tmany of the regiments banners"; + scr_popup( + "Trophy Delivered ", + _text, + ); + } + } + } } + + //TODO allow most of these functions to be condensed and allow arrays of problems or planets and maybe increase filtering options //filtering options could be done via universal methods that all the filters to be passed to many other game systems function has_any_problem_planet(planet, star="none"){ diff --git a/scripts/scr_save_controller/scr_save_controller.gml b/scripts/scr_save_controller/scr_save_controller.gml index 787a93951b..d843523f49 100644 --- a/scripts/scr_save_controller/scr_save_controller.gml +++ b/scripts/scr_save_controller/scr_save_controller.gml @@ -219,12 +219,6 @@ function scr_save_controller(save_id){ } // var g;g=0; - repeat(50){g+=1; - ini_write_string("Ongoing","quest"+string(g),obj_controller.quest[g]); - ini_write_real("Ongoing","quest_faction"+string(g),obj_controller.quest_faction[g]); - ini_write_real("Ongoing","quest_end"+string(g),obj_controller.quest_end[g]); - } - var g;g=0; // ini_write_real("Controller","justmet",obj_controller.faction_justmet); ini_write_real("Controller","check_number",obj_controller.check_number); From 07a18967a50b0e919361a820b216a5bd29584e5e Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Wed, 10 Dec 2025 00:55:48 +0000 Subject: [PATCH 03/31] most of new mission --- .../scr_mission_functions.gml | 14 ++++++++++++-- .../scr_system_search_helpers.gml | 9 +++++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/scripts/scr_mission_functions/scr_mission_functions.gml b/scripts/scr_mission_functions/scr_mission_functions.gml index f09a9f95e6..c44ca82c7a 100644 --- a/scripts/scr_mission_functions/scr_mission_functions.gml +++ b/scripts/scr_mission_functions/scr_mission_functions.gml @@ -496,7 +496,7 @@ function complete_beast_hunt_mission(targ_planet, problem_index){ _unit = _hunters[i]; _unit_pass = _tester.standard_test(_unit, "weapon_skill",10, ["beast"]); if (_unit_pass[0]){ - if (!_success) then _success=true; + _success=true; _largest_pass = max(_largest_pass,_unit_pass[1]); } if (_unit_pass[0]){ @@ -649,7 +649,17 @@ function deliver_trophy_end_turn_check(){ var _meet_point = _navy_fleet.orbiting; if (_present){ var _text = "{_marine.role(name)} is able to rendevous with the imperial navy at {_meet_point.name}." - _text += $" The guard regiments of {event_data.system} are overjoyed at the delivery of the trophy and find the beast that the head came from adorns tmany of the regiments banners"; + _text += $" The guard regiments of {event_data.system} are overjoyed at the delivery of the trophy and find the beast that the head came from adorns many of the regiments banners."; + _text += $" While The task is for the most part thankless your chapters esteem has risen greatly with the exploits of {_marine.role(name)} spreading far and wide amoung guard regiments."; + var _roll = roll_dice_chapter(1, 100, "high"); + if (_roll>30 && _roll<70){ + //TODO would be cool to have this changed tobe a guard specific piece of equipment + _text += "In return for your labour and in honour of your chapter the commander of the guard division has a brand new Land Raider destined for the army diverted to your chapter"; + scr_add_vehicle("Land Raider"); + } else if (_roll>=70){ + scr_get_stars(true) + _text += "During the concourse that follows with the fleet command your marines learn of a old battle ground discovered on " + } scr_popup( "Trophy Delivered ", _text, diff --git a/scripts/scr_system_search_helpers/scr_system_search_helpers.gml b/scripts/scr_system_search_helpers/scr_system_search_helpers.gml index c7d3ad3fee..8a29b737e4 100644 --- a/scripts/scr_system_search_helpers/scr_system_search_helpers.gml +++ b/scripts/scr_system_search_helpers/scr_system_search_helpers.gml @@ -172,14 +172,15 @@ function scr_get_stars(shuffled=false, ownership=[], types = []) { if (!_owner_sort && !_types_sort){ var _add = true; } else { - var _add = true + var _add = true; if (_owner_sort && !array_contains(ownership,owner)){ - _add = false + _add = false; } if (_add && _types_sort){ + _add = false; for (var i=1;i<=planets;i++){ - types = array_delete_value(types, p_type[i]); - if (!array_length(types)){ + if (array_contains(types,p_type[i])){ + _add = true; break; } } From 89b12727497110d2ce87f2a3eeff6af64a617094 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Wed, 10 Dec 2025 16:31:49 +0000 Subject: [PATCH 04/31] saving and loading and rest of mission --- objects/obj_en_fleet/Create_0.gml | 2 +- objects/obj_en_fleet/Destroy_0.gml | 3 +-- objects/obj_star/Create_0.gml | 5 ++++ scripts/scr_cheatcode/scr_cheatcode.gml | 6 ++++- .../scr_fleet_functions.gml | 4 +-- .../scr_marine_struct/scr_marine_struct.gml | 2 +- .../scr_mission_functions.gml | 27 ++++++++++++++----- .../scr_planetary_feature.gml | 12 ++++++--- .../scr_popup_functions.gml | 3 +++ .../scr_system_search_helpers.gml | 11 ++++++-- 10 files changed, 55 insertions(+), 20 deletions(-) diff --git a/objects/obj_en_fleet/Create_0.gml b/objects/obj_en_fleet/Create_0.gml index 24b35af45d..024096527a 100644 --- a/objects/obj_en_fleet/Create_0.gml +++ b/objects/obj_en_fleet/Create_0.gml @@ -162,7 +162,7 @@ deserialize = function(save_data){ } } - if (save_data, "events"){ + if (struct_exists(save_data, "events")){ for (var i=0;i1){ for (var i=1;i<=planets;i++){ - if(i=planet) then continue; + if (i=planet) then continue; if (p_owner[i]==eFACTION.Imperium){ enemy=i; break; @@ -167,7 +169,9 @@ function init_beast_hunt_mission(planet, star, mission_slot){ gar_pop.title=$"Marines assigned to hunt beasts around {numeral_name}"; gar_pop.text=$"The govornor of {numeral_name} Thanks you for the participation of your elite warriors in your execution of such a menial task.\n It would be best to send at least one amrine that has experience with such tasks"; //pip.image="event_march" - gar_pop.add_option("Happy Hunting"); + gar_pop.add_option({ + str1: "Happy Hunting" + }); gar_pop.image=""; gar_pop.cooldown=8; obj_controller.cooldown=20; @@ -501,7 +505,7 @@ function complete_beast_hunt_mission(targ_planet, problem_index){ } if (_unit_pass[0]){ - var _unit_report_string += _unit.add_trait("beast_slayer",true, true); + _unit_report_string += _unit.add_trait("beast_slayer",true, true); array_push(_successful_hunters, _unit); } else { var _tough_check = _tester.standard_test(_unit, "constitution",_unit.luck); @@ -653,12 +657,21 @@ function deliver_trophy_end_turn_check(){ _text += $" While The task is for the most part thankless your chapters esteem has risen greatly with the exploits of {_marine.role(name)} spreading far and wide amoung guard regiments."; var _roll = roll_dice_chapter(1, 100, "high"); if (_roll>30 && _roll<70){ - //TODO would be cool to have this changed tobe a guard specific piece of equipment + //TODO would be cool to have this changed to be a guard specific piece of equipment _text += "In return for your labour and in honour of your chapter the commander of the guard division has a brand new Land Raider destined for the army diverted to your chapter"; scr_add_vehicle("Land Raider"); } else if (_roll>=70){ - scr_get_stars(true) - _text += "During the concourse that follows with the fleet command your marines learn of a old battle ground discovered on " + var _wanted_types = ["Ice","Desert","Agri","Lava","Death"]; + var _star = scr_get_stars(true,[],_wanted_types)[0]; + _text += "During the concourse that follows with the fleet command your marines learn of a old battle ground discovered on {_star.name}."; + _text += "According too intel it appeared to be an old astartes battle ground from an unknown age, communications have been passed onto the adeptus mechanicus who will no doubt pick the site clean should they reach it befre you do"; + + var _planet = scr_get_planet_with_type(_wanted_types); + var _battle_ground = new NewPlanetFeature(P_features.AstartesBattleGround); + + _battle_ground.player_hidden = false; + + _star.add_feature(_planet,_battle_ground); } scr_popup( "Trophy Delivered ", diff --git a/scripts/scr_planetary_feature/scr_planetary_feature.gml b/scripts/scr_planetary_feature/scr_planetary_feature.gml index a793501f93..8df59e2640 100644 --- a/scripts/scr_planetary_feature/scr_planetary_feature.gml +++ b/scripts/scr_planetary_feature/scr_planetary_feature.gml @@ -26,7 +26,8 @@ enum P_features { Forge, Gene_Stealer_Cult, Mission, - OrkStronghold + OrkStronghold, + AstartesBattleGround }; @@ -60,13 +61,16 @@ function NewPlanetFeature(feature_type, other_data={}) constructor{ hiding=true; name = global.name_generator.generate_genestealer_cult_name(); break; - case P_features.Necron_Tomb: + case P_features.Necron_Tomb: awake = 0; sealed = 0; - player_hidden = 1 + player_hidden = 1; planet_display = "Dormant Necron Tomb"; break; - + case P_features.AstartesBattleGround: + player_hidden = 1; + explored = 0; + break; case P_features.Secret_Base: base_type = base_types.Lair; inquis_hidden =1; diff --git a/scripts/scr_popup_functions/scr_popup_functions.gml b/scripts/scr_popup_functions/scr_popup_functions.gml index 51e9d9566c..8a2c3c2069 100644 --- a/scripts/scr_popup_functions/scr_popup_functions.gml +++ b/scripts/scr_popup_functions/scr_popup_functions.gml @@ -118,6 +118,9 @@ function add_option(option, if_empty = false,use_default_option = true){ return; } } + if (is_string(option)){ + option = {st1:option} + } if (is_array(option)){ for (var i=0;i Date: Thu, 11 Dec 2025 05:48:08 +0000 Subject: [PATCH 05/31] data mutation issues --- objects/obj_controller/Draw_0.gml | 2 +- objects/obj_timer/Create_0.gml | 2 - objects/obj_turn_end/Alarm_1.gml | 2 - scripts/instance_create/instance_create.gml | 6 +- scripts/is_specialist/is_specialist.gml | 4 +- .../scr_ChapterTraits/scr_ChapterTraits.gml | 4 - scripts/scr_Table/scr_Table.gml | 17 ++- scripts/scr_cheatcode/scr_cheatcode.gml | 20 ++- .../scr_draw_planet_features.gml | 5 +- scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml | 5 - .../scr_fleet_functions.gml | 4 +- scripts/scr_hit/scr_hit.gml | 14 +- .../scr_inquisition_mission.gml | 1 - .../scr_marine_struct/scr_marine_struct.gml | 4 +- .../scr_mission_functions.gml | 114 ++++++++------- scripts/scr_recruit_data/scr_recruit_data.gml | 1 - scripts/scr_shoot/scr_shoot.gml | 1 - .../scr_string_functions.gml | 2 - .../scr_struct_functions.gml | 2 +- .../scr_system_search_helpers.gml | 2 - scripts/scr_trade/scr_trade.gml | 5 +- scripts/scr_trade_dep/scr_trade_dep.gml | 1 - scripts/scr_ui_diplomacy/scr_ui_diplomacy.gml | 1 - .../scr_unit_quick_find_pane.gml | 132 +++++++++++------- 24 files changed, 206 insertions(+), 145 deletions(-) diff --git a/objects/obj_controller/Draw_0.gml b/objects/obj_controller/Draw_0.gml index c162cbd167..a95a526b23 100644 --- a/objects/obj_controller/Draw_0.gml +++ b/objects/obj_controller/Draw_0.gml @@ -35,7 +35,7 @@ try{ //star fleet edbug options spawn if (global.cheat_debug == true && mouse_check_button_pressed(mb_right)){ - if (!instances_exist_any([obj_turn_end,obj_ncombat,obj_fleet,obj_fleet_select,obj_popup,obj_star_select])){ + if (!instances_exist_any([obj_turn_end,obj_ncombat,obj_fleet,obj_fleet_select,obj_popup,obj_star_select]) && !scr_void_click()){ new_system_debug_popup(); } } \ No newline at end of file diff --git a/objects/obj_timer/Create_0.gml b/objects/obj_timer/Create_0.gml index c7bccb95c0..82763a34d9 100644 --- a/objects/obj_timer/Create_0.gml +++ b/objects/obj_timer/Create_0.gml @@ -5,9 +5,7 @@ end_function_args = []; execute_end_function = function() { if (is_method(end_function)) { - // show_debug_message("Executing Method!"); method_call(end_function, end_function_args); } - // show_debug_message("Killing Myself!"); instance_destroy(self); } diff --git a/objects/obj_turn_end/Alarm_1.gml b/objects/obj_turn_end/Alarm_1.gml index e8d9b3a34e..d0e3f25d14 100644 --- a/objects/obj_turn_end/Alarm_1.gml +++ b/objects/obj_turn_end/Alarm_1.gml @@ -13,7 +13,6 @@ if (_is_audience){ } } - show_debug_message(current_audience); if (obj_controller.menu != MENU.Diplomacy){ scr_toggle_diplomacy(); @@ -35,7 +34,6 @@ if (_is_audience){ } if (obj_controller.diplomacy!=6){ - //show_debug_message("new_intro"); scr_dialogue("intro"); } diff --git a/scripts/instance_create/instance_create.gml b/scripts/instance_create/instance_create.gml index 9b63e0a16b..cdeaa079f5 100644 --- a/scripts/instance_create/instance_create.gml +++ b/scripts/instance_create/instance_create.gml @@ -24,7 +24,7 @@ function instances_exist_any(instance_set = []){ return _exists; } -function instance_at_location(xx,yy,obj){ - var _nearest = instance_nearest(xx, yy, obj); - return (_nearest.x == xx && _nearest.y == yy) ? _nearest : -1; +function instance_at_location(xx,yy,obj_type){ + var _nearest = instance_nearest(xx, yy, obj_type); + return (_nearest.x == xx && _nearest.y == yy) ? _nearest : noone; } diff --git a/scripts/is_specialist/is_specialist.gml b/scripts/is_specialist/is_specialist.gml index d6718e8274..26ec8f1be5 100644 --- a/scripts/is_specialist/is_specialist.gml +++ b/scripts/is_specialist/is_specialist.gml @@ -405,6 +405,9 @@ function group_selection(group, selection_data={}) { unit = group[i]; add_man_to_manage_arrays(unit); + if (!struct_exists(selection_data , "purpose_code")){ + selection_data.purpose_code = "manage"; + } if (selection_data.purpose_code == "forge_assignment") { if (unit.job != "none") { if (unit.job.type == "forge" && unit.job.planet == selection_data.planet) { @@ -434,7 +437,6 @@ function group_selection(group, selection_data={}) { managing = -1; } } - show_debug_message($"manage_success {obj_controller.menu}"); } catch (_exception) { //handle and send player back to map handle_exception(_exception); diff --git a/scripts/scr_ChapterTraits/scr_ChapterTraits.gml b/scripts/scr_ChapterTraits/scr_ChapterTraits.gml index 2e6e435f4d..b2bc7b9ca9 100644 --- a/scripts/scr_ChapterTraits/scr_ChapterTraits.gml +++ b/scripts/scr_ChapterTraits/scr_ChapterTraits.gml @@ -41,14 +41,12 @@ function ChapterTrait(_id, _name, _description, _points_cost, _meta = []) constr function Advantage(_id, _name, _description, _points_cost) : ChapterTrait(_id, _name, _description, _points_cost) constructor { static add = function(slot){ - show_debug_message($"Adding adv {name} to slot {slot} for points {points}"); obj_creation.adv[slot] = name; obj_creation.adv_num[slot] = id; obj_creation.points+=points; add_meta(); } static remove = function(slot){ - show_debug_message($"removing adv {name} from slot {slot} for points {points}"); obj_creation.adv[slot] = ""; obj_creation.points-=points; obj_creation.adv_num[slot]=0; @@ -72,7 +70,6 @@ function Advantage(_id, _name, _description, _points_cost) : ChapterTrait(_id, _ function Disadvantage(_id, _name, _description, _points_cost) : ChapterTrait(_id, _name, _description, _points_cost) constructor { static add = function(slot){ - show_debug_message($"Adding disadv {name} to slot {slot} for points {points}"); obj_creation.dis[slot] = name; obj_creation.dis_num[slot] = id; obj_creation.points-=points; @@ -80,7 +77,6 @@ function Disadvantage(_id, _name, _description, _points_cost) : ChapterTrait(_id } static remove = function(slot){ - show_debug_message($"Removing disadv {name} from slot {slot} for points {points}"); obj_creation.dis[slot] = ""; obj_creation.points+=points; obj_creation.dis_num[slot]=0; diff --git a/scripts/scr_Table/scr_Table.gml b/scripts/scr_Table/scr_Table.gml index 9bf8884c25..c30799a6d6 100644 --- a/scripts/scr_Table/scr_Table.gml +++ b/scripts/scr_Table/scr_Table.gml @@ -99,9 +99,20 @@ function Table(data) constructor{ //show_debug_message($"click : {struct_exists(_row,"click_left")}"); _row.hover(); } - if (_row_entered && struct_exists(_row,"click_left")){ - if (scr_click_left()){ - _row.click_left(); + if (_row_entered){ + if (struct_exists(_row,"hover")){ + //show_debug_message($"click : {struct_exists(_row,"click_left")}"); + _row.hover(); + } + if (struct_exists(_row,"click_left")){ + if (scr_click_left()){ + _row.click_left(); + } + } + if (struct_exists(_row,"click_right")){ + if (scr_click_right()){ + _row.click_right(); + } } } } diff --git a/scripts/scr_cheatcode/scr_cheatcode.gml b/scripts/scr_cheatcode/scr_cheatcode.gml index 6875e53827..7a1d6c21a9 100644 --- a/scripts/scr_cheatcode/scr_cheatcode.gml +++ b/scripts/scr_cheatcode/scr_cheatcode.gml @@ -519,7 +519,25 @@ function draw_planet_debug_problems(){ with (target){ scr_new_governor_mission(obj_controller.selecting_planet,"hunt_beast"); } - break; + break; + case "deliver_trophy": + var _unit = fetch_unit(scr_random_marine("",0)); + var _navy_fleets = get_imperial_navy_fleets(); + var _pop_data = { + trophy_owner : _unit, + system: target.name, + planet : obj_controller.selecting_planet, + target_fleet : array_random_element(_navy_fleets) + } + + var _pop = instance_create(0,0,obj_popup); + + _pop.pop_data = _pop_data; + + with (_pop){ + init_deliver_trophy_mission(); + } + break; default: scr_popup("error","no specific debug action created please consider helping to make one",""); break; diff --git a/scripts/scr_draw_planet_features/scr_draw_planet_features.gml b/scripts/scr_draw_planet_features/scr_draw_planet_features.gml index 32ea1b2f2d..b4a2f3ba91 100644 --- a/scripts/scr_draw_planet_features/scr_draw_planet_features.gml +++ b/scripts/scr_draw_planet_features/scr_draw_planet_features.gml @@ -31,9 +31,11 @@ function FeatureSelected(Feature, system, planet) constructor{ } draw_planet_features = function(xx,yy){ + add_draw_return_values(); draw_set_halign(fa_center); + draw_set_valign(fa_top); draw_set_font(fnt_40k_14); - //draw_sprite(spr_planet_screen,0,xx,yy); + //draw_sprite(spr_planset_screen,0,xx,yy); if (exit_sequence){ xx-=(25*exit_count); main_slate.draw(xx,yy, 1.38,1.38); @@ -338,6 +340,7 @@ function FeatureSelected(Feature, system, planet) constructor{ draw_set_color(c_gray); draw_text_ext(xx+10, yy+40,body,-1,area_width-20); } + pop_draw_return_values(); return "done"; } } diff --git a/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml b/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml index 1a05acc620..f3b4a3e6bd 100644 --- a/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml +++ b/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml @@ -10,7 +10,6 @@ function scr_enemy_ai_a() { // guardsmen hop from planet to planet //not sure we really need this as it's handled with tht navy fleet functions but fuck it updated it and leaving it fot the sec if (system_guard_total()>0 && present_fleet[eFACTION.Imperium]){ - show_debug_message($"system_has_guard {p_guardsmen}"); var cur_planet=0,most_enemies_found=0,current_guard_planet=0,most_enemies_planet=0; var _guard_planets = guard_find_planet_with_most_enemy_forces(self); @@ -22,7 +21,6 @@ function scr_enemy_ai_a() { p_guardsmen[_current] = 0; } - show_debug_message($"system_has_guard {p_guardsmen}"); } if (obj_controller.faction_defeated[10]>0) and (obj_controller.faction_gender[10]=2){ @@ -288,7 +286,6 @@ function scr_enemy_ai_a() { var _active_garrison = pdf_with_player && garrison.viable_garrison>0; // Guard attack if (guard_score>0) and (guard_attack!="") and (guard_score>0.5){ - show_debug_message($"{name}:{guard_attack}") if (guard_attack="ork") then tempor=choose(1,2,3,4,5,6)*planet_forces[eFACTION.Ork]; if (guard_attack="tau") then tempor=choose(1,2,3,4,5,6)*planet_forces[eFACTION.Tau]; if (guard_attack="traitors") then tempor=choose(1,2,3,4,5,6)*traitors_score; @@ -311,7 +308,6 @@ function scr_enemy_ai_a() { } rand1=(choose(3,4,5,6)*guard_score)*choose(1,1.25,1.25); rand2=(pdf_mod*pdf_score)*choose(1,1.25); - show_debug_message($"{name} guard attack guard_Win:{rand1>rand2}"); if (rand1>rand2){ var _pdf_before = p_pdf[_run]; if (guard_score<=3) then p_pdf[_run]=floor(p_pdf[_run]*(min(0.95, 0.7+pdf_loss_reduction))); @@ -379,7 +375,6 @@ function scr_enemy_ai_a() { if (pdf_attack=="guard"){ rand2=(choose(1,2,3,4,5,6)*guard_score)*choose(1,1.25,2); - show_debug_message($"{name} : pdf attack ,pdf win {rand1>rand2}"); if (rand1>rand2){ if (pdf_score<=3) then p_guardsmen[_run]=floor(p_guardsmen[_run]*0.7); if (pdf_score>=4) then p_guardsmen[_run]=floor(p_guardsmen[_run]*0.6); diff --git a/scripts/scr_fleet_functions/scr_fleet_functions.gml b/scripts/scr_fleet_functions/scr_fleet_functions.gml index 5940e5e1c8..398de98533 100644 --- a/scripts/scr_fleet_functions/scr_fleet_functions.gml +++ b/scripts/scr_fleet_functions/scr_fleet_functions.gml @@ -19,7 +19,7 @@ function set_fleet_target(targ_x, targ_y, final_target){ action_x = targ_x; action_y = targ_y; target = final_target; - action_eta=floor(point_distance(x,y,targ_x,targ_y)/128)+1; + action_eta = floor(point_distance(x,y,targ_x,targ_y)/128)+1; } function scr_valid_fleet_target(target) { @@ -61,7 +61,7 @@ function fleets_next_location(fleet = "none", visited = []) { array_push(visited, fleet.id); // Check if the fleet has a 'target' variable - if (action != "" && variable_instance_exists(fleet, "target")) { + if (fleet.action != "" && variable_instance_exists(fleet, "target")) { // If the target is valid and not already in the visited list, proceed recursively var fleet_target_valid = scr_valid_fleet_target(fleet.target); if (!fleet_target_valid) { diff --git a/scripts/scr_hit/scr_hit.gml b/scripts/scr_hit/scr_hit.gml index b1c4ea0724..57a708c558 100644 --- a/scripts/scr_hit/scr_hit.gml +++ b/scripts/scr_hit/scr_hit.gml @@ -100,11 +100,21 @@ function point_and_click_sprite(x1, y1, sprite, x_scale = 1, y_scale = 1){ } function scr_click_left(cooldown = 60, lock_bypass = false){ + + return click_controller(cooldown,lock_bypass); +} + +function scr_click_right(cooldown = 60, lock_bypass = false){ + + return click_controller(cooldown,lock_bypass ,mb_right); +} + +function click_controller(cooldown = 60, lock_bypass = false, mouse_button_lr=mb_left){ if (lock_bypass == false && global.ui_click_lock == true) { return false; } - var mouse_clicked = event_number==ev_gui ? device_mouse_check_button_pressed(0,mb_left) : mouse_check_button_pressed(mb_left); + var mouse_clicked = event_number==ev_gui ? device_mouse_check_button_pressed(0,mouse_button_lr) : mouse_check_button_pressed(mouse_button_lr); if (!mouse_clicked) { return false; } @@ -153,7 +163,7 @@ function scr_click_left(cooldown = 60, lock_bypass = false){ show_debug_message($"Mouse Clicked! {array_to_string_list(debug_get_callstack(), true)}"); } - return mouse_clicked; + return mouse_clicked; } function mouse_button_held(_button = mb_left) { diff --git a/scripts/scr_inquisition_mission/scr_inquisition_mission.gml b/scripts/scr_inquisition_mission/scr_inquisition_mission.gml index b333eba560..5c203eff9c 100644 --- a/scripts/scr_inquisition_mission/scr_inquisition_mission.gml +++ b/scripts/scr_inquisition_mission/scr_inquisition_mission.gml @@ -526,7 +526,6 @@ function mission_hunt_inquisitor_show_mercy(){ function mission_hunt_inquisitor_destroy_inquisitor_ship(){ - show_debug_message("mission_hunt_inquisitor_destroy_inquisitor_ship"); var _final_disp_mod = 0; if (obj_controller.demanding == 0) { diff --git a/scripts/scr_marine_struct/scr_marine_struct.gml b/scripts/scr_marine_struct/scr_marine_struct.gml index 134d3b433a..9308991eb6 100644 --- a/scripts/scr_marine_struct/scr_marine_struct.gml +++ b/scripts/scr_marine_struct/scr_marine_struct.gml @@ -788,7 +788,7 @@ function TTRPG_stats(faction, comp, mar, class = "marine", other_spawn_data = {} static add_trait = function(trait,return_stat_diff = false, return_description = false) { if (return_stat_diff){ - var _start_stats = _unit.get_stat_line(); + var _start_stats = get_stat_line(); } if (struct_exists(global.trait_list, trait)) { if (!array_contains(traits, trait)) { @@ -799,7 +799,7 @@ function TTRPG_stats(faction, comp, mar, class = "marine", other_spawn_data = {} array_push(traits, trait); if (return_stat_diff){ - var _end_stats = _unit.get_stat_line(); + var _end_stats = get_stat_line(); var _stat_diff = compare_stats(_end_stats,_start_stats); } diff --git a/scripts/scr_mission_functions/scr_mission_functions.gml b/scripts/scr_mission_functions/scr_mission_functions.gml index e3ee0a15b9..8cab6b95f2 100644 --- a/scripts/scr_mission_functions/scr_mission_functions.gml +++ b/scripts/scr_mission_functions/scr_mission_functions.gml @@ -12,7 +12,7 @@ function location_out_of_player_control(unit_loc){ return (array_contains(_locs,unit_loc )); } -#macro planet_problem_keys ["meeting_trap","meeting","succession","mech_raider","mech_bionics","mech_mars","mech_tomb1","fallen","great_crusade","harlequins","fund_elder","provide_garrison","hunt_beast","protect_raiders","join_communion","join_parade","recover_artifacts","train_forces","spyrer","inquisitor","recon","cleanse","purge","tyranid_org","artifact_loan","necron","ethereal","demon_world"] +#macro planet_problem_keys ["meeting_trap","meeting","succession","mech_raider","mech_bionics","mech_mars","mech_tomb1","fallen","great_crusade","harlequins","fund_elder","provide_garrison","hunt_beast","protect_raiders","join_communion","join_parade","recover_artifacts","train_forces","spyrer","inquisitor","recon","cleanse","purge","tyranid_org","artifact_loan","necron","ethereal","demon_world","deliver_trophy"] function mission_name_key(mission){ var mission_key = { @@ -153,32 +153,6 @@ function init_garrison_mission(planet, star, mission_slot){ } - - -function init_beast_hunt_mission(planet, star, mission_slot){ - var problems_data = star.p_problem_other_data[planet] - var mission_data = problems_data[mission_slot]; - if (mission_data.stage == "preliminary"){ - var numeral_name = planet_numeral_name(planet, star); - mission_data.stage = "active"; - var _mission_length=(irandom_range(2,5)); - star.p_timer[planet][mission_slot] = _mission_length; - //pop.image="ancient_ruins"; - var gar_pop=instance_create(0,0,obj_popup); - //TODO some new universal methods for popups - gar_pop.title=$"Marines assigned to hunt beasts around {numeral_name}"; - gar_pop.text=$"The govornor of {numeral_name} Thanks you for the participation of your elite warriors in your execution of such a menial task.\n It would be best to send at least one amrine that has experience with such tasks"; - //pip.image="event_march" - gar_pop.add_option({ - str1: "Happy Hunting" - }); - gar_pop.image=""; - gar_pop.cooldown=8; - obj_controller.cooldown=20; - scr_event_log("",$"Beast hunters deployed to {numeral_name} for {_mission_length} months.", star.name); - } -} - function role_compare(unit, role){ return unit.role() == obj_ini.role[100][role]; } @@ -475,6 +449,32 @@ function complete_train_forces_mission(targ_planet, problem_index){ } } } + +function init_beast_hunt_mission(planet, star, mission_slot){ + var problems_data = star.p_problem_other_data[planet] + var mission_data = problems_data[mission_slot]; + if (mission_data.stage == "preliminary"){ + var numeral_name = planet_numeral_name(planet, star); + mission_data.stage = "active"; + var _mission_length=(irandom_range(2,5)); + star.p_timer[planet][mission_slot] = _mission_length; + //pop.image="ancient_ruins"; + var gar_pop=instance_create(0,0,obj_popup); + //TODO some new universal methods for popups + gar_pop.title=$"Marines assigned to hunt beasts around {numeral_name}"; + gar_pop.text=$"The govornor of {numeral_name} Thanks you for the participation of your elite warriors in your execution of such a menial task."; + //pip.image="event_march" + gar_pop.add_option({ + str1: "Happy Hunting" + }); + gar_pop.image=""; + gar_pop.cooldown=8; + obj_controller.cooldown=20; + scr_event_log("",$"Beast hunters deployed to {numeral_name} for {_mission_length} months.", star.name); + } +} + + function complete_beast_hunt_mission(targ_planet, problem_index){ var planet = new PlanetData(targ_planet, self); if (problem_has_key_and_value(targ_planet,problem_index,"stage","active")){ @@ -530,7 +530,7 @@ function complete_beast_hunt_mission(targ_planet, problem_index){ var _pop_data = ""; var _navy_fleets = get_imperial_navy_fleets(); - if (array_length(_successful_hunters) && _largest_pass > 15 && array_length(_navy_fleets)){ + if (array_length(_successful_hunters) && _largest_pass > 20 && array_length(_navy_fleets)){ _pop_data = { trophy_owner : array_random_element(_successful_hunters), system: self.name, @@ -542,6 +542,8 @@ function complete_beast_hunt_mission(targ_planet, problem_index){ choice_func : init_deliver_trophy_mission, str1 : "Continue", } + + _pop_data.options = _options; } if (_success){ _mission_string = $"The mission was a success and a great number of beasts rounded up and slain, your marines were able to gain great skills and the prestige of your chapter has increased greatly across the planets populace." @@ -561,49 +563,56 @@ function complete_beast_hunt_mission(targ_planet, problem_index){ } } function init_deliver_trophy_mission(){ - text = $"After your marines return there is a great feast to honour them. Much fanfare is made of the great trophy {_pop_data.trophy_owner.name_role()} bears, a great monstrous head as tall as he is that the governor proclaims must be the largest of it's kind and the momst fearsome beast in the sector."; + text = $"After your marines return there is a great feast to honour them. Much fanfare is made of the great trophy {pop_data.trophy_owner.name_role()} bears, a great monstrous head as tall as he is that the governor proclaims must be the largest of it's kind and the momst fearsome beast in the sector."; - text += $"\n\nAn astropathic message is later recieved from the Commander of an Imperial Navy fleet explaining that his fleet is currrently home to the {irandom_numeral(100)},{irandom_numeral(100)} and {irandom_numeral(100)} {_pop_data.system} Regiments and pleads that the trophy be handed over to his fleet in order to boost the moral of the regiments and fleet in general"; + text += $"\n\nAn astropathic message is later recieved from the Commander of an Imperial Navy fleet explaining that his fleet is currrently home to the {irandom_numeral(100)},{irandom_numeral(100)} and {irandom_numeral(100)} {pop_data.system} Regiments and pleads that the trophy be handed over to his fleet in order to boost the moral of the regiments and fleet in general"; replace_options([ { str1 : "Refuse and place the trophy into the Librarium", choice_func : function(){ - + scr_add_artifact(); } }, { str1 : "Accept", - choice_func : function(){ - text = $"You Send a reply to tell the commander you accept and will ensure the trophy is delivered in person by the marine that slew the beast"; - var _targ_fleet = pop_data.target_fleet; - - var _targ_fleet_intercept = fleets_next_location(_targ_fleet); - if (_targ_fleet.action==""){ - text += $"\n\n the fleet in question is currently active around the {_targ_fleet_intercept.name} system"; - } else { - text += $"\n\n the fleet will next be accessible around the {_targ_fleet_intercept.name} system"; - } + choice_func : accept_deliver_trophy_mission + } + ]); + +} - pop_data.target_fleet = target_fleet.uid; - var _fleet_event = new FleetEvent(pop_data); - _fleet_event.turn_end = "deliver_trophy_end_turn_check"; - _fleet_event.destroy = "deliver_trophy_mission_fleet_destroyed"; - _fleet_event.timer_end = "deliver_trophy_mission_timed_out"; +function accept_deliver_trophy_mission(){ + text = $"You Send a reply to tell the commander you accept and will ensure the trophy is delivered in person by the marine that slew the beast"; + var _targ_fleet = pop_data.target_fleet; - _fleet_event.timer = 120; + var _targ_fleet_intercept = fleets_next_location(_targ_fleet); + if (_targ_fleet.action==""){ + text += $"\n\n the fleet in question is currently active around the {_targ_fleet_intercept.name} system"; + } else { + text += $"\n\n the fleet will next be accessible around the {_targ_fleet_intercept.name} system"; + } - _targ_fleet.add_event(_fleet_event); + pop_data.target_fleet = _targ_fleet.uid; + pop_data.delivering_marine = pop_data.trophy_owner.name_role(); + var _t_owner = pop_data.trophy_owner; + pop_data.trophy_owner = _t_owner.uid; - reset_popup_options(); - } - } - ]); + var _fleet_event = new FleetEvent(pop_data); + + _fleet_event.turn_end = "deliver_trophy_end_turn_check"; + _fleet_event.destroy = "deliver_trophy_mission_fleet_destroyed"; + _fleet_event.timer_end = "deliver_trophy_mission_timed_out"; + + _fleet_event.timer = 120; + + _targ_fleet.add_event(_fleet_event); + reset_popup_options(); } @@ -625,6 +634,7 @@ function deliver_trophy_mission_fleet_destroyed(){ ///@mixin FleetEvent function deliver_trophy_end_turn_check(){ + show_debug_message($"evetn_Data = {event_data}"); var _navy_fleet = get_fleet_uid(fleet_uid); if (!instance_exists(_navy_fleet)){ deliver_trophy_mission_fleet_destroyed(); diff --git a/scripts/scr_recruit_data/scr_recruit_data.gml b/scripts/scr_recruit_data/scr_recruit_data.gml index e926978a58..c817a9dc30 100644 --- a/scripts/scr_recruit_data/scr_recruit_data.gml +++ b/scripts/scr_recruit_data/scr_recruit_data.gml @@ -192,7 +192,6 @@ function planet_training_sequence(local_apothecary_points) { var recruit_chance = 999; var aspirant = 0; var new_recruit_corruption = find_recruit_corruption(planet_type); - show_debug_message($"new_recruit_corruption: {new_recruit_corruption}"); var months_to_neo = 72; var dista = 0; var onceh = 0; diff --git a/scripts/scr_shoot/scr_shoot.gml b/scripts/scr_shoot/scr_shoot.gml index f77b7b4ab0..492cdc13a7 100644 --- a/scripts/scr_shoot/scr_shoot.gml +++ b/scripts/scr_shoot/scr_shoot.gml @@ -198,7 +198,6 @@ function scr_shoot(weapon_index_position, target_object, target_type, damage_dat } if (instance_exists(target_object) && (owner == eFACTION.Player)) { - // show_debug_message("{0}, {1}, {2}, {3}, {4}", wep_num[weapon_index_position], wep[weapon_index_position], splash[weapon_index_position], range[weapon_index_position], att[weapon_index_position]) var shots_fired = 0; var stop = 0; var damage_type = ""; diff --git a/scripts/scr_string_functions/scr_string_functions.gml b/scripts/scr_string_functions/scr_string_functions.gml index be4a53485c..4cb0f3584f 100644 --- a/scripts/scr_string_functions/scr_string_functions.gml +++ b/scripts/scr_string_functions/scr_string_functions.gml @@ -363,11 +363,9 @@ function string_starts_with_any(_str, _prefixes) { function string_interpolate_from_struct(interpolate_string,data){ var _names=struct_get_names(data); var _name_length = array_length(_names); - show_debug_message(_names); for (var i=0;i<_name_length;i++){ var _name=_names[i]; var _replace_string = "{" + $"{_name}" + "}"; - show_debug_message(_replace_string); interpolate_string = string_replace_all(interpolate_string, _replace_string, data[$_name]); } diff --git a/scripts/scr_struct_functions/scr_struct_functions.gml b/scripts/scr_struct_functions/scr_struct_functions.gml index fc5856cb58..9e44f3694c 100644 --- a/scripts/scr_struct_functions/scr_struct_functions.gml +++ b/scripts/scr_struct_functions/scr_struct_functions.gml @@ -10,7 +10,7 @@ function DeepCloneStruct(clone_struct) { function move_data_to_current_scope(move_struct, overide=true){ if (!is_struct(move_struct)){ - show_debug_message(move_struct); + //show_debug_message(move_struct); } else { try{ var _data_names = struct_get_names(move_struct); diff --git a/scripts/scr_system_search_helpers/scr_system_search_helpers.gml b/scripts/scr_system_search_helpers/scr_system_search_helpers.gml index b1a6f8a4e0..de0ed76ec0 100644 --- a/scripts/scr_system_search_helpers/scr_system_search_helpers.gml +++ b/scripts/scr_system_search_helpers/scr_system_search_helpers.gml @@ -377,11 +377,9 @@ function find_population_doners(doner_to=0){ function planet_numeral_name(planet, star="none"){ if (star=="none"){ - //show_debug_message($"{planet}, numeral name") return $"{name} {int_to_roman(planet)}"; } else { with (star){ - //show_debug_message($"{planet}, numeral name") return $"{name} {int_to_roman(planet)}"; } } diff --git a/scripts/scr_trade/scr_trade.gml b/scripts/scr_trade/scr_trade.gml index 09975ba533..3406e0561f 100644 --- a/scripts/scr_trade/scr_trade.gml +++ b/scripts/scr_trade/scr_trade.gml @@ -268,7 +268,6 @@ function TradeAttempt(diplomacy) constructor{ var _success = attempt_rand <= deal_chance; if (_success){ _success = find_trade_locations(); - show_debug_message("trade_success"); if (_success){ successful_trade_attempt(); scr_dialogue("agree",{prepend:"[[Trade Accepted. Shipment initialized.]]"}); @@ -278,7 +277,7 @@ function TradeAttempt(diplomacy) constructor{ scr_loyalty("Xeno Trade","+"); } } else { - show_debug_message("no trade locations"); + //show_debug_message("no trade locations"); } } else { var _dip = diplomacy_faction; @@ -312,7 +311,6 @@ function TradeAttempt(diplomacy) constructor{ exit; } } - show_debug_message("trade_fail"); clear_options(); } @@ -679,7 +677,6 @@ function TradeAttempt(diplomacy) constructor{ } deal_chance=(100-penalty)-(((their_worth-(my_worth*dif_penalty)))); - //show_debug_message($"{their_worth},{my_worth},{deal_chance}"); var _chance = clamp(floor((deal_chance/20)), 0, 6); trade_likely = chance_chart[_chance]; diff --git a/scripts/scr_trade_dep/scr_trade_dep.gml b/scripts/scr_trade_dep/scr_trade_dep.gml index b8b4e28bbb..5aeb0c9526 100644 --- a/scripts/scr_trade_dep/scr_trade_dep.gml +++ b/scripts/scr_trade_dep/scr_trade_dep.gml @@ -2,7 +2,6 @@ function scr_trade_dep() { var _goods = cargo_data.player_goods; - //show_debug_message($"trade goods : {_goods}"); if (struct_exists(_goods, "mercenaries")){ var _mercs = struct_get_names(_goods.mercenaries); for (var m=0;m Date: Thu, 11 Dec 2025 06:03:14 +0000 Subject: [PATCH 06/31] event_data is a reserved name --- scripts/scr_fleet_events/scr_fleet_events.gml | 4 ++-- .../scr_mission_functions.gml | 18 +++++++++--------- .../scr_unit_quick_find_pane.gml | 8 ++++---- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/scripts/scr_fleet_events/scr_fleet_events.gml b/scripts/scr_fleet_events/scr_fleet_events.gml index 0bb74461ea..6152d5e692 100644 --- a/scripts/scr_fleet_events/scr_fleet_events.gml +++ b/scripts/scr_fleet_events/scr_fleet_events.gml @@ -5,9 +5,9 @@ function add_event_to_fleet(event , fleet){ -function FleetEvent(event_data) constructor{ +function FleetEvent(_event_data) constructor{ - self.event_data = event_data; + self.fleetevent_data = _event_data; static load_json_data = function(data){ var names = variable_struct_get_names(data); diff --git a/scripts/scr_mission_functions/scr_mission_functions.gml b/scripts/scr_mission_functions/scr_mission_functions.gml index 8cab6b95f2..2019372c7a 100644 --- a/scripts/scr_mission_functions/scr_mission_functions.gml +++ b/scripts/scr_mission_functions/scr_mission_functions.gml @@ -620,7 +620,7 @@ function accept_deliver_trophy_mission(){ function deliver_trophy_mission_timed_out(){ scr_popup( "Objective Forgotten", - $"It has been so long in the life of a mortal that the commanders that once saught your delivery of the trophy from the hunt on {event_data.system} have now all either died or moved to greener pastures. The trophy will instead remain in the chapters possession", + $"It has been so long in the life of a mortal that the commanders that once saught your delivery of the trophy from the hunt on {fleetevent_data.system} have now all either died or moved to greener pastures. The trophy will instead remain in the chapters possession", ); } @@ -628,13 +628,13 @@ function deliver_trophy_mission_timed_out(){ function deliver_trophy_mission_fleet_destroyed(){ scr_popup( "Fleet Destroyed", - $"With the Imperial Navy fleet containing the regiments from {event_data.system} destroyed there is no reason to now deliver the trophy from the hunt to them The trophy will instead remain in the chapters possession", + $"With the Imperial Navy fleet containing the regiments from {fleetevent_data.system} destroyed there is no reason to now deliver the trophy from the hunt to them The trophy will instead remain in the chapters possession", ); } ///@mixin FleetEvent function deliver_trophy_end_turn_check(){ - show_debug_message($"evetn_Data = {event_data}"); + show_debug_message($"evetn_Data = {fleetevent_data}"); var _navy_fleet = get_fleet_uid(fleet_uid); if (!instance_exists(_navy_fleet)){ deliver_trophy_mission_fleet_destroyed(); @@ -649,7 +649,7 @@ function deliver_trophy_end_turn_check(){ if (_ratio<=0){ scr_popup( "Regiments Destroyed ", - $"The guard Regiments from {event_data.system} serving in the imperial navy fleet have been annihilated wholesale there is no reason to now deliver the trophy from the hunt to them The trophy will instead remain in the chapters possession", + $"The guard Regiments from {fleetevent_data.system} serving in the imperial navy fleet have been annihilated wholesale there is no reason to now deliver the trophy from the hunt to them The trophy will instead remain in the chapters possession", ); return; } @@ -658,19 +658,19 @@ function deliver_trophy_end_turn_check(){ var _nearest_player = instance_at_location(_navy_fleet.x,_navy_fleet.y,obj_p_fleet); if (instance_exists(_nearest_player)){ var _ships = fleet_full_ship_array(_nearest_player); - var _marine = get_unit_uid(event_data.trophy_owner); + var _marine = fetch_unit_uid(fleetevent_data.trophy_owner); var _present = _marine.is_at_location("", 0, _ships); var _meet_point = _navy_fleet.orbiting; if (_present){ var _text = "{_marine.role(name)} is able to rendevous with the imperial navy at {_meet_point.name}." - _text += $" The guard regiments of {event_data.system} are overjoyed at the delivery of the trophy and find the beast that the head came from adorns many of the regiments banners."; + _text += $" The guard regiments of {fleetevent_data.system} are overjoyed at the delivery of the trophy and find the beast that the head came from adorns many of the regiments banners."; _text += $" While The task is for the most part thankless your chapters esteem has risen greatly with the exploits of {_marine.role(name)} spreading far and wide amoung guard regiments."; var _roll = roll_dice_chapter(1, 100, "high"); if (_roll>30 && _roll<70){ //TODO would be cool to have this changed to be a guard specific piece of equipment - _text += "In return for your labour and in honour of your chapter the commander of the guard division has a brand new Land Raider destined for the army diverted to your chapter"; - scr_add_vehicle("Land Raider"); - } else if (_roll>=70){ + _text += "In return for your labour and in honour of your chapter the commander of the guard division has a brand new Rhino destined for the army diverted to your chapter"; + scr_add_vehicle("Rhino"); + } else if (_roll>=70 ){ var _wanted_types = ["Ice","Desert","Agri","Lava","Death"]; var _star = scr_get_stars(true,[],_wanted_types)[0]; _text += "During the concourse that follows with the fleet command your marines learn of a old battle ground discovered on {_star.name}."; diff --git a/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml b/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml index 22a810dc9c..fb21493ebe 100644 --- a/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml +++ b/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml @@ -183,17 +183,17 @@ function UnitQuickFindPanel() constructor{ system : _sys.name, system_id : _sys.id, target : id, - important_person : _event.event_data.trophy_owner, - person_name : _event.event_data.delivering_marine, + important_person : _event.fleetevent_data.trophy_owner, + person_name : _event.fleetevent_data.delivering_marine, planet : 0, - start_system : _event.event_data.system, + start_system : _event.fleetevent_data.system, time : _event.timer, }; _mission_data.click_left = method(_mission_data,function(){ set_map_pan_to_loc(system_id); }); - + _mission_data.hover = method(_mission_data,function(){ tooltip_draw($"You are to have {person_name} deliver trophy hunted on {start_system} to the {start_system} regiments\n\nLeft click to see target fleet intercept system right click to view the trophy bearing marine {person_name}"); }); From 23f929636ff73763986b2dd156d96281b5d42836 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Thu, 11 Dec 2025 22:08:03 +0000 Subject: [PATCH 07/31] another mass move to PlanetData and optomise --- objects/obj_star/Create_0.gml | 5 + scripts/scr_PlanetData/scr_PlanetData.gml | 727 ++++++++++++++---- scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml | 17 +- scripts/scr_enemy_ai_b/scr_enemy_ai_b.gml | 375 +-------- .../scr_mechanicus_missions.gml | 2 +- .../scr_mission_functions.gml | 12 +- .../scr_ork_fleet_functions.gml | 2 +- .../scr_planetary_feature.gml | 10 +- 8 files changed, 613 insertions(+), 537 deletions(-) diff --git a/objects/obj_star/Create_0.gml b/objects/obj_star/Create_0.gml index ac94fffd2e..936b1e2bfa 100644 --- a/objects/obj_star/Create_0.gml +++ b/objects/obj_star/Create_0.gml @@ -71,6 +71,11 @@ p_problem_other_data = array_create_advanced(_planet_array_size, array_create_ad p_timer = array_create_advanced(_planet_array_size, array_create(8, -1)); +system_datas = array_create(8, 0); +system_garrison = array_create(8, 0); + +system_sabatours = array_create(8, 0) + add_feature = function(planet, feature){ array_push(p_feature[planet], feature); } diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 96dc83e039..7fe9b27489 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -4,37 +4,112 @@ #macro ARR_strength_descriptions ["none", "Minimal", "Sparse", "Moderate", "Numerous", "Very Numerous", "Overwhelming"]; function PlanetData(planet, system) constructor{ -//safeguards // TODO LOW DEBUG_LOGGING // Log when tripped somewhere - //disposition - if (system.dispo[planet] < -100 && system.dispo[planet] > -1000 && system.p_owner[planet] != eFACTION.Player ) { // Personal Rule code be doing some interesting things - system.dispo[planet] = -100; // TODO LOW DISPOSITION_REVAMP // Consider revamping the disposition system - } else if (system.dispo[planet] > 100) { - system.dispo[planet] = 100; - } // static large_pop_conversion = 1000000000; - self.planet = planet; self.system = system; - x = system.x; - y = system.y; - player_disposition = system.dispo[planet]; - planet_type = system.p_type[planet]; - operatives = system.p_operatives[planet]; + + + static refresh_data = function(){ + features = system.p_feature[planet]; + current_owner = system.p_owner[planet]; + origional_owner = system.p_first[planet]; + population = system.p_population[planet]; + max_population = system.p_max_population[planet]; + large_population = system.p_large[planet]; + secondary_population = system.p_pop[planet]; + is_craftworld = system.craftworld; + is_hulk = system.space_hulk; + x = system.x; + y = system.y; + player_disposition = system.dispo[planet]; + planet_type = system.p_type[planet]; + operatives = system.p_operatives[planet]; + pdf = system.p_pdf[planet]; + fortification_level = system.p_fortified[planet]; + star_station = system.p_station[planet]; + pdf_loss_reduction = 0; + + // Whether or not player forces are on the planet + player_forces = system.p_player[planet]; + + defence_lasers = system.p_lasers[planet]; + defence_silos = system.p_silo[planet]; + ground_defences = system.p_defenses[planet]; + upgrades = system.p_upgrades[planet]; + // v how much of a problem they are from 1-5 + planet_forces = array_create(14, 0); + guardsmen = system.p_guardsmen[planet]; + pdf = system.p_pdf[planet]; + + try{ + planet_forces[eFACTION.Player] = player_forces; + + planet_forces[eFACTION.Imperium] = guardsmen; + + planet_forces[eFACTION.Ecclesiarchy] = system.p_sisters[planet]; + planet_forces[eFACTION.Eldar] = system.p_eldar[planet]; + planet_forces[eFACTION.Ork] = system.p_orks[planet]; + planet_forces[eFACTION.Tau] = system.p_tau[planet]; + planet_forces[eFACTION.Tyranids] = system.p_tyranids[planet]; + planet_forces[eFACTION.Chaos] = system.p_chaos[planet]+ system.p_demons[planet]; + planet_forces[eFACTION.Heretics] = system.p_traitors[planet]; + + planet_forces[eFACTION.Necrons] = system.p_necrons[planet]; + }catch(_exception){ + handle_exception(_exception); + } + + fortification_level = system.p_fortified[planet]; + + is_heretic = system.p_hurssy[planet]; + + heretic_timer = system.p_hurssy_time[planet]; + + secret_corruption = system.p_heresy_secret[planet]; + + corruption = system.p_heresy[planet]; + + population_influences = system.p_influence[planet]; + + raided_this_turn = system.p_raided[planet]; + // + governor = system.p_governor[planet]; + + problems = system.p_problem[planet]; + problems_data = system.p_problem_other_data[planet]; + problem_timers = system.p_timer[planet]; + + deamons = system.p_demons[planet]; + chaos_forces = system.p_chaos[planet]; + + requests_help = system.p_halp[planet]; + + //safeguards // TODO LOW DEBUG_LOGGING // Log when tripped somewhere + //disposition + if (system.dispo[planet] < -100 && system.dispo[planet] > -1000 && system.p_owner[planet] != eFACTION.Player ) { // Personal Rule code be doing some interesting things + system.dispo[planet] = -100; // TODO LOW DISPOSITION_REVAMP // Consider revamping the disposition system + } else if (system.dispo[planet] > 100) { + system.dispo[planet] = 100; + } + + garrisons = system.system_garrison[planet]; + sabatours = system.system_sabatours[planet]; + system.system_datas[planet] = self; + } + + refresh_data(); + + static edit_player_forces = function(val){ + system.p_player[planet]+=val; + player_forces = system.p_player[planet]; + } function add_operatives(new_ops){ array_push(system.p_operatives[planet], new_ops); operatives = system.p_operatives[planet]; } - features = system.p_feature[planet]; - current_owner = system.p_owner[planet]; - origional_owner = system.p_first[planet]; - population = system.p_population[planet]; - max_population = system.p_max_population[planet]; - large_population = system.p_large[planet]; - secondary_population = system.p_pop[planet]; - is_craftworld = system.craftworld; - is_hulk = system.space_hulk; + static set_player_disposition = function(new_dispo){ player_disposition = new_dispo; @@ -69,6 +144,21 @@ function PlanetData(planet, system) constructor{ return pop_value; } + static end_turn_population_growth = function(){ + if ((population < max_population) && (planet_type != "Dead") && (planet_type != "Craftworld") && (current_owner <= 5) && (planet_forces[eFACTION.Heretics] == 0) && (planet_forces[eFACTION.Tau] == 0) && (planet_forces[eFACTION.Ork] == 0) && (planet_forces[eFACTION.Necrons] == 0) && (planet_forces[eFACTION.Tyranids] == 0)) { + if (!large_population) { + set_population(round(population * 1.0008)); + } else if (large_population == 1) { + edit_population(choose(0, 0.01)); + } + } + } + + static alter_influence = function(faction,value){ + adjust_influence(eFACTION.Tyranids, -1, planet,system); + population_influences = p_influence[planet]; + } + static send_colony_ship = function(target, targ_planet, type){ new_colony_fleet(system, planet, target, targ_planet, type); } @@ -120,15 +210,16 @@ function PlanetData(planet, system) constructor{ return _at_war; } - guardsmen = system.p_guardsmen[planet]; - static edit_guardsmen = function(edit_val){ system.p_guardsmen[planet] = max(0, system.p_guardsmen[planet] + edit_val); guardsmen = system.p_guardsmen[planet]; } - pdf = system.p_pdf[planet]; - fortification_level = system.p_fortified[planet]; + static edit_pdf = function(edit_val){ + system.p_pdf[planet] = max(0, system.p_pdf[planet] + edit_val); + pdf = system.p_pdf[planet]; + } + static alter_fortification = function(alteration){ system.p_fortified[planet] += alteration; fortification_level = system.p_fortified[planet]; @@ -144,40 +235,6 @@ function PlanetData(planet, system) constructor{ system.p_pdf[planet] = pdf; return new_pdf; } - star_station = system.p_station[planet]; - pdf_loss_reduction = 0; - - // Whether or not player forces are on the planet - player_forces = system.p_player[planet]; - - static edit_player_forces = function(val){ - system.p_player[planet]+=val; - player_forces = system.p_player[planet]; - } - defence_lasers = system.p_lasers[planet]; - defence_silos = system.p_silo[planet]; - ground_defences = system.p_defenses[planet]; - upgrades = system.p_upgrades[planet]; - // v how much of a problem they are from 1-5 - planet_forces = array_create(14, 0); - - try{ - planet_forces[1] = player_forces; - - planet_forces[2] = guardsmen; - - planet_forces[5] = system.p_sisters[planet]; - planet_forces[6] = system.p_eldar[planet]; - planet_forces[7] = system.p_orks[planet]; - planet_forces[8] = system.p_tau[planet]; - planet_forces[9] = system.p_tyranids[planet]; - planet_forces[10] = system.p_traitors[planet]; - planet_forces[11] = system.p_chaos[planet]+ system.p_demons[planet]; - - planet_forces[13] = system.p_necrons[planet]; - }catch(_exception){ - handle_exception(_exception); - } static add_forces = function(faction, val){ var _new_val = planet_forces[faction]+val; @@ -257,9 +314,9 @@ function PlanetData(planet, system) constructor{ return _text; } static grow_ork_forces = function(){ - var contin=0; - var rando=roll_dice(1,100);// This part handles the spreading - // if (rando<30){ + var contin = 0; + var _rando = roll_dice(1,100);// This part handles the spreading + // if (_rando<30){ var _non_deads = planets_without_type("dead", system); var _has_warboss = has_feature(P_features.OrkWarboss); @@ -273,7 +330,35 @@ function PlanetData(planet, system) constructor{ var _warboss = get_features(P_features.OrkWarboss)[0]; _warboss.turns_static++; } - if (array_length(_non_deads)>0 && rando>40){ + var _roll_num = 100; + if (_has_stronghold){ + _roll_num -= (_has_stronghold + 1) * 3; + } + var _ork_growth = roll_dice_chapter(1, 100, "high"); + success = false; // This part handles the increasing in numbers + + var _ork_growth_threshold = 13; + + if (_has_warboss){ + _ork_growth_threshold *= 2; + } + + var _orks = planet_forces[eFACTION.Ork]; + if ((current_owner == eFACTION.Ork) && (_orks < 5) && (planet_forces[eFACTION.Heretics] == 0) && (p_player[i] <= 0 || !is_garrison_force)) { + if ((_orks> 0) && (_ork_growth <= _ork_growth_threshold)) { + if (sabotage_force) { + if (irandom(3) < 2) { + scr_event_log("green", $"sabotage force on {name()} disrupts ork forces", name); + } else { + add_forces(eFACTION.Ork,1); + } + } else { + add_forces(eFACTION.Ork,1); + } + } + } + + if (array_length(_non_deads)>0 && _rando>40){ var _ork_spread_planet = array_random_element(_non_deads); var _orks = planet_forces[eFACTION.Ork] var _ork_target = system.p_orks[_ork_spread_planet]; @@ -294,7 +379,7 @@ function PlanetData(planet, system) constructor{ } } contin=0; - rando=roll_dice(1,100);// This part handles the ship building + _rando=roll_dice(1,100);// This part handles the ship building if (population>0 && pdf==0 && guardsmen==0 && planet_forces[10]==0) and (planet_forces[eFACTION.Tau]==0){ if (!large_population){ set_population(population*0.97); @@ -316,8 +401,8 @@ function PlanetData(planet, system) constructor{ } if (_has_warboss && !_has_stronghold){ - rando=roll_dice_chapter(1,100, "low"); - if (rando<30){ + _rando=roll_dice_chapter(1,100, "low"); + if (_rando<30){ add_feature(P_features.OrkStronghold); } } else { @@ -333,14 +418,14 @@ function PlanetData(planet, system) constructor{ } if (!enemies_present){ - rando=roll_dice_chapter(1,150, "low"); + _rando=roll_dice_chapter(1,150, "low"); if (_has_warboss){ - rando -= 20; + _rando -= 20; } if (_has_stronghold){ - rando -= _stronghold.tier*5; + _rando -= _stronghold.tier*5; } - if (obj_controller.known[eFACTION.Ork]>0) then rando-=10;// Empire bonus, was 15 before + if (obj_controller.known[eFACTION.Ork]>0) then _rando-=10;// Empire bonus, was 15 before // Check for industrial facilities var fleet_buildable = ((planet_type!="Dead" && planet_type!="Lava") || _has_warboss || _has_stronghold); @@ -353,15 +438,15 @@ function PlanetData(planet, system) constructor{ }; } if (planet_type == "Forge"){ - rando-=80; + _rando-=80; } else if (planet_type == "Hive" || planet_type == "Temperate"){ - rando-=30; + _rando-=30; }else if (planet_type == "Agri"){ - rando-=10; + _rando-=10; } var _ork_fleet = scr_orbiting_fleet(eFACTION.Ork, system); if (_ork_fleet=="none"){ - if (rando<=20){ + if (_rando<=20){ new_ork_fleet(x,y); } } else { @@ -375,18 +460,18 @@ function PlanetData(planet, system) constructor{ var _pdata = self; with (_ork_fleet){ // Increase ship number for this object? - var rando=irandom(101); - if (obj_controller.known[eFACTION.Ork]>0) then rando-=10; + var _rando=irandom(101); + if (obj_controller.known[eFACTION.Ork]>0) then _rando-=10; var _planet_type = _pdata.planet_type; if (_planet_type=="Forge"){ - rando-=20; + _rando-=20; } else if (_planet_type=="Hive"){ - rando-=10; + _rando-=10; }else if (_planet_type=="Shrine" || _planet_type=="Temperate"){ - rando-=5; + _rando-=5; } - if (rando<=15){// was 25 - rando=choose(1,1,1,1,1,1,1,2,2,2); + if (_rando<=15){// was 25 + _rando=choose(1,1,1,1,1,1,1,2,2,2); var _big_stronghold = false if (_has_stronghold){ if (_stronghold.tier>=2){ @@ -395,17 +480,17 @@ function PlanetData(planet, system) constructor{ } if (_planet_type=="Forge" || _big_stronghold || _has_warboss){ if (!irandom(10)){ - rando = 3; + _rando = 3; } }else if (_has_stronghold || _planet_type=="Hive"){ if (!irandom(30)){ - rando = 3; + _rando = 3; } } if (capital_number<=0){ - rando = 3; + _rando = 3; } - switch(rando){ + switch(_rando){ case 3: capital_number+=1; break; @@ -449,9 +534,9 @@ function PlanetData(planet, system) constructor{ } } if (_has_warboss){ - rando=roll_dice(1,100)+10; + _rando=roll_dice(1,100)+10; var _ork_fleet = scr_orbiting_fleet(eFACTION.Ork, system); - if (_ork_fleet!="none" && rando < _warboss.turns_static){ + if (_ork_fleet!="none" && _rando < _warboss.turns_static){ _warboss.turns_static = 0; _ork_fleet.cargo_data.ork_warboss = _warboss; delete_feature(P_features.OrkWarboss); @@ -463,11 +548,6 @@ function PlanetData(planet, system) constructor{ } - deamons = system.p_demons[planet]; - chaos_forces = system.p_chaos[planet]; - - requests_help = system.p_halp[planet]; - // current planet heresy if (population == 0) { system.p_heresy[planet] = 0; @@ -477,29 +557,15 @@ function PlanetData(planet, system) constructor{ } } - - corruption = system.p_heresy[planet]; - static alter_corruption = function(value){ alter_planet_corruption(value, planet, system); corruption = system.p_heresy[planet]; } - - is_heretic = system.p_hurssy[planet]; - heretic_timer = system.p_hurssy_time[planet]; - - secret_corruption = system.p_heresy_secret[planet]; - - population_influences = system.p_influence[planet]; - - raided_this_turn = system.p_raided[planet]; - // - governor = system.p_governor[planet]; - - problems = system.p_problem[planet]; - problems_data = system.p_problem_other_data[planet]; - problem_timers = system.p_timer[planet]; + static set_corruption = function(value){ + system.p_heresy[planet] = value; + corruption = system.p_heresy[planet]; + } static has_problem = function(problem){ has_problem_planet(planet, problem, system); @@ -540,6 +606,7 @@ function PlanetData(planet, system) constructor{ static add_feature = function(feature_type){ var new_feature = new NewPlanetFeature(feature_type); array_push(system.p_feature[planet], new_feature); + features = system.p_feature[planet]; return new_feature; } @@ -558,6 +625,7 @@ function PlanetData(planet, system) constructor{ static delete_feature = function(feature){ delete_features(system.p_feature[planet], feature); + features = system.p_feature[planet]; } static bombard = scr_bomb_world; @@ -803,13 +871,13 @@ function PlanetData(planet, system) constructor{ static pdf_loss_reduction_calc = function(){ pdf_loss_reduction = fortification_level*0.001; if (pdf_will_support_player()){ - pdf_loss_reduction+=garrison.viable_garrison*0.0005; + pdf_loss_reduction+=garrisons.viable_garrison*0.0005; } return pdf_loss_reduction; } static pdf_defence_loss_to_orks = function(){ - var active_garrison = pdf_will_support_player() && garrison.viable_garrison>0; + var active_garrison = pdf_will_support_player() && garrisons.viable_garrison>0; if (planet_forces[eFACTION.Ork]>=4) and (pdf>=30000){ pdf=floor(pdf*(min(0.95, 0.55+pdf_loss_reduction))); } @@ -837,7 +905,7 @@ function PlanetData(planet, system) constructor{ var xx=15; var yy=25; var current_planet=planet; - var nm=scr_roman(current_planet), temp1=0; + var temp1=0; draw_set_halign(fa_center); draw_set_valign(fa_top); draw_set_font(fnt_40k_14); @@ -910,11 +978,16 @@ function PlanetData(planet, system) constructor{ yy+=20; draw_set_font(fnt_40k_14b); draw_set_halign(fa_left); - if (!is_craftworld && !is_hulk) then draw_text(xx+480,yy+196,$"{system.name} {nm} ({planet_type})"); - if (is_craftworld) then draw_text(xx+480,yy+196,string(system.name)+" (Craftworld)"); + if (!is_craftworld && !is_hulk){ + draw_text(xx+480,yy+196,$"{name()} ({planet_type})"); + } + else if (is_craftworld){ + draw_text(xx+480,yy+196,string(system.name)+" (Craftworld)"); + } else if (is_hulk){ + draw_text(xx+480,yy+196,"Space Hulk"); + } // if (is_craftworld=0) and (is_hulk=0) then draw_text(xx+534,yy+214,string(planet_type)+" World"); // if (is_craftworld=1) then draw_text(xx+594,yy+214,"Craftworld"); - if (is_hulk) then draw_text(xx+480,yy+196,"Space Hulk"); // draw_sprite(spr_planet_splash,temp1,xx+349,yy+194); scr_image("ui/planet",scr_planet_image_numbers(planet_type),xx+349,yy+194,128,128); @@ -944,17 +1017,17 @@ function PlanetData(planet, system) constructor{ if (is_craftworld=0) and (is_hulk=0){ - var y7=240,temp3=string(scr_display_number(guardsmen)); + var y7=240,_guard_force=string(scr_display_number(guardsmen)); if (guardsmen>0){ - draw_text(xx+480,yy+y7,$"Imperial Guard: {temp3}"); + draw_text(xx+480,yy+y7,$"Imperial Guard: {_guard_force}"); y7+=20; } - var temp4=string(scr_display_number(pdf)); + var _pdf_force =string(scr_display_number(pdf)); if (current_owner!=8){ - draw_text(xx+480,yy+y7,$"Defense Force: {temp4}"); + draw_text(xx+480,yy+y7,$"Defense Force: {_pdf_force}"); } if (current_owner=8){ - draw_text(xx+480,yy+y7,$"Gue'Vesa Force: {temp4}"); + draw_text(xx+480,yy+y7,$"Gue'Vesa Force: {_pdf_force}"); } } @@ -980,7 +1053,7 @@ function PlanetData(planet, system) constructor{ draw_set_color(0); draw_set_alpha(0.2); draw_rectangle(xx+481,yy+280,xx+716,yy+298,0); - if (scr_click_left()) and (obj_controller.requisition>=improve_cost){ + if (scr_click_left() && obj_controller.requisition >= improve_cost){ obj_controller.requisition-=improve_cost; alter_fortification(1); @@ -1191,10 +1264,7 @@ function PlanetData(planet, system) constructor{ } else if (current_owner=8) and (pdf>0){ - system.p_pdf[planet]-= strength*(irandom_range(49, 51) * 100000); - if (pdf<0){ - system.p_pdf[planet]=0; - } + edit_pdf(-strength*(irandom_range(49, 51) * 100000)); kill = large_population ? strength*0.15 : strength*15000000 } @@ -1214,10 +1284,10 @@ function PlanetData(planet, system) constructor{ var _pop_percentage_kill = population > 0 ? (kill / population) * 100 : 0; edit_population(kill*-1); - if (system.p_pdf[planet]<0) then system.p_pdf[planet]=0; + if (population_influences[eFACTION.Tyranids] > 3){ var _max_influence_reduction = min(_pop_percentage_kill,population_influences[eFACTION.Tyranids]-3); - adjust_influence(eFACTION.Tyranids,-_max_influence_reduction,planet,system); + alter_influence(eFACTION.Tyranids,-_max_influence_reduction); if (has_feature(P_features.Gene_Stealer_Cult)){ if (population_influences[eFACTION.Tyranids]<20){ delete_feature(P_features.Gene_Stealer_Cult); @@ -1225,9 +1295,9 @@ function PlanetData(planet, system) constructor{ } } - if (population+pdf<=0) and (current_owner=1) and (obj_controller.faction_status[eFACTION.Imperium]="War"){ + if (population + pdf<=0) and (current_owner=1) and (obj_controller.faction_status[eFACTION.Imperium]="War"){ if (!has_feature(P_features.Monastery)){ - current_owner=2; + set_new_owner(eFACTION.Imperium); add_disposition(-50); } } @@ -1250,10 +1320,10 @@ function PlanetData(planet, system) constructor{ job:_mission, task_time : 0 }; - add_operatives(operation_data) - system.garrison = true; + add_operatives(operation_data); + system.garrisons = true; - //if there was an outstanding mission to provide the given garrison + //if there was an outstanding mission to provide the given garrisons var garrison_request = find_problem("provide_garrison"); if (garrison_request>-1){ init_garrison_mission(planet, system, garrison_request); @@ -1269,19 +1339,19 @@ function PlanetData(planet, system) constructor{ var _loading = obj_star_select.loading; var garrison_assignment = obj_controller.view_squad && _loading; - if (garrison_assignment && (garrison_issue && _mission=="garrison")){ + if (garrison_assignment && (garrison_issue && _mission=="garrisons")){ planet_draw = c_red; - tooltip_draw("Can't garrison on non-friendly planet or planet with no friendly PDF", 150); + tooltip_draw("Can't garrisons on non-friendly planet or planet with no friendly PDF", 150); } if (mouse_check_button_pressed(mb_left)){ if (garrison_assignment){ - if (!(garrison_issue && _mission=="garrison")){ + if (!(garrison_issue && _mission=="garrisons")){ create_planet_garrison(); exit; } } else if (!_loading){ - garrison = new GarrisonForce(operatives); - system.garrison = garrison.garrison_force; + garrisons = new GarrisonForce(operatives); + system.garrisons = garrisons.garrison_force; feature=""; buttons_selected=false; } else if (_loading && planet >0){ @@ -1310,14 +1380,9 @@ function PlanetData(planet, system) constructor{ } if (!instance_exists(obj_ground_mission)){ check_for_artifact_grab_mission(); - } - if (!instance_exists(obj_ground_mission)){ check_for_stc_grab_mission(); - } - // Ancient Ruins - if (!instance_exists(obj_ground_mission)){ scr_check_for_ruins_exploration(); - } + } instance_destroy(obj_star_select); exit; } @@ -1325,6 +1390,378 @@ function PlanetData(planet, system) constructor{ } } + static end_of_turn_population_influence_and_enemy_growth = function(){ + + sabotage_force = sabatours.garrison_force; + total_garrison = garrisons.total_garrison; + is_garrison_force = garrisons.garrison_force; + + // Orks grow in number + + end_turn_population_growth(); + + // increasing necrons + if (array_length(features) != 0) { + var has_awake_tomb = false, + nfleet = 0; + if (awake_tomb_world(features) == 1) { + has_awake_tomb = true; + } + if (has_awake_tomb) { + if (planet_forces[eFACTION.Necrons] < 3) { + planet_forces[eFACTION.Necrons] += 2; + } else if (planet_forces[eFACTION.Necrons] < 6) { + planet_forces[eFACTION.Necrons] += 1; + } + } + if (sabotage_force && irandom(2) < 2) { + planet_forces[eFACTION.Necrons]--; + scr_event_log("green", $"sabotage force on {name()} disrupts necron forces", name); + } + + if (has_awake_tomb) { + // Necron fleets, woooo + //necrons kill populatin + if ((population > 0) && (p_player[i] + pdf + guardsmen + planet_forces[eFACTION.Tyranids] == 0)) { + population = population * 0.75; + if ((large_population == 0) && (population <= 5000)) { + population = 0; + } + } + + var fleet_spawn_chance = roll_dice_chapter(1, 100, "high"); + onceh = 0; + + if (fleet_spawn_chance <= 15) { + if (system.present_fleet[eFACTION.Necrons] > 0) { + //if necron fleet + necron_fleet = instance_nearest(x, y, obj_en_fleet); + + if (necron_fleet.owner == eFACTION.Necrons) { + if (necron_fleet.escort_number < necron_fleet.capital_number * 1.5) { + necron_fleet.escort_number += 2; + } else if (necron_fleet.frigate_number < necron_fleet.capital_number * 3) { + necron_fleet.frigate_number += 1; + } else { + necron_fleet.capital_number += 1; + } + } + } else if (system.present_fleet[eFACTION.Necrons] == 0) { + necron_fleet = instance_create(x, y, obj_en_fleet); + necron_fleet.owner = eFACTION.Necrons; + necron_fleet.capital_number = 1; + necron_fleet.sprite_index = spr_fleet_necron; + necron_fleet.image_speed = 0; + necron_fleet.image_index = 1; + system.present_fleet[eFACTION.Necrons] += 1; + } + var enemy_fleets = 0; + with(necron_fleet) { + if (owner == eFACTION.Necrons) { + var ii = 0; + ii += capital_number; + ii += round((frigate_number / 2)); + ii += round((escort_number / 4)); + if (ii <= 1) { + ii = 1; + } // image_index=max(8,round(ii)); + + if ((ii >= 7) && (capital_number > 1)) { + for (var fleet_n = 1; fleet_n <= 10; fleet_n++) { + if (orbiting.present_fleet[fleet_n] > 0) { + enemy_fleets++; + } + } + } + } + } + if (enemy_fleets > 0) { + var necron_fleet2; + necron_fleet2 = instance_create(x, y, obj_en_fleet); + necron_fleet2.owner = eFACTION.Necrons; + necron_fleet2.sprite_index = spr_fleet_necron; + // necron_fleet2.image_index=0; + necron_fleet.image_speed = 0; + necron_fleet2.capital_number = 1; + necron_fleet2.frigate_number = round(necron_fleet.frigate_number / 2); + necron_fleet2.escort_number = round(necron_fleet.escort_number / 2); + system.present_fleet[eFACTION.Necrons] += 1; + + necron_fleet.capital_number -= 1; + necron_fleet.frigate_number -= necron_fleet2.frigate_number; + necron_fleet.escort_number -= necron_fleet2.escort_number; + var nearest_planet_coords = [0, 0]; + var found_near_planet = false; + with(obj_star) { + if (present_fleet[eFACTION.Necrons] == 0) { + if (!array_contains(p_type, "Dead")) { + for (var plan = 1; plan <= planets; plan++) { + if (p_owner[plan] <= 5) { + found_near_planet = true; + nearest_planet_coords = [x, y]; + break; + } + } + } + } + } + + if (found_near_planet) { + var tgt1, tgt2; + + necron_fleet2.action_x = nearest_planet_coords[0]; + necron_fleet2.action_y = nearest_planet_coords[1]; + with (necron_fleet2){ + set_fleet_movement(); + } + } + } + } + } + } + + end_turn_heretics_and_corruption_growth(); + + end_turn_genestealer_cults(); + + + // Spread influence on controlled sector + if ((planet_type != "Space Hulk") && (planet_type != "Dead")) { + if ((corruption < 70 && current_owner == 10)) { + if (current_owner == 10){ + alter_corruption(2); + } + + } + if (current_owner == eFACTION.Tau && population_influences[eFACTION.Tyranids]<70){ + var _influ_chance = roll_dice(1,100); + if (_influ_chance <= 5 && population_influences[eFACTION.Tyranids]>=20){ + alter_influence(eFACTION.Tau, 1); + } + } + + if (planet_type == "Daemon"){ + if (pdf > 0) { + pdf = 0; + } + if (guardsmen > 0) { + guardsmen = 0; + } + } + + } + + } + + + static end_turn_genestealer_cults = function(){ + // Genestealer cults grow in number + if (has_feature(P_features.Gene_Stealer_Cult)) { + var cult = get_features(P_features.Gene_Stealer_Cult)[0]; + cult.cult_age++; + alter_influence(eFACTION.Tyranids, cult.cult_age / 100); + var planet_garrison = garrisons; + if (cult.hiding) { + var find_nid_chance = 50 - planet_garrison.total_garrison; + if (population_influences[eFACTION.Tyranids] > 50) { + var find_cult_chance = irandom(50); + var alert_text = $"A hidden Genestealer Cult in {name} Has suddenly burst forth from hiding!"; + if (planet_garrison.garrison_force) { + var alert_text = $"A hidden Genestealer Cult in {name} Has been discovered by marine garrisons!"; + find_cult_chance -= 25; + } + if (find_cult_chance < 1) { + cult.hiding = false; + scr_popup("System Lost", alert_text, "Genestealer Cult", ""); + set_new_owner(eFACTION.Tyranids); + scr_event_log("red", $"A hidden Genestealer Cult in {name} {i} has Started a revolt.", name); + edit_forces(eFACTION.Tyranids,1); + } + } + } + var _nids = planet_forces[eFACTION.Tyranids]; + if ((!cult.hiding) && (_nids <= 3) && (planet_type != "Space Hulk") && (population_influences[eFACTION.Tyranids] > 10)) { + var spread = 0; + var _rando = irandom(150); + _rando -= population_influences[eFACTION.Tyranids]; + if (_rando <= 15) { + spread = 1; + } + + if ((planet_type == "Lava") && (_nids >= 2)) { + spread = 0; + } + if (((planet_type == "Ice") || (planet_type == "Desert")) && (_nids >= 3)) { + spread = 0; + } + + if (spread == 1) { + add_forces(eFACTION.Tyranids, 1); + } + } + if (population_influences[eFACTION.Tyranids] > 55) { + set_new_owner(eFACTION.Tyranids); + } + } else if (population_influences[eFACTION.Tyranids] > 5) { + alter_influence(eFACTION.Tyranids, -1); + if ((irandom(200) + (population_influences[eFACTION.Tyranids] / 10)) > 195) { + add_feature(P_features.Gene_Stealer_Cult); + } + } + } + + static end_turn_heretics_and_corruption_growth = function(){ + // traitors cults + var notixt; + var is_ork; + notixt = false; + + var _rando = roll_dice(1,100); + + if ((current_owner == eFACTION.Chaos) && (corruption < 80)) { + alter_corruption(1); + } + + if ((current_owner != eFACTION.Chaos) && (current_owner != eFACTION.Heretics) && (current_owner != eFACTION.Eldar) && (planet_type != "Dead") && (planet_type != "Craftworld")) { + success = false; + is_ork = current_owner == eFACTION.Ork; + + if (!is_ork) { + //made a linear function for this while here...now the minimum for the roll is a bit higher, but + var score_to_beat = (3 / 4) * (corruption + secret_corruption) - 27.5; + + //if (corruption+secret_corruption>=25) and (_rando<=3) then success=true; + //if (corruption+secret_corruption>=50) and (_rando<=10) then success=true; + //if (corruption+secret_corruption>=70) and (_rando<=25) then success=true; + //if (corruption+secret_corruption>=90) and (_rando<=40) then success=true; + if (_rando < score_to_beat) { + success = true; + } + } + + if (success && (pdf == 0) && (guardsmen == 0) && (planet_forces[eFACTION.Tau] == 0) && (planet_forces[eFACTION.Ork] == 0)) { + current_owner = 10; + scr_alert("red", "owner", $"{name()} has fallen to heretics!", x, y); + + if (visited == 1) { + //visited variable check whether the star has been visited or not 1 for true 0 for false + if (planet_type == "Forge") { + add_disposition(-10); + // 10 disposition decreases for the respective planet + obj_controller.disposition[3] -= 3; // 10 disposition decrease for the toaster Fetishest since they aren't that numerous + } else if (has_feature(P_features.Sororitas_Cathedral) || (planet_type == "Shrine")) { + add_disposition(-4); // similarly 10 disposition decrease, note those nurses are a bit pissy and + // and you can't easily gain their favor because you cannot ask them to "step down" from office. + obj_controller.disposition[5] -= 5; + } else { + // the missus diplomacy 0 is when they cringe when you enter the office and cannot ask them for a date. + } + } + } + + if (success && (planet_type != "Space Hulk")) { + _rando = roll_dice(1,100); + // // // obj_controller.x=self.x;obj_controller.y=self.y; + if (is_garrison_force) { + _rando -= total_garrison; + } + + var tixt = ""; + + // controls losing pdf due to heretic cults + var traitor_mod = 0; + + if (_rando <= 40) { + notixt = true; + var garrison_mod = choose(0.05, 0.1, 0.15, 0.2); + + if (is_garrison_force) { + garrison_mod -= 0.01 * total_garrison; + } + + if (garrison_mod > 0) { + var lost = floor(pdf * garrison_mod); + + if (pdf <= 500) { + lost = pdf ; + edit_forces(eFACTION.Heretics, 1); + } + + edit_pdf(-lost); + + if (planet_forces[eFACTION.Heretics] == 0) { + if (pdf > 0) { + tixt = $"{scr_display_number(lost)} PDF killed in a rebellion on {name()}."; + } else if (pdf == 0) { + tixt = $"Heretic cults have appeared in {name()}."; + } + + scr_alert("purple", "owner", tixt, x, y); + scr_event_log("purple", tixt, name); + } + } else { + tixt = $"Marine garrisons prevents rebellion on {name()}"; + scr_alert("green", "owner", tixt, x, y); + scr_event_log("green", tixt, name); + corruption -= irandom(5); + } + // Cult crushed; don't bother showing if there's already fighting going on over there + } else if ((_rando >= 41) && (_rando < 81) && (planet_forces[eFACTION.Heretics] < 2)) { + if (is_garrison_force) { + traitor_mod = choose(1, 2); + } else { + traitor_mod = 2; + } + + planet_forces[eFACTION.Heretics] = traitor_mod; + tixt = $"Heretic cults have appeared in {name()}."; + } else if ((_rando >= 81) && (_rando < 91) && (planet_forces[eFACTION.Heretics] < 3)) { + // Minor uprising + if (is_garrison_force) { + traitor_mod = choose(2, 3); + } else { + traitor_mod = 3; + } + edit_forces(eFACTION.Heretics,traitor_mod); + tixt = $"Heretic cults have spread around {name()}."; + } // Major uprising + + // major and huge uprisings are impossible as long as a garrisons of at least 10 marines is present + if ((_rando >= 91) && (_rando < 100) && (planet_forces[eFACTION.Heretics] < 4)) { + notixt = true; + edit_forces(eFACTION.Heretics,4); + + if ((obj_controller.faction_defeated[10] == 0) && (obj_controller.faction_gender[10] == 1)) { + edit_forces(eFACTION.Heretics,5); + } + + var n_name = name(); + scr_popup("Heretic Revolt", $"A massive heretic uprising on {n_name} threatens to plunge the star system into chaos.", "chaos_cultist", ""); + scr_alert("red", "owner", $"Massive heretic uprising on {n_name}.", x, y); + scr_event_log("purple", $"Massive heretic uprising on {n_name}.", name); + } // Huge uprising + + if ((_rando >= 100) && (planet_forces[eFACTION.Heretics] < 5)) { + edit_forces(eFACTION.Heretics,6); + set_new_owner(eFACTION.Heretics) + add_feature(P_features.Daemonic_Incursion); + + set_corruption(corruption < 80 ? 80 : 95) + + tixt = $"Daemonic incursion on {name()}!"; + } // Oh god what + + if ((_rando >= 41) && (!notixt) && tixt != "") { + scr_alert("red", "owner", tixt, x, y); + scr_event_log("purple", tixt, name); + } + // if (planet_forces[eFACTION.Heretics]>2){obj_controller.x=self.x;obj_controller.y=self.y;} + } // End traitors cult + } + + } + + } diff --git a/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml b/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml index f3b4a3e6bd..1dae443719 100644 --- a/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml +++ b/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml @@ -1,10 +1,14 @@ function scr_enemy_ai_a() { - system_garrison = []; - system_sabatours = []; + system_garrison = [0]; + system_sabatours = [0]; system_datas = [0]; for (var i=1;i<=planets;i++){ + var garrison = new GarrisonForce(p_operatives[i], true); + var sabatours = new GarrisonForce(p_operatives[i], true, "sabotage"); + array_push(system_garrison, garrison); + array_push(system_sabatours, sabatours); array_push(system_datas,new PlanetData(i, self)); } // guardsmen hop from planet to planet @@ -46,15 +50,10 @@ function scr_enemy_ai_a() { var _planet_data; for (var _run =1;_run<=planets;_run++){ _planet_data = system_datas[_run]; - garrison_force=false; - var garrison = new GarrisonForce(p_operatives[_run], true); - var sabatours = new GarrisonForce(p_operatives[_run], true, "sabotage"); - _planet_data.garrison = garrison; - _planet_data.sabatours = sabatours; + garrison = _planet_data.garrisons; + sabatours = _planet_data.sabatours; garrison_force = garrison.garrison_force; - array_push(system_garrison, garrison); - array_push(system_sabatours, sabatours); stop=0; ensure_no_planet_negatives(_run); diff --git a/scripts/scr_enemy_ai_b/scr_enemy_ai_b.gml b/scripts/scr_enemy_ai_b/scr_enemy_ai_b.gml index 3ee0b01044..3d66a6b699 100644 --- a/scripts/scr_enemy_ai_b/scr_enemy_ai_b.gml +++ b/scripts/scr_enemy_ai_b/scr_enemy_ai_b.gml @@ -11,379 +11,8 @@ function scr_enemy_ai_b() { i = 0; for (i = 1; i <= planets; i++) { - var cur_garrison = system_garrison[i - 1]; - var cur_sabatours = system_sabatours[i - 1]; - - sabotage_force = cur_sabatours.garrison_force; - total_garrison = cur_garrison.total_garrison; - is_garrison_force = cur_garrison.garrison_force; - - var planet_string = $"{string(name)} {scr_roman_numerals()[i - 1]}"; - // Orks grow in number - var ork_growth = floor(random(100)) + 1; - success = false; // This part handles the increasing in numbers - if ((p_owner[i] == 7) && (p_orks[i] < 5) && (p_traitors[i] == 0) && (p_player[i] <= 0 || !is_garrison_force)) { - if ((p_orks[i] > 0) && (p_orks[i] < 5) && (ork_growth <= 15)) { - if (sabotage_force) { - if (irandom(3) < 2) { - scr_event_log("green", $"sabotage force on {planet_string} disrupts ork forces", name); - } else { - p_orks[i] += 1; - } - } else { - p_orks[i] += 1; - } - } - } - if ((p_population[i] < p_max_population[i]) && (p_type[i] != "Dead") && (p_type[i] != "Craftworld") && (p_owner[i] <= 5) && (p_traitors[i] == 0) && (p_tau[i] == 0) && (p_orks[i] == 0) && (p_necrons[i] == 0) && (p_tyranids[i] == 0)) { - if (p_large[i] == 0) { - p_population[i] = round(p_population[i] * 1.0008); - } else if (p_large[i] == 1) { - p_population[i] += choose(0, 0.01); - } - } - - // increasing necrons - if (array_length(p_feature[i]) != 0) { - var has_awake_tomb = false, - nfleet = 0; - if (awake_tomb_world(p_feature[i]) == 1) { - has_awake_tomb = true; - } - if (has_awake_tomb) { - if (p_necrons[i] < 3) { - p_necrons[i] += 2; - } else if (p_necrons[i] < 6) { - p_necrons[i] += 1; - } - } - if (sabotage_force && irandom(2) < 2) { - p_necrons[i]--; - scr_event_log("green", $"sabotage force on {planet_string} disrupts necron forces", name); - } - - if (has_awake_tomb) { - // Necron fleets, woooo - //necrons kill populatin - if ((p_population[i] > 0) && (p_player[i] + p_pdf[i] + p_guardsmen[i] + p_tyranids[i] == 0)) { - p_population[i] = p_population[i] * 0.75; - if ((p_large[i] == 0) && (p_population[i] <= 5000)) { - p_population[i] = 0; - } - } - - var fleet_spawn_chance = roll_dice_chapter(1, 100, "high"); - onceh = 0; - - if (fleet_spawn_chance <= 15) { - if (present_fleet[eFACTION.Necrons] > 0) { - //if necron fleet - necron_fleet = instance_nearest(x, y, obj_en_fleet); - - if (necron_fleet.owner == eFACTION.Necrons) { - if (necron_fleet.escort_number < necron_fleet.capital_number * 1.5) { - necron_fleet.escort_number += 2; - } else if (necron_fleet.frigate_number < necron_fleet.capital_number * 3) { - necron_fleet.frigate_number += 1; - } else { - necron_fleet.capital_number += 1; - } - } - } else if (present_fleet[eFACTION.Necrons] == 0) { - necron_fleet = instance_create(x, y, obj_en_fleet); - necron_fleet.owner = eFACTION.Necrons; - necron_fleet.capital_number = 1; - necron_fleet.sprite_index = spr_fleet_necron; - necron_fleet.image_speed = 0; - necron_fleet.image_index = 1; - present_fleet[eFACTION.Necrons] += 1; - } - var enemy_fleets = 0; - with(necron_fleet) { - if (owner == eFACTION.Necrons) { - var ii = 0; - ii += capital_number; - ii += round((frigate_number / 2)); - ii += round((escort_number / 4)); - if (ii <= 1) { - ii = 1; - } // image_index=max(8,round(ii)); - - if ((ii >= 7) && (capital_number > 1)) { - for (var fleet_n = 1; fleet_n <= 10; fleet_n++) { - if (orbiting.present_fleet[fleet_n] > 0) { - enemy_fleets++; - } - } - } - } - } - if (enemy_fleets > 0) { - var necron_fleet2; - necron_fleet2 = instance_create(x, y, obj_en_fleet); - necron_fleet2.owner = eFACTION.Necrons; - necron_fleet2.sprite_index = spr_fleet_necron; - // necron_fleet2.image_index=0; - necron_fleet.image_speed = 0; - necron_fleet2.capital_number = 1; - necron_fleet2.frigate_number = round(necron_fleet.frigate_number / 2); - necron_fleet2.escort_number = round(necron_fleet.escort_number / 2); - present_fleet[eFACTION.Necrons] += 1; - - necron_fleet.capital_number -= 1; - necron_fleet.frigate_number -= necron_fleet2.frigate_number; - necron_fleet.escort_number -= necron_fleet2.escort_number; - var nearest_planet_coords = [0, 0]; - var found_near_planet = false; - with(obj_star) { - if (present_fleet[eFACTION.Necrons] == 0) { - if (!array_contains(p_type, "Dead")) { - for (var plan = 1; plan <= planets; plan++) { - if (p_owner[plan] <= 5) { - found_near_planet = true; - nearest_planet_coords = [x, y]; - break; - } - } - } - } - } - - if (found_near_planet) { - var tgt1, tgt2; - - necron_fleet2.action_x = nearest_planet_coords[0]; - necron_fleet2.action_y = nearest_planet_coords[1]; - necron_fleet2.alarm[4] = 1; - } - } - } - } - } - // traitors cults - var notixt; - var is_ork; - notixt = false; - - rando = irandom(99) + 1; - - if ((p_owner[i] == eFACTION.Chaos) && (p_heresy[i] < 80)) { - p_heresy[i] += 1; - } - - if ((p_owner[i] != eFACTION.Chaos) && (p_owner[i] != eFACTION.Heretics) && (p_owner[i] != eFACTION.Eldar) && (planets >= i) && (p_type[i] != "Dead") && (p_type[i] != "Craftworld")) { - success = false; - is_ork = p_owner[i] == eFACTION.Ork; - - if (!is_ork) { - //made a linear function for this while here...now the minimum for the roll is a bit higher, but - var score_to_beat = (3 / 4) * (p_heresy[i] + p_heresy_secret[i]) - 27.5; - - //if (p_heresy[i]+p_heresy_secret[i]>=25) and (rando<=3) then success=true; - //if (p_heresy[i]+p_heresy_secret[i]>=50) and (rando<=10) then success=true; - //if (p_heresy[i]+p_heresy_secret[i]>=70) and (rando<=25) then success=true; - //if (p_heresy[i]+p_heresy_secret[i]>=90) and (rando<=40) then success=true; - if (rando < score_to_beat) { - success = true; - } - } - - if (success && (p_pdf[i] == 0) && (p_guardsmen[i] == 0) && (p_tau[i] == 0) && (p_orks[i] == 0)) { - p_owner[i] = 10; - scr_alert("red", "owner", string(name) + " " + string(i) + " has fallen to heretics!", x, y); - - if (visited == 1) { - //visited variable check whether the star has been visited or not 1 for true 0 for false - if (p_type[i] == "Forge") { - dispo[i] -= 10; // 10 disposition decreases for the respective planet - obj_controller.disposition[3] -= 3; // 10 disposition decrease for the toaster Fetishest since they aren't that numerous - } else if (planet_feature_bool(p_feature[i], P_features.Sororitas_Cathedral) || (p_type[i] == "Shrine")) { - dispo[i] -= 4; // similarly 10 disposition decrease, note those nurses are a bit pissy and - // and you can't easily gain their favor because you cannot ask them to "step down" from office. - obj_controller.disposition[5] -= 5; - } else { - // the missus diplomacy 0 is when they cringe when you enter the office and cannot ask them for a date. - } - } - } - - if (success && (p_type[i] != "Space Hulk")) { - rando = floor(random(100)) + 1; - // // // obj_controller.x=self.x;obj_controller.y=self.y; - if (is_garrison_force) { - rando -= total_garrison; - } - - var tixt = ""; - - // controls losing pdf due to heretic cults - var traitor_mod = 0; - - if (rando <= 40) { - notixt = true; - var garrison_mod = choose(0.05, 0.1, 0.15, 0.2); - - if (is_garrison_force) { - garrison_mod -= 0.01 * total_garrison; - } - - if (garrison_mod > 0) { - var lost = floor(p_pdf[i] * garrison_mod); - - if (p_pdf[i] <= 500) { - lost = p_pdf[i]; - p_traitors[i] = 1; - } - - p_pdf[i] -= lost; - - if (p_traitors[i] == 0) { - if (p_pdf[i] > 0) { - tixt = $"{scr_display_number(lost)} PDF killed in a rebellion on {planet_string}."; - } else if (p_pdf[i] == 0) { - tixt = $"Heretic cults have appeared in {planet_string}."; - } - - scr_alert("purple", "owner", tixt, x, y); - scr_event_log("purple", tixt, name); - } - } else { - tixt = $"Marine garrison prevents rebellion on {planet_string}"; - scr_alert("green", "owner", tixt, x, y); - scr_event_log("green", tixt, name); - p_heresy[i] -= irandom(5); - } - // Cult crushed; don't bother showing if there's already fighting going on over there - } else if ((rando >= 41) && (rando < 81) && (p_traitors[i] < 2)) { - if (is_garrison_force) { - traitor_mod = choose(1, 2); - } else { - traitor_mod = 2; - } - - p_traitors[i] = traitor_mod; - tixt = $"Heretic cults have appeared in {planet_string}."; - } else if ((rando >= 81) && (rando < 91) && (p_traitors[i] < 3)) { - // Minor uprising - if (is_garrison_force) { - traitor_mod = choose(2, 3); - } else { - traitor_mod = 3; - } - p_traitors[i] = traitor_mod; - tixt = $"Heretic cults have spread around {planet_string}."; - } // Major uprising - - // major and huge uprisings are impossible as long as a garrison of at least 10 marines is present - if ((rando >= 91) && (rando < 100) && (p_traitors[i] < 4)) { - notixt = true; - p_traitors[i] = 4; - - if ((obj_controller.faction_defeated[10] == 0) && (obj_controller.faction_gender[10] == 1)) { - p_traitors[i] = 5; - } - - var n_name = planet_numeral_name(i); - scr_popup("Heretic Revolt", $"A massive heretic uprising on {n_name} threatens to plunge the star system into chaos.", "chaos_cultist", ""); - scr_alert("red", "owner", $"Massive heretic uprising on {n_name}.", x, y); - scr_event_log("purple", $"Massive heretic uprising on {n_name}.", name); - } // Huge uprising - - if ((rando >= 100) && (p_traitors[i] < 5)) { - p_traitors[i] = 6; - p_owner[i] = 10; - array_push(p_feature[i], new NewPlanetFeature(P_features.Daemonic_Incursion)); - - if (p_heresy[i] >= 80) { - p_heresy[i] = 95; - } else if (p_heresy[i] < 80) { - p_heresy[i] = 80; - } - - tixt = $"Daemonic incursion on {planet_numeral_name(i)}!"; - } // Oh god what - - if ((rando >= 41) && (!notixt) && tixt != "") { - scr_alert("red", "owner", tixt, x, y); - scr_event_log("purple", tixt, name); - } - // if (p_traitors[i]>2){obj_controller.x=self.x;obj_controller.y=self.y;} - } // End traitors cult - } - // Genestealer cults grow in number - if (planet_feature_bool(p_feature[i], P_features.Gene_Stealer_Cult)) { - var cult = return_planet_features(p_feature[i], P_features.Gene_Stealer_Cult)[0]; - cult.cult_age++; - adjust_influence(eFACTION.Tyranids, cult.cult_age / 100, i); - var planet_garrison = system_garrison[i - 1]; - if (cult.hiding) { - var find_nid_chance = 50 - planet_garrison.total_garrison; - if (p_influence[i][eFACTION.Tyranids] > 50) { - var find_cult_chance = irandom(50); - var alert_text = $"A hidden Genestealer Cult in {name} Has suddenly burst forth from hiding!"; - if (planet_garrison.garrison_force) { - var alert_text = $"A hidden Genestealer Cult in {name} Has been discovered by marine garrison!"; - find_cult_chance -= 25; - } - if (find_cult_chance < 1) { - cult.hiding = false; - scr_popup("System Lost", alert_text, "Genestealer Cult", ""); - owner = eFACTION.Tyranids; - scr_event_log("red", $"A hidden Genestealer Cult in {name} {i} has Started a revolt.", name); - p_tyranids[i] += 1; - } - } - } - if ((!cult.hiding) && (p_tyranids[i] <= 3) && (p_type[i] != "Space Hulk") && (p_influence[i][eFACTION.Tyranids] > 10)) { - var spread = 0; - rando = irandom(150); - rando -= p_influence[i][eFACTION.Tyranids]; - if (rando <= 15) { - spread = 1; - } - - if ((p_type[i] == "Lava") && (p_tyranids[i] == 2)) { - spread = 0; - } - if (((p_type[i] == "Ice") || (p_type[i] == "Desert")) && (p_tyranids[i] == 3)) { - spread = 0; - } - - if (spread == 1) { - p_tyranids[i] += 1; - } - } - if (p_influence[i][eFACTION.Tyranids] > 55) { - p_owner[i] = eFACTION.Tyranids; - } - } else if (p_influence[i][eFACTION.Tyranids] > 5) { - adjust_influence(eFACTION.Tyranids, -1, i); - if ((irandom(200) + (p_influence[i][eFACTION.Tyranids] / 10)) > 195) { - array_push(p_feature[i], new NewPlanetFeature(P_features.Gene_Stealer_Cult)); - } - } - - // Spread influence on controlled sector - if ((p_type[i] != "Space Hulk") && (p_type[i] != "Dead")) { - if ((p_heresy[i] < 70) && (owner == 10)) { - p_heresy[i] += 2; - } - if ((p_heresy[i] < 70) && (owner == 8)) { - var doggy = floor(random(100)) + 1; - if ((doggy <= 5) && (p_heresy[i] >= 20)) { - p_heresy[i] += 1; - } - } - } - - if ((p_type[i] == "Daemon") && (p_type[i] != "Space Hulk")) { - if (p_pdf[i] > 0) { - p_pdf[i] = 0; - } - if (p_guardsmen[i] > 0) { - p_guardsmen[i] = 0; - } - } + system_datas[i].refresh_data(); + system_datas[i].end_of_turn_population_influence_and_enemy_growth(); // if (p_heresy[i]>0) and (owner != eFACTION.Chaos) then p_heresy[i]-=2; } // Tau rebellions diff --git a/scripts/scr_mechanicus_missions/scr_mechanicus_missions.gml b/scripts/scr_mechanicus_missions/scr_mechanicus_missions.gml index 1ab242d254..79cd0b6c24 100644 --- a/scripts/scr_mechanicus_missions/scr_mechanicus_missions.gml +++ b/scripts/scr_mechanicus_missions/scr_mechanicus_missions.gml @@ -8,7 +8,7 @@ function mechanicus_missions_end_turn(planet){ var percent_complete = increment_mission_completion(_prob_data); scr_alert("",$"mission",$"Mechanicus Mission on {planet_numeral_name(planet)} is {floor(percent_complete)}% complete.",0,0); if (percent_complete>=100){ - remove_planet_problem(planet,"mech_raider") + remove_planet_problem(planet,"mech_raider"); scr_mission_reward("mech_raider",id,planet); } } diff --git a/scripts/scr_mission_functions/scr_mission_functions.gml b/scripts/scr_mission_functions/scr_mission_functions.gml index 2019372c7a..c260b1440c 100644 --- a/scripts/scr_mission_functions/scr_mission_functions.gml +++ b/scripts/scr_mission_functions/scr_mission_functions.gml @@ -86,7 +86,7 @@ function scr_new_governor_mission(planet, problem = ""){ }; if (problem != ""){ if (problem == "provide_garrison"){ - if (system_garrison[planet-1].garrison_force){ + if (system_garrison[planet].garrison_force){ exit; } mission_data.reason = choose("stability", "importance"); @@ -308,9 +308,9 @@ function init_train_forces_mission(planet, star, mission_slot, marine){ function complete_garrison_mission(targ_planet, problem_index){ var planet = new PlanetData(targ_planet, self); if (problem_has_key_and_value(targ_planet,problem_index,"stage", "active")){ - if (planet.current_owner == eFACTION.Imperium && system_garrison[targ_planet-1].garrison_force){ + if (planet.current_owner == eFACTION.Imperium && system_garrison[targ_planet].garrison_force){ var _mission_string = $"The garrison on {planet_numeral_name(targ_planet)} has finished the period of garrison support agreed with the planetary governor."; - var p_garrison = system_garrison[targ_planet-1]; + var p_garrison = system_garrison[targ_planet]; var result = p_garrison.garrison_disposition_change(id, targ_planet); if (!p_garrison.garrison_leader){ p_garrison.find_leader(); @@ -674,13 +674,15 @@ function deliver_trophy_end_turn_check(){ var _wanted_types = ["Ice","Desert","Agri","Lava","Death"]; var _star = scr_get_stars(true,[],_wanted_types)[0]; _text += "During the concourse that follows with the fleet command your marines learn of a old battle ground discovered on {_star.name}."; - _text += "According too intel it appeared to be an old astartes battle ground from an unknown age, communications have been passed onto the adeptus mechanicus who will no doubt pick the site clean should they reach it befre you do"; + _text += "According too intel it appeared to be an old astartes battle ground from an unknown age, communications have been passed onto the adeptus mechanicus who will no doubt pick the site clean should they reach it before you do"; var _planet = scr_get_planet_with_type(_wanted_types); - var _battle_ground = new NewPlanetFeature(P_features.AstartesBattleGround); + var _battle_ground = new NewPlanetFeature(P_features.OldBattleGround); _battle_ground.player_hidden = false; + _battle_ground.imperium_known = true; + _star.add_feature(_planet,_battle_ground); } scr_popup( diff --git a/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml b/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml index 566029cad3..5fe6d5efed 100644 --- a/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml +++ b/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml @@ -18,7 +18,7 @@ function new_ork_fleet(xx,yy){ function orks_end_turn_growth(){ for (i=1;i<=planets;i++){ - var _pdata = new PlanetData(i, self); + var _pdata = system_datas[i].refresh_data(); if (!p_orks[i]){ var _strongholds = _pdata.get_features(P_features.OrkStronghold); for (var s=0;s Date: Fri, 12 Dec 2025 03:29:43 +0000 Subject: [PATCH 08/31] fixes --- ChapterMaster.yyp | 2 +- scripts/scr_PlanetData/scr_PlanetData.gml | 13 +++++++------ .../scr_draw_planet_features.gml | 8 ++++---- scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml | 6 +++--- .../scr_ork_fleet_functions.gml | 3 ++- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/ChapterMaster.yyp b/ChapterMaster.yyp index b05df75306..a3915146de 100644 --- a/ChapterMaster.yyp +++ b/ChapterMaster.yyp @@ -579,7 +579,7 @@ "isEcma":false, "LibraryEmitters":[], "MetaData":{ - "IDEVersion":"2024.1400.0.901", + "IDEVersion":"2024.1400.0.904", }, "name":"ChapterMaster", "resources":[ diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 7fe9b27489..b59e6cc939 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -156,7 +156,7 @@ function PlanetData(planet, system) constructor{ static alter_influence = function(faction,value){ adjust_influence(eFACTION.Tyranids, -1, planet,system); - population_influences = p_influence[planet]; + population_influences = system.p_influence[planet]; } static send_colony_ship = function(target, targ_planet, type){ @@ -344,7 +344,7 @@ function PlanetData(planet, system) constructor{ } var _orks = planet_forces[eFACTION.Ork]; - if ((current_owner == eFACTION.Ork) && (_orks < 5) && (planet_forces[eFACTION.Heretics] == 0) && (p_player[i] <= 0 || !is_garrison_force)) { + if ((current_owner == eFACTION.Ork) && (_orks < 5) && (planet_forces[eFACTION.Heretics] == 0) && (player_forces <= 0 || !is_garrison_force)) { if ((_orks> 0) && (_ork_growth <= _ork_growth_threshold)) { if (sabotage_force) { if (irandom(3) < 2) { @@ -1151,7 +1151,7 @@ function PlanetData(planet, system) constructor{ var size = ["", "Small", "", "Large"]; if ( feat_count > 0){ for (i =0; i < feat_count ;i++){ - cur_feature= features[i] + cur_feature = features[i] if (cur_feature.planet_display != 0){ if (cur_feature.f_type == P_features.Gene_Stealer_Cult){ if (!cur_feature.hiding){ @@ -1253,7 +1253,8 @@ function PlanetData(planet, system) constructor{ system.p_tyranids[planet]-=2; } else if (planet_forces[eFACTION.Ork]>0){ - if (strength>2) then strength=2;if (strength<1) then strength=0; + if (strength>2) then strength=2; + if (strength<1) then strength=0; system.p_orks[planet]-=2; } else if (current_owner=eFACTION.Tau) and (planet_forces[eFACTION.Tau]>0){ @@ -1422,7 +1423,7 @@ function PlanetData(planet, system) constructor{ if (has_awake_tomb) { // Necron fleets, woooo //necrons kill populatin - if ((population > 0) && (p_player[i] + pdf + guardsmen + planet_forces[eFACTION.Tyranids] == 0)) { + if ((population > 0) && (player_forces + pdf + guardsmen + planet_forces[eFACTION.Tyranids] == 0)) { population = population * 0.75; if ((large_population == 0) && (population <= 5000)) { population = 0; @@ -1643,7 +1644,7 @@ function PlanetData(planet, system) constructor{ current_owner = 10; scr_alert("red", "owner", $"{name()} has fallen to heretics!", x, y); - if (visited == 1) { + if (system.visited == 1) { //visited variable check whether the star has been visited or not 1 for true 0 for false if (planet_type == "Forge") { add_disposition(-10); diff --git a/scripts/scr_draw_planet_features/scr_draw_planet_features.gml b/scripts/scr_draw_planet_features/scr_draw_planet_features.gml index b4a2f3ba91..48c90c2f5c 100644 --- a/scripts/scr_draw_planet_features/scr_draw_planet_features.gml +++ b/scripts/scr_draw_planet_features/scr_draw_planet_features.gml @@ -7,11 +7,11 @@ function FeatureSelected(Feature, system, planet) constructor{ feature = Feature; main_slate = new DataSlateMKTwo(); exit_sequence = false; - entrance_sequence=true; - remove=false; - destroy=false; + entrance_sequence = true; + remove = false; + destroy = false; exit_count = 0; - enter_count=18; + enter_count = 18; planet_data = new PlanetData(planet,system); if (feature.f_type == P_features.Forge){ diff --git a/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml b/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml index 974fb2790c..e69d738942 100644 --- a/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml +++ b/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml @@ -52,6 +52,7 @@ function scr_enemy_ai_d() { } } } + for (var i=1;i<=planets;i++){ problem_count_down(i); if (planet_problemless(i)) then continue; @@ -445,10 +446,9 @@ function scr_enemy_ai_d() { // Local problems will go here var planet; - for (var i=0;i<=planets;i++){ - planet=i+1; + for (var planet=1;i<=planets;i++){ if (i < array_length(system_garrison)){ - var garrison = system_garrison[i]; + var garrison = system_garrison[planet]; if (garrison.garrison_force){ if (garrison.garrison_disposition_change(self,planet)!="none"){ dispo[planet]+=garrison.dispo_change; diff --git a/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml b/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml index 5fe6d5efed..c2b2b81377 100644 --- a/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml +++ b/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml @@ -18,7 +18,8 @@ function new_ork_fleet(xx,yy){ function orks_end_turn_growth(){ for (i=1;i<=planets;i++){ - var _pdata = system_datas[i].refresh_data(); + var _pdata = system_datas[i]; + _pdata.refresh_data(); if (!p_orks[i]){ var _strongholds = _pdata.get_features(P_features.OrkStronghold); for (var s=0;s Date: Sun, 14 Dec 2025 13:09:09 +0000 Subject: [PATCH 09/31] general refactors --- scripts/scr_buttons/scr_buttons.gml | 46 ++++------ .../scr_draw_planet_features.gml | 88 ++++++++++++------- 2 files changed, 71 insertions(+), 63 deletions(-) diff --git a/scripts/scr_buttons/scr_buttons.gml b/scripts/scr_buttons/scr_buttons.gml index 357b0afc34..23fbb29839 100644 --- a/scripts/scr_buttons/scr_buttons.gml +++ b/scripts/scr_buttons/scr_buttons.gml @@ -54,22 +54,20 @@ function pop_draw_return_values() { /// @example /// var rs = new ReactiveString("Hello", 100, 200); /// rs.draw(); -function ReactiveString(text, x1 = 0, y1 = 0, data = false) constructor { +function ReactiveString(text, x1 = 0, y1 = 0, data = false) constructor{ + standard_loc_data(); + self.x1 = x1; self.y1 = y1; - x2 = 0; - y2 = 0; + self.text = text; + halign = fa_left; valign = fa_top; - - self.text = text; text_max_width = -1; font = fnt_40k_14; colour = CM_GREEN_COLOR; tooltip = ""; max_width = -1; - h = 0; - w = 0; scale_text=false; move_data_to_current_scope(data); @@ -139,11 +137,9 @@ function ReactiveString(text, x1 = 0, y1 = 0, data = false) constructor { /// @param {struct|bool} [data=false] Optional struct of properties to apply. /// @returns {LabeledIcon} function LabeledIcon(icon, text, x1 = 0, y1 = 0, data = false) constructor { + standard_loc_data(); self.x1 = x1; self.y1 = y1; - x2 = 0; - y2 = 0; - self.text = text; text_max_width = -1; font = fnt_40k_14; @@ -281,8 +277,7 @@ function standard_loc_data(){ /// @param {struct|bool} [data=false] Initial property overrides. /// @returns {UnitButtonObject} function UnitButtonObject(data = false) constructor { - x1 = 0; - y1 = 0; + standard_loc_data(); w = 102; h = 30; h_gap = 4; @@ -433,10 +428,11 @@ function PurchaseButton(req) : UnitButtonObject() constructor { static draw = function(allow_click = true) { add_draw_return_values(); - var _but = draw_unit_buttons([x1, y1, x2, y2], label, [1, 1], color,,, alpha); + draw_sprite_ext(spr_requisition, 0, x1, y1, _scale, _scale, 0, c_white, 1); + var _but = draw_unit_buttons([x1 + (get_sprite_width(spr_requisition) * scale), y1, x2, y2], label, [1, 1], color,,, alpha); var _sh = sprite_get_height(spr_requisition); var _scale = (y2 - y1) / _sh; - draw_sprite_ext(spr_requisition, 0, x1, y2, _scale, _scale, 0, c_white, 1); + var _allow_click = obj_controller.requisition >= req_value; if (scr_hit(x1, y1, x2, y2) && tooltip != "") { tooltip_draw(tooltip); @@ -460,8 +456,7 @@ function PurchaseButton(req) : UnitButtonObject() constructor { } function slider_bar() constructor { - x1 = 0; - y1 = 0; + standard_loc_data(); w = 102; h = 15; value_limits = [0, 0]; @@ -657,10 +652,7 @@ function MultiSelect(options_array, title, data = {}) constructor { self.title = title; x_gap = 10; y_gap = 5; - x1 = 0; - y1 = 0; - x2 = 0; - y2 = 0; + standard_loc_data(); on_change = false; active_col = CM_GREEN_COLOR; inactive_col = c_gray; @@ -672,6 +664,7 @@ function MultiSelect(options_array, title, data = {}) constructor { _next_tog.active = false; array_push(toggles, _next_tog); } + static update = item_data_updater; update(data); @@ -771,8 +764,7 @@ function RadioSet(options_array, title = "", data = {}) constructor { allow_changes = true; x_gap = 10; y_gap = 5; - x1 = 0; - y1 = 0; + standard_loc_data(); title_font = fnt_40k_14b; draw_title = true; space_evenly = false; @@ -905,10 +897,7 @@ function RadioSet(options_array, title = "", data = {}) constructor { /// @param {struct} [data={}] Initial properties. /// @returns {ToggleButton} function ToggleButton(data = {}) constructor { - x1 = 0; - y1 = 0; - x2 = 0; - y2 = 0; + standard_loc_data(); tooltip = ""; str1 = ""; width = 0; @@ -1036,10 +1025,7 @@ function ToggleButton(data = {}) constructor { /// @param {struct} [data={}] Initial properties. /// @returns {InteractiveButton} function InteractiveButton(data = {}) constructor { - x1 = 0; - y1 = 0; - x2 = 0; - y2 = 0; + standard_loc_data(); str1 = ""; inactive_tooltip = ""; tooltip = ""; diff --git a/scripts/scr_draw_planet_features/scr_draw_planet_features.gml b/scripts/scr_draw_planet_features/scr_draw_planet_features.gml index 48c90c2f5c..1fdf3fca9f 100644 --- a/scripts/scr_draw_planet_features/scr_draw_planet_features.gml +++ b/scripts/scr_draw_planet_features/scr_draw_planet_features.gml @@ -28,8 +28,39 @@ function FeatureSelected(Feature, system, planet) constructor{ } } } + forge_assign_button = new UnitButtonObject({ + label:"Assign To Forge", + color:CM_RED_COLOR, + bind_method :function(){ + obj_controller.unit_profile = false; + obj_controller.view_squad = false; + group_selection(techs,{ + purpose:"Forge Assignment", + purpose_code : "forge_assignment", + number:worker_capacity, + system:planet_data.system, + feature:feature, + planet : planet_data.planet, + selections : [] + }); + destroy=true; + }, + bind_scope :self, + }); + + forge_upgrade_button = new UnitButtonObject({ + color:CM_RED_COLOR, + bind_scope :self, + bind_method :function(){ + obj_controller.requisition -= upgrade_cost; + feature.size++; + worker_capacity*=2; + } + }) } + exit_button = new UnitButtonObject({label:"<---",color:CM_RED_COLOR}); + draw_planet_features = function(xx,yy){ add_draw_return_values(); draw_set_halign(fa_center); @@ -40,7 +71,7 @@ function FeatureSelected(Feature, system, planet) constructor{ xx-=(25*exit_count); main_slate.draw(xx,yy, 1.38,1.38); exit_count++; - if (xx-25<=obj_star_select.main_data_slate.XX) then remove=true; + remove = (xx-25<=obj_star_select.main_data_slate.XX); } else if (entrance_sequence){ enter_count--; xx-=(25*enter_count); @@ -49,16 +80,18 @@ function FeatureSelected(Feature, system, planet) constructor{ }else { main_slate.draw(xx,yy, 1.4,1.4); } - var area_width = main_slate.width; - var area_height = main_slate.height; - var generic = false; - var title="", body=""; - var _button_tooltip = ""; + w = main_slate.width; + h = main_slate.height; + generic = false; + title=""; + body=""; + button_tooltip = ""; //draw_glow_dot(xx+150, yy+150); //rack_and_pinion(xx+230, yy+170); var rectangle = []; draw_set_color(c_green); - if (point_and_click(draw_unit_buttons([xx+12, yy+20], "<---",[1,1],c_red))){ + exit_button.update({x1:xx+12,y1:yy+20}); + if (exit_button.draw()){ exit_sequence=true; }; draw_set_halign(fa_center); @@ -69,31 +102,20 @@ function FeatureSelected(Feature, system, planet) constructor{ draw_set_color(c_gray); draw_text(xx+10, yy+50, $"Working Techs : {feature.techs_working}/{worker_capacity}"); - if (point_and_click(draw_unit_buttons([xx+10, yy+70], "Assign To Forge",[1,1],c_red))){ - obj_controller.unit_profile = false; - obj_controller.view_squad = false; - group_selection(techs,{ - purpose:"Forge Assignment", - purpose_code : "forge_assignment", - number:worker_capacity, - system:planet_data.system, - feature:feature, - planet : planet_data.planet, - selections : [] - }); - destroy=true; - - } + forge_assign_button.update({x1:xx+10,y1 : yy+70}); + forge_assign_button.draw(); //TODO move over to using the draw button object ot streamline this - var next_position = [xx+10, yy+95]; + var next_position = {x1:x1+10, y1: yy+95}; if (feature.size<3){ var upgrade_cost = 2000 * feature.size; - var last_button = draw_unit_buttons(next_position, $"Upgrade Forge ({upgrade_cost} req)",[1,1],c_red); - next_position = [last_button[0], last_button[3]]; - if (point_and_click(last_button) && obj_controller.requisition>=upgrade_cost){ - obj_controller.requisition -= upgrade_cost; - feature.size++; - worker_capacity*=2; + forge_upgrade_button.update(next_position); + forge_upgrade_button.update({ + label:$"Upgrade Forge ({upgrade_cost} req)", + }); + forge_upgrade_button.draw(); + next_position={ + x1:forge_upgrade_button.x1, + y1:forge_upgrade_button.y2, } } if (feature.size>1 && !feature.vehicle_hanger){ @@ -267,7 +289,7 @@ function FeatureSelected(Feature, system, planet) constructor{ mission_description=$"The governor of {planet_name} has sent many requests to the sector commander for help with defending against xenos raids on the populace of the planet, the reports seem to suggest the xenos in question are in fact dark eldar."; help = "Set a squad to ambush"; button_text = "Send Squad"; - _button_tooltip = "milage may vary on playability of this mission progress at your own risk"; + button_tooltip = "milage may vary on playability of this mission progress at your own risk"; button_function = function(){ var dudes = collect_role_group("all", obj_star_select.target.name); group_selection(dudes,{ @@ -314,13 +336,13 @@ function FeatureSelected(Feature, system, planet) constructor{ var text_body_height = string_height_ext(string_hash_to_newline(mission_description),-1,area_width-20); if (help!="none"){ draw_text_ext(xx+10, yy+40+text_body_height+10,help,-1,area_width-20); - text_body_height+=string_height_ext(string_hash_to_newline(mission_description),-1,area_width-20)+10; + text_body_height += string_height_ext(string_hash_to_newline(mission_description),-1,area_width-20)+10; } if (button_text!="none"){ var _button = draw_unit_buttons([xx+((area_width/2)-(string_width(button_text)/2)), yy+40+text_body_height+10], button_text); - if (_button_tooltip != "" && scr_hit(_button)){ - tooltip_draw(_button_tooltip); + if (button_tooltip != "" && scr_hit(_button)){ + tooltip_draw(button_tooltip); } if (point_and_click(_button)){ if (is_callable(button_function)){ From cc7e43b5cac493bf1141a425fd205e296fcf6599 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Sun, 14 Dec 2025 14:16:12 +0000 Subject: [PATCH 10/31] Mechanicus Fleet shenanigans --- ChapterMaster.yyp | 1 + objects/obj_en_fleet/Create_0.gml | 6 +- scripts/scr_PlanetData/scr_PlanetData.gml | 24 +++ .../scr_draw_planet_features.gml | 36 ++-- scripts/scr_enemy_ai_e/scr_enemy_ai_e.gml | 7 +- .../scr_forge_world_functions.gml | 95 ++++++---- .../scr_mechanicus_fleet_functions.gml | 22 +++ .../scr_mechanicus_fleet_functions.yy | 13 ++ .../scr_planetary_feature.gml | 4 +- .../scr_player_fleet_functions.gml | 8 + .../scr_unit_quick_find_pane.gml | 168 +++++++++--------- 11 files changed, 241 insertions(+), 143 deletions(-) create mode 100644 scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml create mode 100644 scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.yy diff --git a/ChapterMaster.yyp b/ChapterMaster.yyp index a3915146de..e69d7cd6a4 100644 --- a/ChapterMaster.yyp +++ b/ChapterMaster.yyp @@ -865,6 +865,7 @@ {"id":{"name":"scr_marine_struct","path":"scripts/scr_marine_struct/scr_marine_struct.yy",},}, {"id":{"name":"scr_master_loc","path":"scripts/scr_master_loc/scr_master_loc.yy",},}, {"id":{"name":"scr_max_marine","path":"scripts/scr_max_marine/scr_max_marine.yy",},}, + {"id":{"name":"scr_mechanicus_fleet_functions","path":"scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.yy",},}, {"id":{"name":"scr_mechanicus_missions","path":"scripts/scr_mechanicus_missions/scr_mechanicus_missions.yy",},}, {"id":{"name":"scr_mission_eta","path":"scripts/scr_mission_eta/scr_mission_eta.yy",},}, {"id":{"name":"scr_mission_functions","path":"scripts/scr_mission_functions/scr_mission_functions.yy",},}, diff --git a/objects/obj_en_fleet/Create_0.gml b/objects/obj_en_fleet/Create_0.gml index 024096527a..987ee13358 100644 --- a/objects/obj_en_fleet/Create_0.gml +++ b/objects/obj_en_fleet/Create_0.gml @@ -4,8 +4,8 @@ capital_number=0; frigate_number=0; escort_number=0; guardsmen=0; -home_x=0; -home_y=0; +home_x=x; +home_y=y; selected=0; ret=0; hurt=0; @@ -56,6 +56,8 @@ check_events_destructions = function(){ //TODO set up special save method for faction specific fleet variables inquisitor=-1; +set_movement = method(self,set_fleet_movement); + cargo_data = {}; image_xscale=1.25; diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index b59e6cc939..69d822f62f 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -1762,6 +1762,30 @@ function PlanetData(planet, system) constructor{ } + static check_old_battles_feature = functions(){ + if (has_feature(P_features.OldBattleGround)){ + var _feats = get_features(P_features.OldBattleGround); + for (var i=0;i1 && !feature.vehicle_hanger){ var upgrade_cost = 3000; - var build_coords = draw_unit_buttons(next_position, $"Build Vehicle Hanger({upgrade_cost} req)",[1,1],c_red); + var build_coords = draw_unit_buttons(_next_position, $"Build Vehicle Hanger({upgrade_cost} req)",[1,1],c_red); if (scr_hit(build_coords)){ tooltip_draw("Required to Build Vehicles in the Forge") } @@ -130,7 +130,7 @@ function FeatureSelected(Feature, system, planet) constructor{ array_push(obj_controller.player_forge_data.vehicle_hanger,[obj_controller.selected.name,planet_data.planet]); } } else if(feature.vehicle_hanger){ - draw_text(next_position[0], next_position[1], "Forge has a vehicle hanger") + draw_text(_next_position[0], _next_position[1], "Forge has a vehicle hanger Allowing vehicles to be coonstructed behavior"); //TODO somthing if the forge has a hanger } break; @@ -158,6 +158,10 @@ function FeatureSelected(Feature, system, planet) constructor{ title = "Ancinet Ruins"; body = "Unload Marines onto the planet to explore the ruins"; break; + case P_features.OldBattleGround: + generic=true; + title = "Old Battlefield"; + body = "The site of a previously unrecorded battle between {feature.faction1} and {feature.faction2} forces long forgotten"; case P_features.STC_Fragment: generic=true; title = "STC Fragment"; @@ -180,7 +184,7 @@ function FeatureSelected(Feature, system, planet) constructor{ body = $"The Cult of {feature.name} {control_string}"; break; case P_features.Victory_Shrine: - draw_text_transformed(xx+(area_width/2), yy +10, "Victory Shrine", 2, 2, 0); + draw_text_transformed(xx+(w/2), yy +10, "Victory Shrine", 2, 2, 0); draw_set_halign(fa_left); draw_set_color(c_gray); /*if (!feature.parade){ @@ -192,7 +196,7 @@ function FeatureSelected(Feature, system, planet) constructor{ }*/ break; case P_features.Monastery: - draw_text_transformed(xx+(area_width/2), yy +10, feature.name, 2, 2, 0); + draw_text_transformed(xx+(w/2), yy +10, feature.name, 2, 2, 0); if (feature.forge==0){ draw_text_transformed(xx+80, yy +50, "Forge", 1, 1, 0); if (draw_building_builder(xx+40, yy+70,500,spr_forge_holo)){ @@ -329,18 +333,18 @@ function FeatureSelected(Feature, system, planet) constructor{ mission_description=$"The governor of {planet_name} has expressed his distaste of the neighboring governance of {target.name} {feature.target} he has expressed his views that they engage in heretical ways and harbor xenos enemies though in truth it is more likely that he simply wishes his political enemies disposed of, whatever the case his planet has great economic means and he has made bare his plans to compensate the emperors angels for their aid"; break; } - draw_text_transformed(xx+(area_width/2), yy +5, mission_name_key(feature.problem), 2, 2, 0); + draw_text_transformed(xx+(w/2), yy +5, mission_name_key(feature.problem), 2, 2, 0); draw_set_halign(fa_left); draw_set_color(c_gray); - draw_text_ext(xx+10, yy+40,mission_description,-1,area_width-20); - var text_body_height = string_height_ext(string_hash_to_newline(mission_description),-1,area_width-20); + draw_text_ext(xx+10, yy+40,mission_description,-1,w-20); + var text_body_height = string_height_ext(string_hash_to_newline(mission_description),-1,w-20); if (help!="none"){ - draw_text_ext(xx+10, yy+40+text_body_height+10,help,-1,area_width-20); - text_body_height += string_height_ext(string_hash_to_newline(mission_description),-1,area_width-20)+10; + draw_text_ext(xx+10, yy+40+text_body_height+10,help,-1,w-20); + text_body_height += string_height_ext(string_hash_to_newline(mission_description),-1,w-20)+10; } if (button_text!="none"){ - var _button = draw_unit_buttons([xx+((area_width/2)-(string_width(button_text)/2)), yy+40+text_body_height+10], button_text); + var _button = draw_unit_buttons([xx+((w/2)-(string_width(button_text)/2)), yy+40+text_body_height+10], button_text); if (button_tooltip != "" && scr_hit(_button)){ tooltip_draw(button_tooltip); } @@ -356,11 +360,11 @@ function FeatureSelected(Feature, system, planet) constructor{ break; } if (generic){ - draw_text_ext_transformed(xx+(area_width/2), yy +5, title, -1, area_width-20, 2, 2, 0) + draw_text_ext_transformed(xx+(w/2), yy +5, title, -1, w-20, 2, 2, 0) draw_set_halign(fa_left); draw_set_color(c_gray); - draw_text_ext(xx+10, yy+40,body,-1,area_width-20); + draw_text_ext(xx+10, yy+40,body,-1,w-20); } pop_draw_return_values(); return "done"; diff --git a/scripts/scr_enemy_ai_e/scr_enemy_ai_e.gml b/scripts/scr_enemy_ai_e/scr_enemy_ai_e.gml index 7764e2e567..dfd8ff2246 100644 --- a/scripts/scr_enemy_ai_e/scr_enemy_ai_e.gml +++ b/scripts/scr_enemy_ai_e/scr_enemy_ai_e.gml @@ -603,7 +603,8 @@ function scr_enemy_ai_e() { halfpop = p_max_population[run] / 2; if (array_length(p_feature[run])) { - var planet_data = new PlanetData(run, self); + var _planet_data = new PlanetData(run, self); + _planet_data = system_datas[run]; // Transforming billions pop number to a real number so the code can handle it // Otherwise, 3 and a half billions get translated as 3,50 instead of 3500000000 @@ -644,7 +645,9 @@ function scr_enemy_ai_e() { } } } - } + } + _planet_data.refresh_data(); + _planet_data.check_old_battles_feature(); } // End p_feature!="" diff --git a/scripts/scr_forge_world_functions/scr_forge_world_functions.gml b/scripts/scr_forge_world_functions/scr_forge_world_functions.gml index 34e2b21182..bfa768544a 100644 --- a/scripts/scr_forge_world_functions/scr_forge_world_functions.gml +++ b/scripts/scr_forge_world_functions/scr_forge_world_functions.gml @@ -25,52 +25,73 @@ function imperial_navy_fleet_construction(){ //if system needs more navy fleets get forge world to make some } else if (navy_fleet_count=0;i--){ + var _sys = _forge_systems[i]; + var good=true; + for(var o=1; o<=_sys.planets; o++) { + + if (_sys[p_type] == "Forge"){ + var _nearest = instance_nearest(x,y,obj_en_fleet) + if (_nearest.x ==x && _nearest.y==y && _nearest.navy){ + good=false; + break; + } + } + } + + if (!good){ + array_delete(_forge_systems,i,1); + } + } // After initial navy fleet construction fleet growth is handled in obj_en_fleet.alarm_5 if (array_length(forge_systems)){ - var construction_forge,new_navy_fleet; + var construction_forge; construction_forge = array_random_element(forge_systems); build_new_navy_fleet(construction_forge) } } } +function get_imperium_forge_systems(){ + var forge_systems = []; + with(obj_star){ + var good=false; + for(var o=1; o<=planets; o++) { + if (p_type[o]=="Forge") + and (p_owner[o]==eFACTION.Mechanicus) + and (p_orks[o]+p_tau[o]+p_tyranids[o]+p_chaos[o]+p_traitors[o]+p_necrons[o]==0) { + + var enemy_fleets = [ + eFACTION.Ork, + eFACTION.Tau, + eFACTION.Tyranids, + eFACTION.Chaos, + eFACTION.Necrons + ] + + var enemy_fleet_count = array_reduce(enemy_fleets, function(prev, curr) { + return prev + present_fleet[curr] + }); + + good = enemy_fleet_count<=0; + } + if (good){ + break; + } + } + if (good){ + good = x<=room_width && y<=room_height; + } + if (good){ + array_push(forge_systems, id); + } + } + return forge_systems; +} + function build_planet_defence_fleets(){ imp_ships=0; var _defence_fleet_log = {}; diff --git a/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml b/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml new file mode 100644 index 0000000000..6a9982643e --- /dev/null +++ b/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml @@ -0,0 +1,22 @@ +function spawn_mechanicus_explore_fleet(){ + + var _forges = get_imperium_forge_systems(); + if (!array_length(_forges)){ + return -1; + } + + var _forge = array_random_element(_forges); + var _fleet = instance_create(_forge.x, _forge.y, obj_en_fleet); + + with (_fleet){ + owner = eFACTION.Mechanicus; + warp_able = true; + capital_number = 2; + frigate_number = 5; + escort_number = 20; + navy = 0; + choose_fleet_sprite_image(); + } + + return _fleet; +} \ No newline at end of file diff --git a/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.yy b/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.yy new file mode 100644 index 0000000000..da0672f643 --- /dev/null +++ b/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.yy @@ -0,0 +1,13 @@ +{ + "$GMScript":"v1", + "%Name":"scr_mechanicus_fleet_functions", + "isCompatibility":false, + "isDnD":false, + "name":"scr_mechanicus_fleet_functions", + "parent":{ + "name":"fleet", + "path":"folders/Scripts/fleet.yy", + }, + "resourceType":"GMScript", + "resourceVersion":"2.0", +} \ No newline at end of file diff --git a/scripts/scr_planetary_feature/scr_planetary_feature.gml b/scripts/scr_planetary_feature/scr_planetary_feature.gml index 2d0cb37711..6dbccdf88e 100644 --- a/scripts/scr_planetary_feature/scr_planetary_feature.gml +++ b/scripts/scr_planetary_feature/scr_planetary_feature.gml @@ -69,7 +69,7 @@ function NewPlanetFeature(feature_type, other_data={}) constructor{ break; case P_features.OldBattleGround: player_hidden = true; - imperium_known = false + imperium_known = false; //This is janky but we have no way of defining non player astartes faction1 = "astartes"; faction2 = "imperium"; @@ -77,7 +77,7 @@ function NewPlanetFeature(feature_type, other_data={}) constructor{ break; case P_features.Secret_Base: base_type = base_types.Lair; - inquis_hidden =1; + inquis_hidden = 1; planet_display = "Hidden Secret Base"; player_hidden = 0; style = "UTL"; diff --git a/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml b/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml index 47c4b41318..2b2a4d1801 100644 --- a/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml +++ b/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml @@ -31,6 +31,14 @@ function init_player_fleet_arrays(){ ship_turrets=[]; ship_lost = []; } + +function get_player_fleet_intercept_time(star,time_abundance){ + var _travel = -1 + var _nearest_player_fleet = instance_nearest(star.x, star.y, obj_p_fleet); + if (instance_exists(_nearest_player_fleet)){ + _travel = get_viable_travel_time(time_abundance, _nearest_player_fleet.x, _nearest_player_fleet.y, star.x, star.y, _nearest_fleet, false); + } +} function fleet_has_roles(fleet="none", roles){ var all_ships = fleet_full_ship_array(fleet); var unit; diff --git a/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml b/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml index fb21493ebe..8d195ef717 100644 --- a/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml +++ b/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml @@ -1,14 +1,14 @@ // Script assets have changed for v2.3.0 see -// https://help.yoyogames.com/hc/en-us/articles/360005277377 for more information +// https : //help.yoyogames.com/hc/en-us/articles/360005277377 for more information function UnitQuickFindPanel() constructor{ main_panel = new DataSlate(); garrison_log = {}; ship_count = 0; tab_buttons = { - "fleets":new MainMenuButton(spr_ui_but_3, spr_ui_hov_3), - "garrisons":new MainMenuButton(spr_ui_but_3, spr_ui_hov_3), - "hider":new MainMenuButton(spr_ui_but_3, spr_ui_hov_3), - "missions":new MainMenuButton(spr_ui_but_3, spr_ui_hov_3), + "fleets" : new MainMenuButton(spr_ui_but_3, spr_ui_hov_3), + "garrisons" : new MainMenuButton(spr_ui_but_3, spr_ui_hov_3), + "hider" : new MainMenuButton(spr_ui_but_3, spr_ui_hov_3), + "missions" : new MainMenuButton(spr_ui_but_3, spr_ui_hov_3), } static detail_slate = new DataSlateMKTwo(); @@ -35,11 +35,11 @@ function UnitQuickFindPanel() constructor{ static add_unit_to_garrison_log = function(_unit,unit_location){ if (!struct_exists(garrison_log, unit_location[2])){ garrison_log[$ unit_location[2]] = { - units:[_unit], - vehicles:0, - garrison:false, - healers:0, - techies:0 + units : [_unit], + vehicles : 0, + garrison : false, + healers : 0, + techies : 0 } } else { array_push(garrison_log[$ unit_location[2]].units, _unit); @@ -79,11 +79,11 @@ function UnitQuickFindPanel() constructor{ var _unit = [co, u]; if (!struct_exists(garrison_log, unit_location)){ garrison_log[$ unit_location] = { - units:[_unit], - vehicles:1, - garrison:false, - healers:0, - techies:0 + units : [_unit], + vehicles : 1, + garrison : false, + healers : 0, + techies : 0 } } else { array_push(garrison_log[$ unit_location].units, _unit); @@ -138,10 +138,10 @@ function UnitQuickFindPanel() constructor{ var mission_explain = mission_name_key(problems[p]); if (mission_explain != "none"){ var _data = { - system : name, - mission : mission_explain, - time : p_timer[i][p], - planet : i, + system : name, + mission : mission_explain, + time : p_timer[i][p], + planet : i, }; _data.click_left = method(_data,function(){ @@ -160,10 +160,10 @@ function UnitQuickFindPanel() constructor{ if (mission_explain!="none"){ array_push(temp_log, { - system : "", - mission : mission_explain, - time : obj_controller.quest_end[i] - obj_controller.turn, - planet : 0 + system : "", + mission : mission_explain, + time : obj_controller.quest_end[i] - obj_controller.turn, + planet : 0 } ) } @@ -175,19 +175,19 @@ function UnitQuickFindPanel() constructor{ var _event = events[i]; if (struct_exists(_event, "turn_end")){ switch (_event.turn_end){ - case "deliver_trophy_end_turn_check": + case "deliver_trophy_end_turn_check" : var _mission = $"Deliver Trophy Guard"; var _sys = fleets_next_location(); var _mission_data = { - mission : _mission, - system : _sys.name, - system_id : _sys.id, - target : id, - important_person : _event.fleetevent_data.trophy_owner, - person_name : _event.fleetevent_data.delivering_marine, - planet : 0, - start_system : _event.fleetevent_data.system, - time : _event.timer, + mission : _mission, + system : _sys.name, + system_id : _sys.id, + target : id, + important_person : _event.fleetevent_data.trophy_owner, + person_name : _event.fleetevent_data.delivering_marine, + planet : 0, + start_system : _event.fleetevent_data.system, + time : _event.timer, }; _mission_data.click_left = method(_mission_data,function(){ @@ -217,13 +217,13 @@ function UnitQuickFindPanel() constructor{ mission_log = temp_log; var _data = { - x1 : xx+60, - y1 : yy+50, - y2 : yy + h, - set_column_widths : [80,130], - headings : ["Location", "Mission","Time\nRemaining"], - row_data : mission_log, - row_key_draw : ["system","mission","time"], + x1 : xx+60, + y1 : yy+50, + y2 : yy + h, + set_column_widths : [80,130], + headings : ["Location", "Mission","Time\nRemaining"], + row_data : mission_log, + row_key_draw : ["system","mission","time"], } mission_table = new Table(_data); @@ -420,20 +420,20 @@ function UnitQuickFindPanel() constructor{ }else if (hover_item!="none"){ if point_and_click(hover_item.draw(xx+10, yy+90+(20*hover_item.root_item), "Manage")){ group_selection(garrison_log[$system_names[hover_item.root_item]].units,{ - purpose:$"{system_names[hover_item.root_item]} Management", - purpose_code : "manage", - number:0, - system:star_by_name(system_names[hover_item.root_item]).id, - feature:"none", - planet : 0, - selections : [] + purpose : $"{system_names[hover_item.root_item]} Management", + purpose_code : "manage", + number : 0, + system : star_by_name(system_names[hover_item.root_item]).id, + feature : "none", + planet : 0, + selections : [] }); } } } else if (view_area == "missions"){ mission_table.update({ - x1 : xx+60, - y1 : yy+50, + x1 : xx+60, + y1 : yy+50, }); mission_table.draw(); } @@ -733,7 +733,7 @@ function setup_planet_mission_group(){ } function HelpfulPlaces()constructor{ - main_panel = new DataSlate({draggable:true,cherub:true}); + main_panel = new DataSlate({draggable : true,cherub : true}); var _imperial_help_requests = stars_with_help_requests(); var _help_requests = []; @@ -741,9 +741,9 @@ function HelpfulPlaces()constructor{ for (var i=0;i 0){ var _data = { - system : id, - planet : _forge, - name : planet_numeral_name(_forge), - owner_name : obj_controller.faction[p_owner[_forge]], - owner : p_owner[_forge], - owner_status : obj_controller.faction_status[p_owner[_forge]], + system : id, + planet : _forge, + name : planet_numeral_name(_forge), + owner_name : obj_controller.faction[p_owner[_forge]], + owner : p_owner[_forge], + owner_status : obj_controller.faction_status[p_owner[_forge]], }; _data.click_left = method(_data, function(){ @@ -862,48 +862,48 @@ function HelpfulPlaces()constructor{ array_push(_columns , _longest_name); forges_table = new Table({ - row_key_draw : ["name","owner_name","owner_status"], - headings : ["Name", " Owner ", " Owner\nStatus "], - row_data : _forges, - set_column_widths : _columns, + row_key_draw : ["name","owner_name","owner_status"], + headings : ["Name", " Owner ", " Owner\nStatus "], + row_data : _forges, + set_column_widths : _columns, }); places_radio = new RadioSet([ { - str1 : "Help Requests", + str1 : "Help Requests", }, { - str1 : "Navy Fleets", + str1 : "Navy Fleets", }, { - str1 :"Forge Worlds", + str1 : "Forge Worlds", } ]); main_panel.inside_method = function(){ places_radio.update({ - x1: x1 + 30, - y1: y1 + 25, + x1 : x1 + 30, + y1 : y1 + 25, }); places_radio.draw(); var _new_position = { - x1:x1+40, - y1:y1+50, - y2:y1 + main_panel.height, + x1 : x1+40, + y1 : y1+50, + y2 : y1 + main_panel.height, } switch (places_radio.current_selection){ - case 1: + case 1 : navy_table.update(_new_position); navy_table.draw(); break; - case 0: + case 0 : help_table.update(_new_position); help_table.draw(); break; - case 2: + case 2 : forges_table.update(_new_position); forges_table.draw(); break; From d88535809f2514768fc82d275f333596c1a4d2eb Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Mon, 15 Dec 2025 20:39:38 +0000 Subject: [PATCH 11/31] trouble shoooting --- objects/obj_en_fleet/Alarm_1.gml | 4 +++- objects/obj_en_fleet/Create_0.gml | 2 +- scripts/scr_PlanetData/scr_PlanetData.gml | 2 +- scripts/scr_mission_functions/scr_mission_functions.gml | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/objects/obj_en_fleet/Alarm_1.gml b/objects/obj_en_fleet/Alarm_1.gml index 93ce5b0489..5638eaadee 100644 --- a/objects/obj_en_fleet/Alarm_1.gml +++ b/objects/obj_en_fleet/Alarm_1.gml @@ -346,7 +346,9 @@ else if (action=="" && _is_orbiting){ action_x=plin.x; action_y=plin.y; set_fleet_movement(); - if (n!=5) then good=5; + if (n!=5){ + good=5; + } } } } diff --git a/objects/obj_en_fleet/Create_0.gml b/objects/obj_en_fleet/Create_0.gml index 987ee13358..5bd4e4f684 100644 --- a/objects/obj_en_fleet/Create_0.gml +++ b/objects/obj_en_fleet/Create_0.gml @@ -18,7 +18,7 @@ guardsmen_ratio=0; guardsmen_unloaded=0; complex_route = []; warp_able = false; -ii_check=floor(random(5))+1; +ii_check = floor(random(5))+1; etah=0; safe=0; last_turn_check = 0; diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 69d822f62f..8a8615143b 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -1762,7 +1762,7 @@ function PlanetData(planet, system) constructor{ } - static check_old_battles_feature = functions(){ + static check_old_battles_feature = function(){ if (has_feature(P_features.OldBattleGround)){ var _feats = get_features(P_features.OldBattleGround); for (var i=0;i30 && _roll<70){ //TODO would be cool to have this changed to be a guard specific piece of equipment From 3cc8af0e3d5c106707f606662df7b61689ef8764 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Tue, 16 Dec 2025 00:02:20 +0000 Subject: [PATCH 12/31] problems real problems --- ChapterMaster.yyp | 3 +- objects/obj_controller/CleanUp_0.gml | 10 +- objects/obj_en_fleet/Create_0.gml | 4 +- objects/obj_en_fleet/Draw_0.gml | 153 ++++--- objects/obj_star/Draw_0.gml | 63 ++- scripts/__init_global/__init_global.gml | 1 + .../action_draw_ellipse.gml | 8 + scripts/ds_map_helpers/ds_map_helpers.gml | 21 + scripts/ds_map_helpers/ds_map_helpers.yy | 13 + .../scr_fleet_functions.gml | 379 ++++++++---------- 10 files changed, 364 insertions(+), 291 deletions(-) create mode 100644 scripts/ds_map_helpers/ds_map_helpers.gml create mode 100644 scripts/ds_map_helpers/ds_map_helpers.yy diff --git a/ChapterMaster.yyp b/ChapterMaster.yyp index 227a018050..bf9558d3e3 100644 --- a/ChapterMaster.yyp +++ b/ChapterMaster.yyp @@ -579,7 +579,7 @@ "isEcma":false, "LibraryEmitters":[], "MetaData":{ - "IDEVersion":"2024.1400.0.901", + "IDEVersion":"2024.1400.0.904", }, "name":"ChapterMaster", "resources":[ @@ -728,6 +728,7 @@ {"id":{"name":"DiploCommonComponents","path":"scripts/DiploCommonComponents/DiploCommonComponents.yy",},}, {"id":{"name":"draw_line_dashed","path":"scripts/draw_line_dashed/draw_line_dashed.yy",},}, {"id":{"name":"draw_set_blend_mode","path":"scripts/draw_set_blend_mode/draw_set_blend_mode.yy",},}, + {"id":{"name":"ds_map_helpers","path":"scripts/ds_map_helpers/ds_map_helpers.yy",},}, {"id":{"name":"exp_and_exp_growth","path":"scripts/exp_and_exp_growth/exp_and_exp_growth.yy",},}, {"id":{"name":"explode_script","path":"scripts/explode_script/explode_script.yy",},}, {"id":{"name":"instance_create","path":"scripts/instance_create/instance_create.yy",},}, diff --git a/objects/obj_controller/CleanUp_0.gml b/objects/obj_controller/CleanUp_0.gml index e43d58b1e2..7e592e24d0 100644 --- a/objects/obj_controller/CleanUp_0.gml +++ b/objects/obj_controller/CleanUp_0.gml @@ -1,12 +1,6 @@ global.name_generator = new NameGenerator(); -var _star_arrays = []; -ds_map_values_to_array(global.star_sprites,_star_arrays); -for (var i=0;iroom_width) or (y<0) or (y>room_height) then exit; -if (image_alpha=0) then exit; +if (!point_in_rectangle(x, y, 0, 0, room_width, room_height) || !image_alpha){ + exit; +} var coords = [0,0]; var near_star = instance_nearest(x,y, obj_star); @@ -15,59 +24,104 @@ if (x==near_star.x && y==near_star.y){ var coords = fleet_star_draw_offsets(); } +image_index = min(image_index,9) -if (image_index>9) then image_index=9; +var _scale_x_pos = x+(coords[0]*scale); +var _scale_y_pos = y+(coords[1]*scale); +var _m_dist=point_distance(mouse_x,mouse_y,_scale_x_pos,(_scale_y_pos)); -var m_dist=point_distance(mouse_x,mouse_y,x+(coords[0]*scale),y+((coords[1])*scale+(12*scale))); -var within=false; -if (!obj_controller.zoomed){ - if (m_dist<=16*scale) and (!instance_exists(obj_ingame_menu)) then within=1; -} -if (obj_controller.zoomed=1){ +var _is_zoom = obj_controller.zoomed; + +var _within = _m_dist<=16*scale && !_is_zoom && !instance_exists(obj_ingame_menu); + + +add_draw_return_values(); +if (_is_zoom){ var faction_colour = global.star_name_colors[owner]; draw_set_color(faction_colour); if (owner == eFACTION.Imperium) and (navy=0) then draw_set_alpha(0.5); draw_circle(x,y,12,0); draw_set_alpha(1); - if (m_dist<=16) and (!instance_exists(obj_ingame_menu)) then within=1; + if (_m_dist<=16) and (!instance_exists(obj_ingame_menu)) then _within=1; } -// if (obj_controller.selected!=0) and (selected=1) then within=1; +// if (obj_controller.selected!=0) and (selected=1) then _within=1; -if (obj_controller.selecting_planet>0){ - if (mouse_x>=__view_get( e__VW.XView, 0 )+529) and (mouse_y>=__view_get( e__VW.YView, 0 )+234) and (mouse_x<__view_get( e__VW.XView, 0 )+611) and (mouse_y<__view_get( e__VW.YView, 0 )+249){ - if (instance_exists(obj_star_select)){if (obj_star_select.button1!="") then within=0;} - } - if (mouse_x>=__view_get( e__VW.XView, 0 )+529) and (mouse_y>=__view_get( e__VW.YView, 0 )+234+16) and (mouse_x<__view_get( e__VW.XView, 0 )+611) and (mouse_y<__view_get( e__VW.YView, 0 )+249+16){ - if (instance_exists(obj_star_select)){if (obj_star_select.button2!="") then within=0;} - } - if (mouse_x>=__view_get( e__VW.XView, 0 )+529) and (mouse_y>=__view_get( e__VW.YView, 0 )+234+32) and (mouse_x<__view_get( e__VW.XView, 0 )+611) and (mouse_y<__view_get( e__VW.YView, 0 )+249+32){ - if (instance_exists(obj_star_select)){if (obj_star_select.button3!="") then within=0;} - } +if (obj_controller.selecting_planet>0 && _within){ + _within = scr_void_click(); } - -if (action!=""){ - draw_set_halign(fa_left);draw_set_alpha(1); +if (action != ""){ + draw_set_halign(fa_left); + draw_set_alpha(1); draw_set_color(c_white); draw_line_width(x,y,action_x,action_y,1); // draw_set_font(fnt_40k_14b); - if (obj_controller.zoomed=0) then draw_text_transformed(x+12,y,string_hash_to_newline("ETA "+string(action_eta)),1,1,0); - if (obj_controller.zoomed=1) then draw_text_transformed(x+24,y,string_hash_to_newline("ETA "+string(action_eta)),2,2,0);// was 1.4 + var _tex_scale = obj_controller.zoomed ?2:1; + draw_text_transformed(x+12,y,$"ETA {action_eta}",_tex_scale,_tex_scale,0); } + + switch(owner){ case eFACTION.Ork: - var _has_warboss =false; + var _has_warboss =false; if (fleet_has_cargo("ork_warboss")){ draw_icon = true; _has_warboss = true; } + break; +} +var _reset = false; + +if (last_turn_image_check != obj_controller.turn){ + _reset = true; + +} + +if (ds_map_exists(global.en_fleet_sprites, uid)){ + if (_reset){ + ds_map_delete_sprite(global.en_fleet_sprites, uid); + } +} else { + _reset = true; +} + +if (_reset){ + add_draw_return_values(); + var _fleet_image_surface = surface_create(128, 64); + surface_set_target(_fleet_image_surface); + var faction_colour = global.star_name_colors[owner]; + var _xx = 24; + var _yy = 24; + draw_set_color(faction_colour); + draw_set_alpha(0.5); + draw_circle(_xx,_yy,12,0); + draw_set_alpha(1); + if (navy && owner == eFACTION.Imperium){ + draw_set_color(global.star_name_colors[eFACTION.Mechanicus]); + draw_circle_with_outline_width(); + draw_circle_with_outline_width(_xx,_yy,12,0.3); + } + + if (draw_icon){ + draw_sprite_ext(spr_faction_icons, owner,_xx-32,_yy-32,1,1,0,c_white,1) + } + draw_sprite_ext(sprite_index,image_index,_xx,_yy,1,1,0,c_white,1); + + surface_reset_target(); + + var _new_sprite = sprite_create_from_surface(_fleet_image_surface, 0, 0, surface_get_width(_fleet_image_surface), surface_get_height(_fleet_image_surface), false, false, 0, 0); + + ds_map_set(global.en_fleet_sprites, uid, _new_sprite); + surface_clear_and_free(_fleet_image_surface); + last_turn_image_check = obj_controller.turn; + pop_draw_return_values(); } var fleet_descript=""; -if (within=1) or (selected>0){ +if (_within || selected>0){ draw_set_color(CM_GREEN_COLOR); draw_set_font(fnt_40k_14b); draw_set_halign(fa_center); @@ -129,7 +183,7 @@ if (within=1) or (selected>0){ // if (owner = eFACTION.Imperium) and (navy=1){fleet_descript=string(capital_max_imp[1]+frigate_max_imp[1]+escort_max_imp[1]);} if (global.cheat_debug=true){ - fleet_descript+="C"+string(capital_number)+"|F"+string(frigate_number)+"|E"+string(escort_number); + fleet_descript+=$"C{capital_number}|F{frigate_number}|E{escort_number}"; } // fleet_descript=string(capital_number)+"|"+string(frigate_number)+"|"+string(escort_number); @@ -138,34 +192,13 @@ if (within=1) or (selected>0){ draw_set_halign(fa_left); } -if (fleet_descript!="" && within){ - tooltip_draw(fleet_descript); - draw_circle(x+(coords[0]*scale),y+(coords[1])*scale,12*scale,0); -} else { - var faction_colour = global.star_name_colors[owner]; - draw_set_color(faction_colour); - draw_set_alpha(0.5); - draw_circle(x+(coords[0]*scale),y+(coords[1])*scale,12*scale,0); - draw_set_alpha(1); - if (navy && owner == eFACTION.Imperium){ - draw_set_color(global.star_name_colors[eFACTION.Mechanicus]); - draw_circle(x+(coords[0]*scale),y+(coords[1])*scale,12*scale,1); - draw_circle(x+(coords[0]*scale),y+(coords[1])*scale,12.1*scale,1); - draw_circle(x+(coords[0]*scale),y+(coords[1])*scale,12.2*scale,1); - } -} -if (draw_icon){ - draw_sprite_ext(spr_faction_icons, owner,x+(coords[0]*scale)-(32*scale),y+(coords[1]*scale)-(32*scale),1*scale,1*scale,0,c_white,1) -} -draw_sprite_ext(sprite_index,image_index,x+(coords[0]*scale),y+(coords[1]*scale),1*scale,1*scale,0,c_white,1); - +var _sprite = ds_map_find_value(global.en_fleet_sprites, uid) +draw_sprite_ext(_sprite, 0, _scale_x_pos-(24*scale) , _scale_y_pos-(24*scale), scale, scale, 1, c_white, 1); -/*if (owner = eFACTION.Ork){ - draw_set_font(fnt_small); - draw_set_halign(fa_center); - draw_set_color(c_white); - draw_text(x,y+32,string(escort_number)+"/"+string(frigate_number)+"/"+string(capital_number)); -}*/ +if (fleet_descript!="" && _within){ + tooltip_draw(fleet_descript); + draw_circle(_scale_x_pos,_scale_y_pos,12*scale,0); +} if (instance_exists(target)){ @@ -175,5 +208,7 @@ if (instance_exists(target)){ draw_set_alpha(1); } +pop_draw_return_values(); + /* */ /* */ diff --git a/objects/obj_star/Draw_0.gml b/objects/obj_star/Draw_0.gml index cf103abbff..5f4c8c546b 100644 --- a/objects/obj_star/Draw_0.gml +++ b/objects/obj_star/Draw_0.gml @@ -1,24 +1,42 @@ // Draws the system name and color codes it based on ownership +add_draw_return_values(); if (p_type[1]="Craftworld") and (obj_controller.known[eFACTION.Eldar]=0){ draw_set_alpha(0); draw_set_color(255); draw_circle(old_x,old_y,5,0); draw_set_alpha(1); + pop_draw_return_values(); exit; } var show=name; -if (global.cheat_debug=true) then show=string(name)+"#"+string(p_problem[1,1])+":"+string(p_timer[1,1])+"#"+string(p_problem[1,2])+":"+string(p_timer[1,2])+"#"+string(p_problem[1,3])+":"+string(p_timer[1,3]); +if (global.cheat_debug){ + show = $"{name}"; + for (var i=1;i<=planets;i++){ + for (p=0;p0) then draw_sprite_ext(spr_warp_storm,storm_image,x,y,0.75*scale,0.75*scale,0,c_white,1); +if (storm>0){ + draw_sprite_ext(spr_warp_storm,storm_image,x,y,0.75*scale,0.75*scale,0,c_white,1); +} //ad hoc way of determining whether stuff is in view or not...needs work @@ -44,38 +62,39 @@ if (global.load == -1 && (obj_controller.zoomed || in_camera_view(star_box_shape } if (ds_map_exists(global.star_sprites, name)){ - var _old_sprite = ds_map_find_value(global.star_sprites, name); - if (sprite_exists(_old_sprite)){ - if (_reset){ - sprite_delete(_old_sprite); - } - } else { - _reset = true; - } if (_reset){ - ds_map_delete(global.star_sprites, name); + ds_map_delete_sprite(global.star_sprites, name); } } else { _reset = true; } + if (_reset){ - star_tag_surface = surface_create(256, 128); + var star_tag_surface = surface_create(256, 128); var xx=64; var yy=0; surface_set_target(star_tag_surface); - var panel_width = string_width(name) + 60; + + var _name_width = string_width(name); + + var _panel_width = _name_width + 60; + + var _panel_center = xx-(_panel_width/2); + + var _panel_y = yy + 30; + if (owner != eFACTION.Player ){ var _faction_index = owner; var faction_colour = global.star_name_colors[_faction_index]; - draw_sprite_general(spr_p_name_bg, 0, 0, 0, string_width(name) + 60, 32, xx-(panel_width/2), yy+30, 1, 1, 0, faction_colour, faction_colour, faction_colour, faction_colour, 1); - draw_sprite_ext(spr_faction_icons,_faction_index,xx+(panel_width/2)-30,yy+25, 0.60, 0.60, 0, c_white, 1); + draw_sprite_general(spr_p_name_bg, 0, 0, 0, _panel_width, 32, _panel_center, _panel_y, 1, 1, 0, faction_colour, faction_colour, faction_colour, faction_colour, 1); + draw_sprite_ext(spr_faction_icons,_faction_index,xx+(_panel_width/2)-30,yy+25, 0.60, 0.60, 0, c_white, 1); } else { scr_shader_initialize(); var main_color = make_colour_from_array(obj_controller.body_colour_replace); var right_pauldron = make_colour_from_array(obj_controller.pauldron_colour_replace); - draw_sprite_general(spr_p_name_bg, 0, 0, 0, string_width(name) + 60, 32, xx-(panel_width/2), yy+30, 1, 1, 0, main_color, main_color, right_pauldron, right_pauldron, 1); + draw_sprite_general(spr_p_name_bg, 0, 0, 0, _panel_width, 32, _panel_center, _panel_y, 1, 1, 0, main_color, main_color, right_pauldron, right_pauldron, 1); var faction_sprite = global.chapter_icon.sprite; - draw_sprite_ext(faction_sprite,0,xx+(panel_width/2)-30,yy+30, 0.2, 0.2, 0, c_white, 1); + draw_sprite_ext(faction_sprite,0,_panel_center-30,_panel_y, 0.2, 0.2, 0, c_white, 1); //context.set_vertical_gradient(main_color, right_pauldron); //draw_text_ext_transformed_color(gx + xoffset,gy + yoffset,text,sep,owner.width,xscale,yscale,angle ,col1, col2, col3, col4, alpha); } @@ -90,6 +109,8 @@ if (global.load == -1 && (obj_controller.zoomed || in_camera_view(star_box_shape var _sprite = ds_map_find_value(global.star_sprites, name) draw_sprite_ext(_sprite, 0, x-(64*scale), y, scale, scale, 1, c_white, 1); } -draw_set_valign(fa_top) +draw_set_valign(fa_top); + +pop_draw_return_values(); diff --git a/scripts/__init_global/__init_global.gml b/scripts/__init_global/__init_global.gml index 5ffa35cd09..927f1913bb 100644 --- a/scripts/__init_global/__init_global.gml +++ b/scripts/__init_global/__init_global.gml @@ -42,5 +42,6 @@ function __init_global() { global.ui_click_lock = false; global.name_generator = new NameGenerator(); global.star_sprites = ds_map_create(); + global.en_fleet_sprites = ds_map_create(); global.base_component_surface = -1; } diff --git a/scripts/action_draw_ellipse/action_draw_ellipse.gml b/scripts/action_draw_ellipse/action_draw_ellipse.gml index 97ccdf0dc5..6475d0e821 100644 --- a/scripts/action_draw_ellipse/action_draw_ellipse.gml +++ b/scripts/action_draw_ellipse/action_draw_ellipse.gml @@ -22,3 +22,11 @@ function action_draw_ellipse(argument0, argument1, argument2, argument3, argumen } + + +function draw_circle_with_outline_width(xx,yy,r,w){ + for (var i=0.0;i0){// 135 ; guardsmen onto planet - var en_p,en_planets,land,i; - i=0;en_planets=0;land=0; - - if (sta.x=home_x) and (sta.y=home_y){ - repeat(4){i+=1; - en_p[i]=0; - if (sta.p_owner[i]<=5){en_p[i]=1;en_planets+=1;} - } - - if (guardsmen>0) and (en_planets>0){ - land=floor(guardsmen/en_planets); - i=0; - repeat(4){i+=1; - if (en_p[i]=1){guardsmen-=land;sta.p_guardsmen[i]+=land;} - } - if (guardsmen<5) then guardsmen=0; - } - } - if (sta.owner>5) or ((sta.owner = eFACTION.Player) and (obj_controller.faction_status[eFACTION.Imperium]="War")){ - repeat(4){i+=1; - en_p[i]=0; - if (sta.p_player[i]>0) and (obj_controller.faction_status[eFACTION.Imperium]="War"){en_p[i]=1;en_planets+=1;} - } - - if (guardsmen>0) and (en_planets>0){ - land=floor(guardsmen/en_planets); - i=0; - repeat(4){i+=1; - if (en_p[i]=1){guardsmen-=land;sta.p_guardsmen[i]+=land;} - } - if (guardsmen<5) then guardsmen=0; - } - } - }*/ - if (owner= eFACTION.Inquisition){ @@ -785,7 +750,9 @@ function fleet_arrival_logic(){ if (instance_exists(obj_p_ship)){ var p_ship=instance_nearest(x,y,obj_p_ship); if (p_ship.action="") and (point_distance(x,y,p_ship.x,p_ship.y)<80){ - if (obj_controller.p_known[8]=0) then obj_controller.p_known[8]=1; + if (obj_controller.p_known[8]=0){ + obj_controller.p_known[8]=1; + } } } } @@ -797,16 +764,10 @@ function fleet_arrival_logic(){ if (point_distance(plap.x,plap.y,action_x,action_y)<80) then mess=0; } - if (mess=1) and (sta.vision!=0){ - scr_alert("red","owner",$"Contact has been lost with {sta.name}!",sta.x,sta.y); - scr_event_log("red",$"Contact has been lost with {sta.name}.");sta.vision=0;} + if (mess=1) and (orbiting.vision!=0){ + scr_alert("red","owner",$"Contact has been lost with {orbiting.name}!",orbiting.x,orbiting.y); + scr_event_log("red",$"Contact has been lost with {orbiting.name}.");orbiting.vision=0;} } - action_x=0; - action_y=0; - - - - // 135 ; fleet chase @@ -815,159 +776,161 @@ function fleet_arrival_logic(){ } - old_x=x;old_y=y; - x=-100;y=-100; - - cur_star=instance_nearest(old_x,old_y,obj_en_fleet); - var mergus=false; - - mergus=cur_star.image_index; - if (mergus<3) then mergus=0; - if (mergus>=3) then mergus=10; - if (owner = eFACTION.Tau) and (mergus>=3) then mergus=0; - if (string_count("_her",trade_goods)=0) then mergus=99;// was 999 - - // Think this might be causing the crash - if (owner=eFACTION.Tau) and (sta.present_fleet[eFACTION.Imperium]+sta.present_fleet[eFACTION.Player]>=1) - and (sta.present_fleet[eFACTION.Tau]=1) and (image_index=1) and (ret=0) then mergus=15; - if (cur_star.owner=eFACTION.Tau) and (owner=eFACTION.Tau) and (ret=1) then mergus=0; - - - - - if (owner=eFACTION.Tau) and (image_index=1){ - // show_message("Tau||| Other Owner: "+string(cur_star.owner)+" ret: "+string(ret)+" mergus: "+string(mergus)); - } - - if (owner=eFACTION.Chaos) and (fleet_has_cargo("csm")) or ( fleet_has_cargo("warband")){ - mergus=0; - } - // if (cur_star.owner!=owner) then mergus=0; - - - - - if (cur_star.x=old_x) and (cur_star.y=old_y) and (cur_star.owner=self.owner) and (cur_star.action="") and (mergus=1999){// Merge the fleets - cur_star.escort_number+=self.escort_number; - cur_star.frigate_number+=self.frigate_number;// show_message("Tau fleet merging"); - cur_star.capital_number+=self.capital_number; - cur_star.guardsmen+=self.guardsmen; - - - - cur_star=instance_nearest(old_x,old_y,obj_star); - // if (cur_star.present_fleets>=1) then cur_star.present_fleets-=1; - if (owner = eFACTION.Tau){obj_controller.tau_fleets-=1;cur_star.tau_fleets-=1;} - if (owner = eFACTION.Chaos) then obj_controller.chaos_fleets-=1; - - instance_destroy(); - }// End merge fleets - - - - if (owner=eFACTION.Tau) and (mergus=15){ // Get the fuck out - var new_star, stue;new_star=0;stue=0;ret=1; - - - instance_activate_object(obj_star);// new_star - stue=instance_nearest(x,y,obj_star); - - - - if (image_index=1){// Start influence thing - var tau_influence; - var tau_influence_chance=irandom(100)+1; - var tau_influence_planet=irandom(stue.planets)+1; - - with (stue){ - if (p_type[tau_influence_planet]!="Dead"){ - - scr_alert("green","owner",$"Tau ship broadcasts subversive messages to {planet_numeral_name(tau_influence_planet)}.",sta.x,sta.y); - tau_influence = p_influence[tau_influence_planet][eFACTION.Tau] - - if (tau_influence_chance<=70) and (tau_influence<70){ - adjust_influence[tau_influence_planet](eFACTION.Tau, 10, tau_influence_planet); - if (p_type[tau_influence_planet]=="Forge") then adjust_influence(eFACTION.Tau, -5, tau_influence_planet); - } - - if (tau_influence_chance<=3) and (tau_influence<70){ - adjust_influence(eFACTION.Tau, 30, tau_influence_planet); - if (p_type[tau_influence_planet]=="Forge") then adjust_influence(eFACTION.Tau, -25, tau_influence_planet); - } - } - } - } - - - - instance_deactivate_object(stue); - - with(obj_star){ - if (owner != eFACTION.Tau) then instance_deactivate_object(instance_id); - } - - var good;good=0; - - repeat(100){ - var xx, yy; - if (good=0){ - xx=x+choose(random(300),random(300)*-1); - yy=y+choose(random(300),random(300)*-1); - new_star=instance_nearest(xx,yy,obj_star); - if (new_star.owner!=eFACTION.Tau) then with(new_star){instance_deactivate_object(id);} - if (new_star.owner=eFACTION.Tau) then good=1; - } - } - - // show_message("Get the fuck out working?: "+string(good)); - - if (new_star.owner=eFACTION.Tau){ - // show_message("Tau fleet actually fleeing"); - action_x=new_star.x; - action_y=new_star.y; - set_fleet_movement(); - } - - instance_activate_object(obj_star); - // This appears bugged - } - - - - - - - x=old_x; - y=old_y; - - var _csm = fleet_has_cargo("warband"); + var old_x=x,old_y=y; + var _other_orbiting = []; + var _id = id; + with (obj_en_fleet){ + if (x!=old_x || y!=old_y){ + continue; + } + if (_id==id ){ + continue; + } + + array_push(_other_orbiting,id); - if (cur_star.x=old_x) and (cur_star.y=old_y) and (cur_star.owner=self.owner) and (cur_star.action="") and ((owner = eFACTION.Tau) or (owner = eFACTION.Chaos)) and (mergus=10) and (!_csm){// Move somewhere new - var stue, stue2;stue=0;stue2=0; - var goood=0; - - with(obj_star){ - if (is_dead_star()){ - instance_deactivate_object(id); - } - } - stue=instance_nearest(x,y,obj_star); - instance_deactivate_object(stue); - repeat(10){ - if (goood=0){ - stue2=instance_nearest(x+choose(random(400),random(400)*-1),y+choose(random(400),random(400)*-1),obj_star); - if (owner = eFACTION.Tau) and (stue2.owner = eFACTION.Tau) then goood=1; - if (owner = eFACTION.Chaos) and (stue2.owner != eFACTION.Chaos) then goood=1; - if (stue2.planets=0) then goood=0; - if (stue.present_fleet[eFACTION.Imperium]>0) or (stue.present_fleet[eFACTION.Player]>0) then goood=0; - if (stue2.planets=1) and (stue2.p_type[1]="Dead") then goood=0; - } - } - action_x=stue2.x; - action_y=stue2.y; - set_fleet_movement();// stue.present_fleets-=1; - instance_activate_object(obj_star); } + + for (var i=0;i=3) then mergus=10; + if (owner = eFACTION.Tau) and (mergus>=3) then mergus=0; + if (string_count("_her",trade_goods)=0) then mergus=99;// was 999 + + // Think this might be causing the crash + if (owner=eFACTION.Tau) and (sta.present_fleet[eFACTION.Imperium]+sta.present_fleet[eFACTION.Player]>=1) + and (sta.present_fleet[eFACTION.Tau]=1 && image_index=1) and (ret=0) then mergus=15; + + if (_other_fleet.owner=eFACTION.Tau) and (owner=eFACTION.Tau) and (ret=1) then mergus=0; + + + + + if (owner=eFACTION.Tau) and (image_index=1){ + // show_message("Tau||| Other Owner: "+string(cur_star.owner)+" ret: "+string(ret)+" mergus: "+string(mergus)); + } + + if (owner=eFACTION.Chaos) and (fleet_has_cargo("csm")) or ( fleet_has_cargo("warband")){ + mergus=0; + } + // if (cur_star.owner!=owner) then mergus=0; + + + + + //This will never trigger at the moment + if ((_other_fleet.owner=self.owner) and (_other_fleet.action="") and (mergus=1999){// Merge the fleets + merge_fleets(id,_other_fleet) + + }// End merge fleets + + + + if (owner=eFACTION.Tau) and (mergus=15){ // Get the fuck out + var new_star;new_star=0;ret=1; + + + instance_activate_object(obj_star);// new_star + + + + if (image_index=1){// Start influence thing + + with (orbiting){ + var tau_influence; + var tau_influence_chance=irandom(100)+1; + var tau_influence_planet=irandom(orbiting.planets)+1; + if (p_type[tau_influence_planet]!="Dead"){ + + scr_alert("green","owner",$"Tau ship broadcasts subversive messages to {planet_numeral_name(tau_influence_planet)}.",sta.x,sta.y); + tau_influence = p_influence[tau_influence_planet][eFACTION.Tau] + + if (tau_influence_chance<=70) and (tau_influence<70){ + adjust_influence[tau_influence_planet](eFACTION.Tau, 10, tau_influence_planet); + if (p_type[tau_influence_planet]=="Forge"){ + adjust_influence(eFACTION.Tau, -5, tau_influence_planet); + } + } + + if (tau_influence_chance<=3) and (tau_influence<70){ + adjust_influence(eFACTION.Tau, 30, tau_influence_planet); + if (p_type[tau_influence_planet]=="Forge"){ + adjust_influence(eFACTION.Tau, -25, tau_influence_planet); + } + } + } + } + } + + + + instance_deactivate_object(orbiting); + + with(obj_star){ + if (owner != eFACTION.Tau) then instance_deactivate_object(instance_id); + } + + var good=0; + + repeat(100){ + var xx, yy; + if (good=0){ + xx=x+choose(random(300),random(300)*-1); + yy=y+choose(random(300),random(300)*-1); + new_star=instance_nearest(xx,yy,obj_star); + if (new_star.owner!=eFACTION.Tau) then with(new_star){instance_deactivate_object(id);} + if (new_star.owner=eFACTION.Tau) then good=1; + } + } + + // show_message("Get the fuck out working?: "+string(good)); + + if (new_star.owner==eFACTION.Tau){ + // show_message("Tau fleet actually fleeing"); + action_x=new_star.x; + action_y=new_star.y; + set_fleet_movement(); + } + + instance_activate_object(obj_star); + // This appears bugged + } + + var _csm = fleet_has_cargo("warband"); + + if (cur_star.x=old_x) and (cur_star.y=old_y) and (cur_star.owner=self.owner) and (cur_star.action="") and ((owner = eFACTION.Tau) or (owner = eFACTION.Chaos)) and (mergus=10) and (!_csm){// Move somewhere new + var stue, stue2;stue=0;stue2=0; + var goood=0; + + with(obj_star){ + if (is_dead_star()){ + instance_deactivate_object(id); + } + } + stue=instance_nearest(x,y,obj_star); + instance_deactivate_object(stue); + repeat(10){ + if (goood=0){ + stue2=instance_nearest(x+choose(random(400),random(400)*-1),y+choose(random(400),random(400)*-1),obj_star); + if (owner = eFACTION.Tau) and (stue2.owner = eFACTION.Tau) then goood=1; + if (owner = eFACTION.Chaos) and (stue2.owner != eFACTION.Chaos) then goood=1; + if (stue2.planets=0) then goood=0; + if (stue.present_fleet[eFACTION.Imperium]>0) or (stue.present_fleet[eFACTION.Player]>0) then goood=0; + if (stue2.planets=1) and (stue2.p_type[1]="Dead") then goood=0; + } + } + action_x=stue2.x; + action_y=stue2.y; + set_fleet_movement();// stue.present_fleets-=1; + instance_activate_object(obj_star); + } + } + // ORKS @@ -1031,8 +994,6 @@ function fleet_arrival_logic(){ instance_activate_object(obj_star); } - - exit;// end of eta=0 } function choose_fleet_sprite_image(){ @@ -1068,6 +1029,22 @@ function merge_fleets(main_fleet, merge_fleet){ main_fleet.cargo_data[$ _merge_cargo[i]] = merge_fleet.cargo_data[$ _merge_cargo[i]]; } } + main_fleet.guardsmen += merge_fleet.guardsmen; + + //This bit allseems a bit superfluouse but keepingjust in case it breaks something + switch(merge_fleet.owner){ + var _is_orbiting = is_orbiting(merge_fleet); + case eFACTION.Tau: + obj_controller.tau_fleets--; + if (_is_orbiting){ + merge_fleet.orbiting.tau_fleets--; + } + break; + case eFACTION.Chaos: + obj_controller.chaos_fleets--; + break; + + } instance_destroy(merge_fleet.id); } From 6a17fd039cbdf5300eb7e4b2fe2f7b6e73f5d016 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Tue, 16 Dec 2025 00:10:08 +0000 Subject: [PATCH 13/31] centralise fleet strength calc --- objects/obj_en_fleet/Alarm_1.gml | 2 +- objects/obj_en_fleet/Step_0.gml | 7 ++----- scripts/scr_PlanetData/scr_PlanetData.gml | 5 +---- scripts/scr_enemy_ai_c/scr_enemy_ai_c.gml | 6 +++--- scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml | 2 +- .../scr_forge_world_functions.gml | 2 +- .../scr_imperial_navy_functions.gml | 15 ++++----------- .../scr_ork_fleet_functions.gml | 2 +- .../scr_player_fleet_functions.gml | 5 +---- 9 files changed, 15 insertions(+), 31 deletions(-) diff --git a/objects/obj_en_fleet/Alarm_1.gml b/objects/obj_en_fleet/Alarm_1.gml index 93ce5b0489..8419676d77 100644 --- a/objects/obj_en_fleet/Alarm_1.gml +++ b/objects/obj_en_fleet/Alarm_1.gml @@ -329,7 +329,7 @@ else if (action=="" && _is_orbiting){ new_fleet.image_index=1; /*with(new_fleet){ - var ii;ii=0;ii+=capital_number;ii+=round((frigate_number/2));ii+=round((escort_number/4)); + var ii=floor(standard_fleet_strength_calc()); if (ii<=1) then ii=1;image_index=ii; }*/ diff --git a/objects/obj_en_fleet/Step_0.gml b/objects/obj_en_fleet/Step_0.gml index 00144c38dc..3e55ade5f0 100644 --- a/objects/obj_en_fleet/Step_0.gml +++ b/objects/obj_en_fleet/Step_0.gml @@ -31,16 +31,13 @@ if (ii_check=0){ ii_check=10; if (owner != eFACTION.Eldar) and (owner != eFACTION.Inquisition){ - var ii=0; - ii+=capital_number; - ii+=round((frigate_number/2)); - ii+=round((escort_number/4)); + var ii=round(standard_fleet_strength_calc()); if (ii<=1) then ii=1; image_index=ii; image_index=min(image_index,9); } if (owner = eFACTION.Eldar){ - var ii;ii=0;ii+=capital_number;ii+=round((frigate_number/2));ii+=round((escort_number/4)); + var ii=round(standard_fleet_strength_calc()); if (ii<=1) then ii=1;image_index=ii; image_index=min(image_index,5); } diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 96dc83e039..c1385bfe75 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -418,10 +418,7 @@ function PlanetData(planet, system) constructor{ } } - var ii=0; - ii+=capital_number; - ii+=round((frigate_number/2)); - ii+=round((escort_number/4)); + var ii=round(standard_fleet_strength_calc()); if (ii<=1) then ii=1; image_index=ii; //if big enough flee bugger off to new star diff --git a/scripts/scr_enemy_ai_c/scr_enemy_ai_c.gml b/scripts/scr_enemy_ai_c/scr_enemy_ai_c.gml index 33b4d73bf4..373a02512e 100644 --- a/scripts/scr_enemy_ai_c/scr_enemy_ai_c.gml +++ b/scripts/scr_enemy_ai_c/scr_enemy_ai_c.gml @@ -117,7 +117,7 @@ function scr_enemy_ai_c() { } /*if (fleet!=0){ if (instance_exists(fleet)) then with(fleet){ - var ii;ii=0;ii+=capital_number;ii+=round((frigate_number/2));ii+=round((escort_number/4)); + var ii=round(standard_fleet_strength_calc()); if (ii<=1) then ii=1;image_index=ii; } }*/ @@ -319,7 +319,7 @@ function scr_enemy_ai_c() { } /*if (fleet!=0){ if (instance_exists(fleet)) then with(fleet){ - var ii;ii=0;ii+=capital_number;ii+=round((frigate_number/2));ii+=round((escort_number/4)); + var ii=round(standard_fleet_strength_calc()); if (ii<=1) then ii=1;image_index=ii; } }*/ @@ -343,7 +343,7 @@ function scr_enemy_ai_c() { if (p_type[i]="Death") or (p_type[i]="Hive") then ship.capital_number+=choose(0,1,1); ship.capital_number+=1; ship.escort_number+=3; - ship.image_index=floor((ship.capital_number)+(ship.frigate_number/2)+(ship.escort_number/4)); + ship.image_index=round(standard_fleet_strength_calc()); p_type[i]="Dead"; delete_features(p_feature[i], P_features.Reclamation_pools);// show_message("D"); if (planets=1) and (p_type[1]="Dead") then image_alpha=0.33; diff --git a/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml b/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml index 974fb2790c..9af3f039dd 100644 --- a/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml +++ b/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml @@ -283,7 +283,7 @@ function scr_enemy_ai_d() { fleet.frigate_number=round(random_range(4,8)); fleet.escort_number=round(random_range(8,18));*/ - fleet.image_index=floor((fleet.capital_number)+(fleet.frigate_number/2)+(fleet.escort_number/4)); + fleet.image_index=round(standard_fleet_strength_calc()); fleet.image_alpha=0; fleet.action_x=x; diff --git a/scripts/scr_forge_world_functions/scr_forge_world_functions.gml b/scripts/scr_forge_world_functions/scr_forge_world_functions.gml index cb8caf3b9e..09dc9a0264 100644 --- a/scripts/scr_forge_world_functions/scr_forge_world_functions.gml +++ b/scripts/scr_forge_world_functions/scr_forge_world_functions.gml @@ -72,7 +72,7 @@ function build_planet_defence_fleets(){ var _defence_fleet_log = {}; with(obj_en_fleet){ if (owner==eFACTION.Imperium){ - var _imperial_fleet_defence_score = capital_number + (frigate_number/2) + (escort_number/4); + var _imperial_fleet_defence_score = round(standard_fleet_strength_calc()); obj_controller.imp_ships += _imperial_fleet_defence_score; //log this to prevent double work later figuring out if a planet has an orbiting defence fleet if (!navy && action=="" && is_orbiting()){ diff --git a/scripts/scr_imperial_navy_functions/scr_imperial_navy_functions.gml b/scripts/scr_imperial_navy_functions/scr_imperial_navy_functions.gml index 0fa27ee7f9..b1b4d0335c 100644 --- a/scripts/scr_imperial_navy_functions/scr_imperial_navy_functions.gml +++ b/scripts/scr_imperial_navy_functions/scr_imperial_navy_functions.gml @@ -127,9 +127,7 @@ function build_new_navy_fleet(construction_forge){ navy=1; var total_ships=0; - total_ships+=capital_number-1; - total_ships+=round((frigate_number/2)); - total_ships+=round((escort_number/4)); + total_ships+=round(standard_fleet_strength_calc()); if (total_ships<=1 && capital_number+frigate_number+escort_number>0) then total_ships=1; choose_fleet_sprite_image() image_index=total_ships; @@ -178,10 +176,7 @@ function new_navy_ships_forge(){ if (capital_number>1) then capital_number=1; } if (onceh=1){ - var ii=0; - ii+=capital_number; - ii+=round((frigate_number/2)); - ii+=round((escort_number/4)); + var ii=round(standard_fleet_strength_calc()); image_index=ii<=1?1:ii; } @@ -1047,10 +1042,8 @@ function setup_start_imperial_navy_fleet(system){ warp_able=true; image_speed=0; - ii+=capital_number-1; - ii+=round((frigate_number/2)); - ii+=round((escort_number/4)); - if (ii<=1) and (capital_number+frigate_number+escort_number>0){ + ii+=round(standard_fleet_strength_calc()); + if (ii<=1) and (ii>0){ ii=1; } image_index=ii; diff --git a/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml b/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml index 566029cad3..c8c782ed21 100644 --- a/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml +++ b/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml @@ -76,7 +76,7 @@ function ork_fleet_arrive_target(){ } } if (ork_attack_planet>0){ - p_tyranids[ork_attack_planet] -= floor(_ork_fleet.capital_number+(_ork_fleet.frigate_number/2)); + p_tyranids[ork_attack_planet] -= round(standard_fleet_strength_calc()); var _pdata = new PlanetData(ork_attack_planet, self); diff --git a/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml b/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml index 47c4b41318..a5a217c8b5 100644 --- a/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml +++ b/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml @@ -239,10 +239,7 @@ function delete_ship_from_fleet(index, fleet){ } } function set_player_fleet_image(){ - var ii=0; - ii+=capital_number; - ii+=round((frigate_number/2)); - ii+=round((escort_number/4)); + var ii=round(standard_fleet_strength_calc()) if (ii<=1) then ii=1; image_index=min(ii,9); } From e5474a5caec58d87b2274866878bff4bb2441462 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Tue, 16 Dec 2025 19:03:13 +0000 Subject: [PATCH 14/31] hoperfyully sort tau fleets --- objects/obj_en_fleet/Draw_0.gml | 1 - scripts/scr_Table/scr_Table.gml | 6 +- .../scr_fleet_functions.gml | 226 ++++++++---------- .../scr_system_search_helpers.gml | 28 ++- .../spr_fleet_imperial/spr_fleet_imperial.yy | 45 ++-- sprites/spr_fleet_tau/spr_fleet_tau.yy | 49 ++-- 6 files changed, 192 insertions(+), 163 deletions(-) diff --git a/objects/obj_en_fleet/Draw_0.gml b/objects/obj_en_fleet/Draw_0.gml index 0f0b116620..6c18729c02 100644 --- a/objects/obj_en_fleet/Draw_0.gml +++ b/objects/obj_en_fleet/Draw_0.gml @@ -101,7 +101,6 @@ if (_reset){ draw_set_alpha(1); if (navy && owner == eFACTION.Imperium){ draw_set_color(global.star_name_colors[eFACTION.Mechanicus]); - draw_circle_with_outline_width(); draw_circle_with_outline_width(_xx,_yy,12,0.3); } diff --git a/scripts/scr_Table/scr_Table.gml b/scripts/scr_Table/scr_Table.gml index 9bf8884c25..7b5c562ba9 100644 --- a/scripts/scr_Table/scr_Table.gml +++ b/scripts/scr_Table/scr_Table.gml @@ -18,9 +18,7 @@ function Table(data) constructor{ move_data_to_current_scope(data); - update(); - - static update = function(data){ + static update = function(data={}){ move_data_to_current_scope(data); w = 0; column_widths = []; @@ -60,7 +58,7 @@ function Table(data) constructor{ w += column_widths[i] + col_spacing; } } - + update(); static draw = function(){ add_draw_return_values(); diff --git a/scripts/scr_fleet_functions/scr_fleet_functions.gml b/scripts/scr_fleet_functions/scr_fleet_functions.gml index 3a89e39fbb..365f907a12 100644 --- a/scripts/scr_fleet_functions/scr_fleet_functions.gml +++ b/scripts/scr_fleet_functions/scr_fleet_functions.gml @@ -624,6 +624,8 @@ function fleet_arrival_logic(){ action_x=0; action_y=0; is_orbiting(); + + arrival_logic_finished = false; // cur_star.present_fleets+=1;if (owner = eFACTION.Tau) then cur_star.tau_fleets+=1; @@ -791,145 +793,129 @@ function fleet_arrival_logic(){ } + var _fleet_strength = standard_fleet_strength_calc(); for (var i=0;i=3) then mergus=10; - if (owner = eFACTION.Tau) and (mergus>=3) then mergus=0; - if (string_count("_her",trade_goods)=0) then mergus=99;// was 999 - - // Think this might be causing the crash - if (owner=eFACTION.Tau) and (sta.present_fleet[eFACTION.Imperium]+sta.present_fleet[eFACTION.Player]>=1) - and (sta.present_fleet[eFACTION.Tau]=1 && image_index=1) and (ret=0) then mergus=15; - if (_other_fleet.owner=eFACTION.Tau) and (owner=eFACTION.Tau) and (ret=1) then mergus=0; - - - + var _other_fleet_strength=standard_fleet_strength_calc(_other_fleet); + - if (owner=eFACTION.Tau) and (image_index=1){ - // show_message("Tau||| Other Owner: "+string(cur_star.owner)+" ret: "+string(ret)+" mergus: "+string(mergus)); + var _same_owner = owner == _other_fleet.owner; + + var _attempt_merge = _same_owner && _other_fleet_strength + _fleet_strength <= 9; + + if (_same_owner && !_attempt_merge && owner==eFACTION){ + var _faction_check = obj_controller.faction_status[eFACTION.Mechanicus]=="War"?1:2; + var _len = _faction_check == 1?3:4 + if (array_sum(orbiting.present_fleet,0,_faction_check,_len)>0){ + _attempt_merge=true; + } + } - + + if (string_count("_her",trade_goods)=0){ + _attempt_merge = false; + } + if (owner=eFACTION.Chaos) and (fleet_has_cargo("csm")) or ( fleet_has_cargo("warband")){ - mergus=0; + var _csm = fleet_has_cargo("warband"); + _attempt_merge = false; } - // if (cur_star.owner!=owner) then mergus=0; + + // if (cur_star.owner!=owner) then _other_fleet_strength=0; //This will never trigger at the moment - if ((_other_fleet.owner=self.owner) and (_other_fleet.action="") and (mergus=1999){// Merge the fleets + if (_attempt_merge){// Merge the fleets merge_fleets(id,_other_fleet) }// End merge fleets - - - if (owner=eFACTION.Tau) and (mergus=15){ // Get the fuck out - var new_star;new_star=0;ret=1; - - - instance_activate_object(obj_star);// new_star - - - - if (image_index=1){// Start influence thing - - with (orbiting){ - var tau_influence; - var tau_influence_chance=irandom(100)+1; - var tau_influence_planet=irandom(orbiting.planets)+1; - if (p_type[tau_influence_planet]!="Dead"){ - - scr_alert("green","owner",$"Tau ship broadcasts subversive messages to {planet_numeral_name(tau_influence_planet)}.",sta.x,sta.y); - tau_influence = p_influence[tau_influence_planet][eFACTION.Tau] - - if (tau_influence_chance<=70) and (tau_influence<70){ - adjust_influence[tau_influence_planet](eFACTION.Tau, 10, tau_influence_planet); - if (p_type[tau_influence_planet]=="Forge"){ - adjust_influence(eFACTION.Tau, -5, tau_influence_planet); - } - } - - if (tau_influence_chance<=3) and (tau_influence<70){ - adjust_influence(eFACTION.Tau, 30, tau_influence_planet); - if (p_type[tau_influence_planet]=="Forge"){ - adjust_influence(eFACTION.Tau, -25, tau_influence_planet); - } - } - } - } - } - - - - instance_deactivate_object(orbiting); - - with(obj_star){ - if (owner != eFACTION.Tau) then instance_deactivate_object(instance_id); - } - - var good=0; - - repeat(100){ - var xx, yy; - if (good=0){ - xx=x+choose(random(300),random(300)*-1); - yy=y+choose(random(300),random(300)*-1); - new_star=instance_nearest(xx,yy,obj_star); - if (new_star.owner!=eFACTION.Tau) then with(new_star){instance_deactivate_object(id);} - if (new_star.owner=eFACTION.Tau) then good=1; - } + + //if fleet is damaged but existing fleet is too large to merge feck off elsewhere preferably somewhere friendly + else if (_same_owner && (owner == eFACTION.Tau || (owner = eFACTION.Chaos && !csm))){// Move somewhere new + + var _chosen =false; + var _chosen_id = nearest_star_with_ownership(x,y,owner,orbiting,true,true); + while (_chosen_id != "none"){ + if (scr_orbiting_fleet(eFACTION.Imperium) != "none"){ + _chosen_id = nearest_star_with_ownership(x,y,owner,orbiting,true,true); + } else { + break; + } } - - // show_message("Get the fuck out working?: "+string(good)); - - if (new_star.owner==eFACTION.Tau){ - // show_message("Tau fleet actually fleeing"); - action_x=new_star.x; - action_y=new_star.y; - set_fleet_movement(); + + instance_activate_object(obj_star); + if (_chosen_id !="none"){ + action_x=_chosen_id.x; + action_y=_chosen_id.y; + set_fleet_movement(); + arrival_logic_finished = true; } - - instance_activate_object(obj_star); - // This appears bugged - } - var _csm = fleet_has_cargo("warband"); + //TODO somelogc to go find somewhere else if there are no avialable rebuild planets + } + } - if (cur_star.x=old_x) and (cur_star.y=old_y) and (cur_star.owner=self.owner) and (cur_star.action="") and ((owner = eFACTION.Tau) or (owner = eFACTION.Chaos)) and (mergus=10) and (!_csm){// Move somewhere new - var stue, stue2;stue=0;stue2=0; - var goood=0; - - with(obj_star){ - if (is_dead_star()){ - instance_deactivate_object(id); + if (owner=eFACTION.Tau && !arrival_logic_finished) { + + + //so i'mjust sort of crudely interpreting things how i think duke meant to make it + //basically if the tau fleet is weakened or small instead of trying a hostile takeover + //they instrsd instigste a tau propaganda campaign and get the fuck out the system + + //if tau fleet is too weak then flee + if (standard_fleet_strength_calc()<3){// Start influence thing + + with (orbiting){ + var tau_influence; + var tau_influence_chance=roll_dice(1,100,"high"); + var tau_influence_planet=irandom(orbiting.planets)+1; + if (p_type[tau_influence_planet]!="Dead"){ + + scr_alert("green","owner",$"Tau ship broadcasts subversive messages to {planet_numeral_name(tau_influence_planet)}.",sta.x,sta.y); + tau_influence = p_influence[tau_influence_planet][eFACTION.Tau] + + if (tau_influence_chance<=70) and (tau_influence<70){ + adjust_influence[tau_influence_planet](eFACTION.Tau, 10, tau_influence_planet); + if (p_type[tau_influence_planet]=="Forge"){ + adjust_influence(eFACTION.Tau, -5, tau_influence_planet); + } + } + + if (tau_influence_chance<=3) and (tau_influence<70){ + adjust_influence(eFACTION.Tau, 30, tau_influence_planet); + if (p_type[tau_influence_planet]=="Forge"){ + adjust_influence(eFACTION.Tau, -25, tau_influence_planet); + } + } + } + } + var _chosen =false; + var _chosen_id = nearest_star_with_ownership(x,y,owner,orbiting,true,true); + while (_chosen_id != "none"){ + if (scr_orbiting_fleet(eFACTION.Imperium) != "none"){ + _chosen_id = nearest_star_with_ownership(x,y,owner,orbiting,true,true); + } else { + break; } } - stue=instance_nearest(x,y,obj_star); - instance_deactivate_object(stue); - repeat(10){ - if (goood=0){ - stue2=instance_nearest(x+choose(random(400),random(400)*-1),y+choose(random(400),random(400)*-1),obj_star); - if (owner = eFACTION.Tau) and (stue2.owner = eFACTION.Tau) then goood=1; - if (owner = eFACTION.Chaos) and (stue2.owner != eFACTION.Chaos) then goood=1; - if (stue2.planets=0) then goood=0; - if (stue.present_fleet[eFACTION.Imperium]>0) or (stue.present_fleet[eFACTION.Player]>0) then goood=0; - if (stue2.planets=1) and (stue2.p_type[1]="Dead") then goood=0; - } - } - action_x=stue2.x; - action_y=stue2.y; - set_fleet_movement();// stue.present_fleets-=1; - instance_activate_object(obj_star); - } - } + + instance_activate_object(obj_star); + if (_chosen_id !="none"){ + action_x=_chosen_id.x; + action_y=_chosen_id.y; + set_fleet_movement(); + arrival_logic_finished = true; + } + } + + + } + + @@ -940,7 +926,7 @@ function fleet_arrival_logic(){ // If the connected planet is owned by orks then choose a random one within 400 not owned by orks - if (owner == eFACTION.Ork){ + else if (owner == eFACTION.Ork){ if (is_orbiting()){ with (orbiting){ ork_fleet_arrive_target(); @@ -1031,9 +1017,9 @@ function merge_fleets(main_fleet, merge_fleet){ } main_fleet.guardsmen += merge_fleet.guardsmen; - //This bit allseems a bit superfluouse but keepingjust in case it breaks something + //This bit allseems a bit superfluouse but keepingjust in case it breaks something] + var _is_orbiting = is_orbiting(merge_fleet); switch(merge_fleet.owner){ - var _is_orbiting = is_orbiting(merge_fleet); case eFACTION.Tau: obj_controller.tau_fleets--; if (_is_orbiting){ diff --git a/scripts/scr_system_search_helpers/scr_system_search_helpers.gml b/scripts/scr_system_search_helpers/scr_system_search_helpers.gml index c7d3ad3fee..f8b8a3999f 100644 --- a/scripts/scr_system_search_helpers/scr_system_search_helpers.gml +++ b/scripts/scr_system_search_helpers/scr_system_search_helpers.gml @@ -320,7 +320,7 @@ function nearest_star_proper(xx,yy) { } -function nearest_star_with_ownership(xx,yy, ownership, start_star="none", ignore_dead = true){ +function nearest_star_with_ownership(xx,yy, ownership, start_star="none", ignore_dead = true,keep_deactivated=false){ var nearest = "none" var _deactivated = []; var total_stars = instance_number(obj_star); @@ -328,29 +328,39 @@ function nearest_star_with_ownership(xx,yy, ownership, start_star="none", ignore if (!is_array(ownership)){ ownership = [ownership]; } + deactivate = function(deactiv_id){ + array_push(_deactivated, deactiv_id.id); + instance_deactivate_object(deactiv_id.id); + } while (nearest=="none" && i":"","Keyframes":[ - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"7ed3ac9a-c1a3-4966-8c07-799101e9fca6","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"f2227933-b8bc-4bf6-9d8e-524410250dc7","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"cdb72c37-035a-45e6-9261-6bb7235b36d0","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"1746812c-c63b-415d-b459-f12dc9208349","IsCreationKey":false,"Key":1.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"b70d4f7d-d6e5-4417-a451-df64b6cc0dfc","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"edc14729-eece-4ed2-8dfc-a5f8c7dfe38b","IsCreationKey":false,"Key":2.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"7c517f52-18b0-4ce3-907a-266b27998f5e","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"da9e9585-4af5-4c8f-bf1e-b0865913f48c","IsCreationKey":false,"Key":3.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"7e369ca2-e39c-4f3a-95cf-1f7ece113915","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"e924ab6f-120a-498b-80ba-78f1ec0f34fe","IsCreationKey":false,"Key":4.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"83e2105e-06f4-433a-b155-899860422247","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"6e7f9699-c511-43fb-b4aa-f01b6cb66560","IsCreationKey":false,"Key":5.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"7b33f482-c952-4a96-ae8e-fc3c743bb25f","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"8cfe88df-f523-462d-bcf6-20f2367cf625","IsCreationKey":false,"Key":6.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"948a2eb0-29bf-4b0d-8710-2641375e304c","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"e41b6128-03e4-490c-be0e-4c177c1dcfaa","IsCreationKey":false,"Key":7.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"c527feba-1ebf-430b-bcce-57c3998dd2ba","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"38bd26a6-a925-4d86-8cc1-91d1fa137e25","IsCreationKey":false,"Key":8.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"3a21b19b-398c-43ca-98e1-b7cbeafd021a","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"212d7172-82b2-47e9-95c1-fb55d943413e","IsCreationKey":false,"Key":9.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"7ed3ac9a-c1a3-4966-8c07-799101e9fca6","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"f2227933-b8bc-4bf6-9d8e-524410250dc7","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"cdb72c37-035a-45e6-9261-6bb7235b36d0","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"1746812c-c63b-415d-b459-f12dc9208349","IsCreationKey":false,"Key":1.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"b70d4f7d-d6e5-4417-a451-df64b6cc0dfc","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"edc14729-eece-4ed2-8dfc-a5f8c7dfe38b","IsCreationKey":false,"Key":2.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"7c517f52-18b0-4ce3-907a-266b27998f5e","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"da9e9585-4af5-4c8f-bf1e-b0865913f48c","IsCreationKey":false,"Key":3.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"7e369ca2-e39c-4f3a-95cf-1f7ece113915","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"e924ab6f-120a-498b-80ba-78f1ec0f34fe","IsCreationKey":false,"Key":4.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"83e2105e-06f4-433a-b155-899860422247","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"6e7f9699-c511-43fb-b4aa-f01b6cb66560","IsCreationKey":false,"Key":5.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"7b33f482-c952-4a96-ae8e-fc3c743bb25f","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"8cfe88df-f523-462d-bcf6-20f2367cf625","IsCreationKey":false,"Key":6.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"948a2eb0-29bf-4b0d-8710-2641375e304c","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"e41b6128-03e4-490c-be0e-4c177c1dcfaa","IsCreationKey":false,"Key":7.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"c527feba-1ebf-430b-bcce-57c3998dd2ba","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"38bd26a6-a925-4d86-8cc1-91d1fa137e25","IsCreationKey":false,"Key":8.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"3a21b19b-398c-43ca-98e1-b7cbeafd021a","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"212d7172-82b2-47e9-95c1-fb55d943413e","IsCreationKey":false,"Key":9.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, ],"resourceType":"KeyframeStore","resourceVersion":"2.0",},"modifiers":[],"name":"frames","resourceType":"GMSpriteFramesTrack","resourceVersion":"2.0","spriteId":null,"trackColour":0,"tracks":[],"traits":0,}, ], - "visibleRange":{ - "x":0.0, - "y":0.0, - }, + "visibleRange":null, "volume":1.0, "xorigin":11, "yorigin":11, diff --git a/sprites/spr_fleet_tau/spr_fleet_tau.yy b/sprites/spr_fleet_tau/spr_fleet_tau.yy index 3e3b10899a..ea24ba85e3 100644 --- a/sprites/spr_fleet_tau/spr_fleet_tau.yy +++ b/sprites/spr_fleet_tau/spr_fleet_tau.yy @@ -78,23 +78,42 @@ "timeUnits":1, "tracks":[ {"$GMSpriteFramesTrack":"","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"$KeyframeStore":"","Keyframes":[ - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"cdd4c365-a564-4c95-85ab-bda104c5d5e1","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"1641c7b0-ba32-46a1-bdef-7751da95e1c5","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"95d93dc5-c7db-4369-b68a-31026d5959fc","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"b1f176e9-a3cc-4a3b-94bf-ade7ddc106a3","IsCreationKey":false,"Key":1.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"617ee12d-133c-4e96-ba8d-93535804252d","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"1051b8c3-13b3-4b12-909d-886c3a09de27","IsCreationKey":false,"Key":2.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"06e6544f-caed-4f40-8705-c7108e508215","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"195aff74-b345-485c-8c41-640d808b3d87","IsCreationKey":false,"Key":3.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"3e69a52d-25e9-4c9b-89b5-80990b84fd94","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"a06bc4eb-65c2-4824-b12e-4b2594e8cdc6","IsCreationKey":false,"Key":4.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"1a9a662c-67fe-4cdf-bdbf-c87e0070a330","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"a5c0c0a4-63b3-43bc-8743-90cbd113bcb7","IsCreationKey":false,"Key":5.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"bb9a18cc-c332-4f49-86d2-1dd6b6a501ca","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"4c0c4440-a668-4464-9e1c-647382b2af86","IsCreationKey":false,"Key":6.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"a28eb7be-b330-4c6f-a971-0412e89f9546","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"21ad7732-67d7-4445-a580-dc99939fd767","IsCreationKey":false,"Key":7.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"6faa2ba4-5a83-4f02-8506-0aed83da2623","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"8c836550-2c0b-4ff6-bdf5-db3f343e1f8c","IsCreationKey":false,"Key":8.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"93464d16-aa98-4c7b-83a4-f5f56f3bf632","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"621a69a7-bcaa-4299-821f-7014d3b98d91","IsCreationKey":false,"Key":9.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"4f6782bd-e559-446b-9cfb-76c842cac2e6","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"ed6f8cbd-bba9-4119-b444-6aa8e37e6443","IsCreationKey":false,"Key":10.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"cdd4c365-a564-4c95-85ab-bda104c5d5e1","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"1641c7b0-ba32-46a1-bdef-7751da95e1c5","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"95d93dc5-c7db-4369-b68a-31026d5959fc","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"b1f176e9-a3cc-4a3b-94bf-ade7ddc106a3","IsCreationKey":false,"Key":1.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"617ee12d-133c-4e96-ba8d-93535804252d","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"1051b8c3-13b3-4b12-909d-886c3a09de27","IsCreationKey":false,"Key":2.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"06e6544f-caed-4f40-8705-c7108e508215","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"195aff74-b345-485c-8c41-640d808b3d87","IsCreationKey":false,"Key":3.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"3e69a52d-25e9-4c9b-89b5-80990b84fd94","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"a06bc4eb-65c2-4824-b12e-4b2594e8cdc6","IsCreationKey":false,"Key":4.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"1a9a662c-67fe-4cdf-bdbf-c87e0070a330","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"a5c0c0a4-63b3-43bc-8743-90cbd113bcb7","IsCreationKey":false,"Key":5.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"bb9a18cc-c332-4f49-86d2-1dd6b6a501ca","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"4c0c4440-a668-4464-9e1c-647382b2af86","IsCreationKey":false,"Key":6.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"a28eb7be-b330-4c6f-a971-0412e89f9546","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"21ad7732-67d7-4445-a580-dc99939fd767","IsCreationKey":false,"Key":7.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"6faa2ba4-5a83-4f02-8506-0aed83da2623","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"8c836550-2c0b-4ff6-bdf5-db3f343e1f8c","IsCreationKey":false,"Key":8.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"93464d16-aa98-4c7b-83a4-f5f56f3bf632","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"621a69a7-bcaa-4299-821f-7014d3b98d91","IsCreationKey":false,"Key":9.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"4f6782bd-e559-446b-9cfb-76c842cac2e6","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"ed6f8cbd-bba9-4119-b444-6aa8e37e6443","IsCreationKey":false,"Key":10.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, ],"resourceType":"KeyframeStore","resourceVersion":"2.0",},"modifiers":[],"name":"frames","resourceType":"GMSpriteFramesTrack","resourceVersion":"2.0","spriteId":null,"trackColour":0,"tracks":[],"traits":0,}, ], - "visibleRange":{ - "x":0.0, - "y":0.0, - }, + "visibleRange":null, "volume":1.0, "xorigin":11, "yorigin":11, From fe1edb7f8bf3a1305cc6f9f685f06d0fd32f8995 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Tue, 16 Dec 2025 20:06:35 +0000 Subject: [PATCH 15/31] swapped and or --- objects/obj_en_fleet/Alarm_1.gml | 2 +- objects/obj_en_fleet/Step_0.gml | 9 +-- .../scr_fleet_functions.gml | 68 ++++++++++++------- .../scr_system_search_helpers.gml | 22 +++--- 4 files changed, 57 insertions(+), 44 deletions(-) diff --git a/objects/obj_en_fleet/Alarm_1.gml b/objects/obj_en_fleet/Alarm_1.gml index 8419676d77..f4fa173031 100644 --- a/objects/obj_en_fleet/Alarm_1.gml +++ b/objects/obj_en_fleet/Alarm_1.gml @@ -29,7 +29,7 @@ if (_khorne_cargo && owner=eFACTION.Chaos) { if (_is_orbiting) { turns_static++; - if (turns_static>5 && owner==eFACTION.Ork){ + if (turns_static>5 && owner == eFACTION.Ork){ if (!irandom(7)){ ork_fleet_move(); _is_orbiting=false; diff --git a/objects/obj_en_fleet/Step_0.gml b/objects/obj_en_fleet/Step_0.gml index 3e55ade5f0..32da6fd92f 100644 --- a/objects/obj_en_fleet/Step_0.gml +++ b/objects/obj_en_fleet/Step_0.gml @@ -115,14 +115,7 @@ if (owner = eFACTION.Tyranids) and (trade_goods=""){ } if (global.load>=0){ - if (owner = eFACTION.Imperium) then sprite_index=spr_fleet_imperial; - if (owner = eFACTION.Mechanicus) then sprite_index=spr_fleet_mechanicus; - if (owner = eFACTION.Inquisition) then sprite_index=spr_fleet_inquisition; - if (owner = eFACTION.Eldar) then sprite_index=spr_fleet_eldar; - if (owner = eFACTION.Ork) then sprite_index=spr_fleet_ork; - if (owner = eFACTION.Tau) then sprite_index=spr_fleet_tau; - if (owner = eFACTION.Tyranids) then sprite_index=spr_fleet_tyranid; - if (owner = eFACTION.Chaos) then sprite_index=spr_fleet_chaos; + choose_fleet_sprite_image(); } if (image_index=0) then image_index=1; diff --git a/scripts/scr_fleet_functions/scr_fleet_functions.gml b/scripts/scr_fleet_functions/scr_fleet_functions.gml index 365f907a12..4d975634f8 100644 --- a/scripts/scr_fleet_functions/scr_fleet_functions.gml +++ b/scripts/scr_fleet_functions/scr_fleet_functions.gml @@ -14,7 +14,19 @@ function distribute_strength_to_fleet(strength, fleet){ } } + +function standard_fleet_strength_calc(fleet = "none"){ + if (fleet == "none"){ + return capital_number + (frigate_number/2) + (escort_number/4); + } else { + with (fleet){ + return standard_fleet_strength_calc(); + } + } +} + //to be run within with scope +//@mixin obj_en_fleet function set_fleet_target(targ_x, targ_y, final_target){ action_x = targ_x; action_y = targ_y; @@ -708,7 +720,7 @@ function fleet_arrival_logic(){ if (fleet_has_cargo("ork_warboss")) cancel=true; if (fleet_has_cargo("csm")) then cancel=true; - if (!cancel && ((trade_goods!="return" && owner!=eFACTION.Tyranids && owner!=eFACTION.Chaos) || (fleet_has_cargo("player_goods")))){ + if (!cancel && ((trade_goods!="return" && owner!=eFACTION.Tyranids && owner!=eFACTION.Chaos) && (fleet_has_cargo("player_goods")))){ if (scr_efleet_arrive_at_trade_loc()){ exit; } @@ -794,7 +806,7 @@ function fleet_arrival_logic(){ } var _fleet_strength = standard_fleet_strength_calc(); - for (var i=0;i0){ _attempt_merge=true; } } - if (string_count("_her",trade_goods)=0){ + if (!string_count("_her",trade_goods)){ _attempt_merge = false; } @@ -837,25 +849,31 @@ function fleet_arrival_logic(){ //if fleet is damaged but existing fleet is too large to merge feck off elsewhere preferably somewhere friendly else if (_same_owner && (owner == eFACTION.Tau || (owner = eFACTION.Chaos && !csm))){// Move somewhere new - var _chosen =false; - var _chosen_id = nearest_star_with_ownership(x,y,owner,orbiting,true,true); - while (_chosen_id != "none"){ - if (scr_orbiting_fleet(eFACTION.Imperium) != "none"){ - _chosen_id = nearest_star_with_ownership(x,y,owner,orbiting,true,true); - } else { - break; - } - } + if (standard_fleet_strength_calc()<3){ + + var _chosen =false; + var _chosen_id = nearest_star_with_ownership(x,y,owner,orbiting,true,true); + while (_chosen_id != "none"){ + if (scr_orbiting_fleet(eFACTION.Imperium) != "none"){ + _chosen_id = nearest_star_with_ownership(x,y,owner,orbiting,true,true); + } else { + break; + } + } + + instance_activate_object(obj_star); + if (_chosen_id !="none"){ + action_x=_chosen_id.x; + action_y=_chosen_id.y; + set_fleet_movement(); + arrival_logic_finished = true; + } + + //TODO somelogc to go find somewhere else if there are no avialable rebuild planets + } else { - instance_activate_object(obj_star); - if (_chosen_id !="none"){ - action_x=_chosen_id.x; - action_y=_chosen_id.y; - set_fleet_movement(); - arrival_logic_finished = true; + _chosen_id = nearest_star_with_ownership(x,y,[2,3,4,5,7],orbiting); } - - //TODO somelogc to go find somewhere else if there are no avialable rebuild planets } } @@ -910,7 +928,7 @@ function fleet_arrival_logic(){ set_fleet_movement(); arrival_logic_finished = true; } - } + } } @@ -980,6 +998,8 @@ function fleet_arrival_logic(){ instance_activate_object(obj_star); } + + show_debug_message($"fleet orbiting {instance_nearest(x,y,obj_star)} : {obj_controller.faction[owner]}: cur_targ {target}"); } function choose_fleet_sprite_image(){ diff --git a/scripts/scr_system_search_helpers/scr_system_search_helpers.gml b/scripts/scr_system_search_helpers/scr_system_search_helpers.gml index f8b8a3999f..c01f98ee72 100644 --- a/scripts/scr_system_search_helpers/scr_system_search_helpers.gml +++ b/scripts/scr_system_search_helpers/scr_system_search_helpers.gml @@ -268,25 +268,25 @@ function shuffled_planet_array(){ /// ignoring any that are disqualified by the exclusion conditions. function distance_removed_star(origional_x,origional_y, star_offset = choose(2,3), disclude_hulk=true, disclude_elder=true, disclude_deads=true, warp_concious=true){ var from = instance_nearest(origional_x,origional_y,obj_star); - var _deactivated = []; + var deactivated = []; for(var i=0; i Date: Tue, 16 Dec 2025 22:55:06 +0000 Subject: [PATCH 16/31] abstracrt and clean up --- ChapterMaster.yyp | 1 + .../scr_fleet_functions.gml | 28 ++----------------- .../scr_tau_fleet_functions.gml | 27 ++++++++++++++++++ .../scr_tau_fleet_functions.yy | 13 +++++++++ 4 files changed, 44 insertions(+), 25 deletions(-) create mode 100644 scripts/scr_tau_fleet_functions/scr_tau_fleet_functions.gml create mode 100644 scripts/scr_tau_fleet_functions/scr_tau_fleet_functions.yy diff --git a/ChapterMaster.yyp b/ChapterMaster.yyp index bf9558d3e3..bd0743b2f6 100644 --- a/ChapterMaster.yyp +++ b/ChapterMaster.yyp @@ -934,6 +934,7 @@ {"id":{"name":"scr_system_spawn_functions","path":"scripts/scr_system_spawn_functions/scr_system_spawn_functions.yy",},}, {"id":{"name":"scr_Table","path":"scripts/scr_Table/scr_Table.yy",},}, {"id":{"name":"scr_target","path":"scripts/scr_target/scr_target.yy",},}, + {"id":{"name":"scr_tau_fleet_functions","path":"scripts/scr_tau_fleet_functions/scr_tau_fleet_functions.yy",},}, {"id":{"name":"scr_text_hit","path":"scripts/scr_text_hit/scr_text_hit.yy",},}, {"id":{"name":"scr_thought","path":"scripts/scr_thought/scr_thought.yy",},}, {"id":{"name":"scr_tooltip_draw","path":"scripts/scr_tooltip_draw/scr_tooltip_draw.yy",},}, diff --git a/scripts/scr_fleet_functions/scr_fleet_functions.gml b/scripts/scr_fleet_functions/scr_fleet_functions.gml index 4d975634f8..5483bb4bfc 100644 --- a/scripts/scr_fleet_functions/scr_fleet_functions.gml +++ b/scripts/scr_fleet_functions/scr_fleet_functions.gml @@ -809,7 +809,7 @@ function fleet_arrival_logic(){ for (var i=0;i Date: Tue, 16 Dec 2025 22:57:29 +0000 Subject: [PATCH 17/31] Documentation and notes --- scripts/scr_fleet_functions/scr_fleet_functions.gml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/scr_fleet_functions/scr_fleet_functions.gml b/scripts/scr_fleet_functions/scr_fleet_functions.gml index 5483bb4bfc..7d71c046f0 100644 --- a/scripts/scr_fleet_functions/scr_fleet_functions.gml +++ b/scripts/scr_fleet_functions/scr_fleet_functions.gml @@ -790,6 +790,8 @@ function fleet_arrival_logic(){ } + //interactions and merging with other already present fleets + var old_x=x,old_y=y; var _other_orbiting = []; var _id = id; From ef1ecbbd672b9f04f56cbcd66609db101aa08b35 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Tue, 16 Dec 2025 23:49:54 +0000 Subject: [PATCH 18/31] better handlingof mech exploretion fleets --- scripts/scr_PlanetData/scr_PlanetData.gml | 32 +++++++++++++------ .../scr_apothecary_ground.gml | 18 +++++++++-- scripts/scr_cheatcode/scr_cheatcode.gml | 6 ++-- .../scr_draw_planet_features.gml | 2 +- .../scr_planetary_feature.gml | 6 ++++ 5 files changed, 49 insertions(+), 15 deletions(-) diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 361f42020c..020fc86563 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -1762,21 +1762,35 @@ function PlanetData(planet, system) constructor{ static check_old_battles_feature = function(){ if (has_feature(P_features.OldBattleGround)){ var _feats = get_features(P_features.OldBattleGround); + for (var i=0;i0){ @@ -286,7 +291,14 @@ function apothecary_simple(){ with (cur_system){ if (array_length(p_feature[p])!=0){ var _planet_data = new PlanetData(p, self); - _planet_data.recover_starship(cur_techs); + if (_cur_unit_count){ + _planet_data.search_old_battle_grounds(cur_units); + } + + if (cur_tech_count){ + _planet_data.recover_starship(cur_techs); + } + if (_planet_data.planet_training(_loc_heal_points)){ } diff --git a/scripts/scr_cheatcode/scr_cheatcode.gml b/scripts/scr_cheatcode/scr_cheatcode.gml index 7a1d6c21a9..afb1d9e899 100644 --- a/scripts/scr_cheatcode/scr_cheatcode.gml +++ b/scripts/scr_cheatcode/scr_cheatcode.gml @@ -384,7 +384,6 @@ function scr_cheatcode(argument0) { case "forgemastermeet": var _forge_master = scr_role_count("Forge Master", "", "units"); if (array_length(_forge_master)>0){ - show_debug_message("meet forge master"); obj_controller.menu_lock = false; instance_destroy(obj_popup_dialogue); scr_toggle_diplomacy(); @@ -392,7 +391,6 @@ function scr_cheatcode(argument0) { obj_controller.character_diplomacy = _forge_master[0]; diplo_txt="Greetings chapter master"; } else { - show_debug_message("no forge master"); } break; } @@ -471,6 +469,10 @@ function draw_planet_debug_features(){ e_num : P_features.Starship, name : "Ancient Starship" }, + { + e_num : P_features.OldBattleGround, + name : "Old Battle Ground" + }, ] diff --git a/scripts/scr_draw_planet_features/scr_draw_planet_features.gml b/scripts/scr_draw_planet_features/scr_draw_planet_features.gml index 8547b15923..2b1b656ba3 100644 --- a/scripts/scr_draw_planet_features/scr_draw_planet_features.gml +++ b/scripts/scr_draw_planet_features/scr_draw_planet_features.gml @@ -161,7 +161,7 @@ function FeatureSelected(Feature, system, planet) constructor{ case P_features.OldBattleGround: generic=true; title = "Old Battlefield"; - body = "The site of a previously unrecorded battle between {feature.faction1} and {feature.faction2} forces long forgotten"; + body = "The site of a previously unrecorded battle between {feature.faction1} and {feature.faction2} forces long forgotten\nUnload Marines to search Techmarines are advisable to help, it would be best any tech priests not be aware of such an operation it may create a conflict of interest"; case P_features.STC_Fragment: generic=true; title = "STC Fragment"; diff --git a/scripts/scr_planetary_feature/scr_planetary_feature.gml b/scripts/scr_planetary_feature/scr_planetary_feature.gml index 6dbccdf88e..6a7dd29f1d 100644 --- a/scripts/scr_planetary_feature/scr_planetary_feature.gml +++ b/scripts/scr_planetary_feature/scr_planetary_feature.gml @@ -73,6 +73,7 @@ function NewPlanetFeature(feature_type, other_data={}) constructor{ //This is janky but we have no way of defining non player astartes faction1 = "astartes"; faction2 = "imperium"; + explore_size = irandom_range(1000, 10000); explored = 0; break; case P_features.Secret_Base: @@ -380,6 +381,11 @@ function scr_planetary_feature(planet_num) { case P_features.OrkWarboss: var lop=$"Ork Warboss discovered on {numeral_n}."; scr_alert("red","feature",lop,x,y); + scr_event_log("red",lop); + break; + case P_features.OldBattleGround: + var lop=$"Old Battle Ground discovered on {numeral_n}."; + scr_alert("green","feature",lop,x,y); scr_event_log("red",lop); break; } From 49d3d02ec046775dcea3a388949dae0641cbf560 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Wed, 17 Dec 2025 00:21:30 +0000 Subject: [PATCH 19/31] start marine bits --- scripts/scr_PlanetData/scr_PlanetData.gml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 020fc86563..45846a969a 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -658,6 +658,15 @@ function PlanetData(planet, system) constructor{ return _training_happend; }; + static search_old_battle_grounds(){ + if (!has_feature(P_features.OldBattleGround)){ + exit; + } + + var _battle = get_features(P_features.OldBattleGround)[0]; + } + + static recover_starship = function(techs){ try { var engineer_count = array_length(techs); @@ -1773,7 +1782,7 @@ function PlanetData(planet, system) constructor{ if (owner != eFACTION.Mechanicus){ continue; } - if (instance_exists(target) &&target.id== _sys.id){ + if (instance_exists(target) && target.id== _sys.id){ _fleet_enroute = true; } } From 6c157e9fa7a2f38cc0b43fb5ac350d93cbb31901 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Wed, 17 Dec 2025 01:37:21 +0000 Subject: [PATCH 20/31] syntax error --- scripts/scr_PlanetData/scr_PlanetData.gml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 45846a969a..207bc3831a 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -658,7 +658,7 @@ function PlanetData(planet, system) constructor{ return _training_happend; }; - static search_old_battle_grounds(){ + static search_old_battle_grounds = function(){ if (!has_feature(P_features.OldBattleGround)){ exit; } From 9f0747c177466a60cdbe485d451f255b4f50e8e5 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Wed, 17 Dec 2025 23:50:15 +0000 Subject: [PATCH 21/31] beast hunt maximum flavour --- objects/obj_controller/Alarm_5.gml | 7 +- objects/obj_star/Draw_0.gml | 3 +- objects/obj_star_select/Draw_64.gml | 48 ++++---- scripts/instance_create/instance_create.gml | 17 +++ scripts/scr_PlanetData/scr_PlanetData.gml | 21 +++- .../scr_apothecary_ground.gml | 2 +- scripts/scr_buttons/scr_buttons.gml | 2 +- scripts/scr_cheatcode/scr_cheatcode.gml | 6 +- .../scr_draw_planet_features.gml | 5 +- scripts/scr_fleet_events/scr_fleet_events.gml | 1 + .../scr_forge_world_functions.gml | 18 +-- .../scr_khornate_fleet_functions.gml | 21 ++-- .../scr_marine_struct/scr_marine_struct.gml | 9 ++ .../scr_mechanicus_fleet_functions.gml | 29 +++++ .../scr_mission_functions.gml | 109 +++++++++++++++++- .../scr_planetary_feature.gml | 5 +- .../scr_player_fleet_functions.gml | 2 +- 17 files changed, 244 insertions(+), 61 deletions(-) diff --git a/objects/obj_controller/Alarm_5.gml b/objects/obj_controller/Alarm_5.gml index c676504a97..1117ba4e26 100644 --- a/objects/obj_controller/Alarm_5.gml +++ b/objects/obj_controller/Alarm_5.gml @@ -135,7 +135,12 @@ if (scr_has_adv("Tech-Scavengers")){ scr_alert("","loot",tix,0,0); } } -imperial_navy_fleet_construction(); + +try{ + imperial_navy_fleet_construction(); +}catch(_exception){ + handle_exception(_exception); +} // ** Adeptus Mechanicus Geneseed Tithe ** if (gene_tithe==0) and (faction_status[eFACTION.Imperium]!="War"){ diff --git a/objects/obj_star/Draw_0.gml b/objects/obj_star/Draw_0.gml index 5f4c8c546b..edaa1c6a88 100644 --- a/objects/obj_star/Draw_0.gml +++ b/objects/obj_star/Draw_0.gml @@ -14,11 +14,12 @@ var show=name; if (global.cheat_debug){ show = $"{name}"; for (var i=1;i<=planets;i++){ - for (p=0;p0){ // draw_sprite_ext(spr_force_icon,en_fleet[i],x3,y3,0.5,0.5,0,c_white,1); scr_image("ui/force",en_fleet[i],x3-16,y3-16,32,32); x3+=64; } } - - } } pop_draw_return_values(); +}catch(_exception){ + handle_exception(_exception); + instance_destroy(); +} /* */ diff --git a/scripts/instance_create/instance_create.gml b/scripts/instance_create/instance_create.gml index cdeaa079f5..9f97b0cca4 100644 --- a/scripts/instance_create/instance_create.gml +++ b/scripts/instance_create/instance_create.gml @@ -28,3 +28,20 @@ function instance_at_location(xx,yy,obj_type){ var _nearest = instance_nearest(xx, yy, obj_type); return (_nearest.x == xx && _nearest.y == yy) ? _nearest : noone; } + +function instance_distance(instance_1,instance_2){ + return point_distance(instance_1.x, instance_1.y, instance_2.x, instance_2.y) +} + +function nearest_instance(instance_array,check_instance){ + var _inst = instance_array[0]; + var _inst_dist = instance_distance(_inst,check_instance); + for (var i=1;i=0;i--){ + if (array_length(_forge_systems) == 0 && obj_controller.faction_status[eFACTION.Imperium] != "War"){ + scr_alert("red", "forge_world", "No active uncontested forge worlds imperial navy unable to rebuild at speed"); + } + + for (var i=array_length(_forge_systems)-1;i>=0;i--){ var _sys = _forge_systems[i]; var good=true; for(var o=1; o<=_sys.planets; o++) { @@ -47,16 +51,16 @@ function imperial_navy_fleet_construction(){ } } // After initial navy fleet construction fleet growth is handled in obj_en_fleet.alarm_5 - if (array_length(forge_systems)){ + if (array_length(_forge_systems)){ var construction_forge; - construction_forge = array_random_element(forge_systems); + construction_forge = array_random_element(_forge_systems); build_new_navy_fleet(construction_forge) } } } function get_imperium_forge_systems(){ - var forge_systems = []; + var _forge_systems = []; with(obj_star){ var good=false; for(var o=1; o<=planets; o++) { @@ -74,7 +78,7 @@ function get_imperium_forge_systems(){ var enemy_fleet_count = array_reduce(enemy_fleets, function(prev, curr) { return prev + present_fleet[curr] - }); + }, 0); good = enemy_fleet_count<=0; } @@ -86,10 +90,10 @@ function get_imperium_forge_systems(){ good = x<=room_width && y<=room_height; } if (good){ - array_push(forge_systems, id); + array_push(_forge_systems, id); } } - return forge_systems; + return _forge_systems; } function build_planet_defence_fleets(){ diff --git a/scripts/scr_khornate_fleet_functions/scr_khornate_fleet_functions.gml b/scripts/scr_khornate_fleet_functions/scr_khornate_fleet_functions.gml index f0f032b0a2..6f506a190b 100644 --- a/scripts/scr_khornate_fleet_functions/scr_khornate_fleet_functions.gml +++ b/scripts/scr_khornate_fleet_functions/scr_khornate_fleet_functions.gml @@ -272,19 +272,14 @@ function spawn_chaos_warlord(){ array_push(candidate_systems, self) } - var fleet_target = array_reduce(candidate_systems, method({nfleet}, function(prev, curr) { - if !prev - return curr - var prev_dist = point_distance(prev.x, prev.y, nfleet.x, nfleet.y) - var curr_dist = point_distance(curr.x, curr.y, nfleet.x, nfleet.y) - - return (prev_dist > curr_dist) ? curr : prev; - }),noone); + if (array_length(candidate_systems)){ + var fleet_target = nearest_instance(candidate_systems,nfleet); - with (nfleet){ - nfleet.action_x=fleet_target.x; - nfleet.action_y=fleet_target.y; - set_fleet_movement() + with (nfleet){ + nfleet.action_x=fleet_target.x; + nfleet.action_y=fleet_target.y; + set_fleet_movement() + } } var tix=$"Chaos Lord {faction_leader[eFACTION.Chaos]} continues his Black Crusade into Sector {obj_ini.sector_name}."; @@ -298,7 +293,7 @@ function spawn_chaos_warlord(){ function destroy_khorne_fleet(){ var chaos_lord_killed=false; with(instance_nearest(x, y, obj_star)){ - if system_feature_bool(p_feature, P_features.ChaosWarband == 1) then chaos_lord_killed=true; + if system_feature_bool(p_feature, P_features.ChaosWarband) then chaos_lord_killed=true; } if (chaos_lord_killed){ obj_controller.faction_defeated[10]=1; diff --git a/scripts/scr_marine_struct/scr_marine_struct.gml b/scripts/scr_marine_struct/scr_marine_struct.gml index 9308991eb6..a2828d9c12 100644 --- a/scripts/scr_marine_struct/scr_marine_struct.gml +++ b/scripts/scr_marine_struct/scr_marine_struct.gml @@ -478,6 +478,7 @@ function TTRPG_stats(faction, comp, mar, class = "marine", other_spawn_data = {} religion_sub_cult = "none"; base_group = "none"; role_history = []; + epithets = []; enum eROLE_TAG { Techmarine = 0, Librarian = 1, @@ -819,6 +820,10 @@ function TTRPG_stats(faction, comp, mar, class = "marine", other_spawn_data = {} return ""; }; + static add_epithet(epithet){ + array_push(epithets,epithet); + } + static has_trait = marine_has_trait; static add_feat = function(feat) { @@ -2009,6 +2014,10 @@ function TTRPG_stats(faction, comp, mar, class = "marine", other_spawn_data = {} } } } + var _name = "{temp_role} {name()}"; + if (array_length(epithest)){ + _name += $" {epithets[0]}"; + } return string("{0} {1}", temp_role, name()); }; diff --git a/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml b/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml index 6a9982643e..e6fdf75f87 100644 --- a/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml +++ b/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml @@ -19,4 +19,33 @@ function spawn_mechanicus_explore_fleet(){ } return _fleet; +} + +///@mixin FleetEvent +function mech_fleet_explore_battle_grounds(){ + var _navy_fleet = get_fleet_uid(fleet_uid); + + if (!is_orbiting(_navy_fleet)){ + return; + } + + var _has_battle = system_feature_bool(orbiting.p_feature,P_features.OldBattleGround); + if (_has_battle){ + var _p_data = orbiting.system_datas[_has_battle]; + _p_data.refresh_data(); + } else{ + return; + } + + var _battle_ground = _p_data.get_features(P_features.OldBattleGround)[0]; + + if (_battle_ground.explored == 0){ + var _text = $"The Mechanicus have arrived on {_p_data.name()} It will now be impossible to access the site without Mechanicus surveillance any potential rescources will now be fully put towards their aimsin service of the Ommnissiah"; + scr_popup($"Mechanicus Scavange {_p_data.name()}") + } else { + var _marines = _p_data.collect_planet_group("all"); + if (array_length(_marines)){ + if () + } + } } \ No newline at end of file diff --git a/scripts/scr_mission_functions/scr_mission_functions.gml b/scripts/scr_mission_functions/scr_mission_functions.gml index c30587a63c..78ef377826 100644 --- a/scripts/scr_mission_functions/scr_mission_functions.gml +++ b/scripts/scr_mission_functions/scr_mission_functions.gml @@ -450,34 +450,116 @@ function complete_train_forces_mission(targ_planet, problem_index){ } } +function get_beast_rumor(_planet_type, _beast_name){ + switch (_planet_type){ + case "Feudal": + return choose( + $"Peasants whisper prayers at night, for {_beast_name} walks the old forest paths.", + $"Knights of the realm have failed to slay {_beast_name}, their banners now hang in tatters.", + $"Church bells toll whenever {_beast_name} is sighted." + ); + + case "Ice": + return choose( + $"The ice cracks when {_beast_name} hunts.", + $"Entire hab-blocks were found frozen solid in the wake of {_beast_name}.", + $"The wind carries the howls of {_beast_name} across the tundra." + ); + + case "Death": + return choose( + $"Nothing lives long where {_beast_name} roams.", + $"Scavenger clans refuse entire regions claimed by {_beast_name}.", + $"Even apex predators flee the shadow of {_beast_name}." + ); + } + + return ""; +} + + +function get_beast_name_by_planet_type(_planet_type){ + switch (_planet_type){ + case "Feudal": + return choose( + "The Thorn-King", + "Blackwood Stalker", + "Crowned Razorback", + "Cathedral Stag", + "Old Bloodfather", + "The Green Tyrant" + ); + + case "Ice": + return choose( + "The Frostwyrm", + "Glacial Leviathan", + "The Howling Pale", + "Rimehorn Colossus", + "White Death Ursid", + "Icebound Devourer" + ); + + case "Death": + return choose( + "The Charnel Leviathan", + "God-Eater Beast", + "Void-Spined Terror", + "Apex Predatrix", + "Emperor’s Bane", + "The Unending Maw" + ); + } + + return "Unknown Horror"; +} + + +function format_beast_trophy(_beast_name){ + return choose( + $"The Severed Crown of {_beast_name}", + $"The Fanged Skull of {_beast_name}", + $"The Head of {_beast_name}", + $"The Blackened Remains of {_beast_name}" + ); +} + + function init_beast_hunt_mission(planet, star, mission_slot){ - var problems_data = star.p_problem_other_data[planet] - var mission_data = problems_data[mission_slot]; + var _problems_data = star.p_problem_other_data[planet]; + var mission_data = _problems_data[mission_slot]; if (mission_data.stage == "preliminary"){ var numeral_name = planet_numeral_name(planet, star); mission_data.stage = "active"; var _mission_length=(irandom_range(2,5)); star.p_timer[planet][mission_slot] = _mission_length; + star.p_problem_other_data = {}; //pop.image="ancient_ruins"; var gar_pop=instance_create(0,0,obj_popup); //TODO some new universal methods for popups - gar_pop.title=$"Marines assigned to hunt beasts around {numeral_name}"; - gar_pop.text=$"The govornor of {numeral_name} Thanks you for the participation of your elite warriors in your execution of such a menial task."; + + var _beast_name = get_beast_name_by_planet_type(star.p_type[planet]); + gar_pop.title=$"Marines assigned to hunt {_beast_name} beasts around {numeral_name}"; + gar_pop.text=$"The governor thanks you for lending your warriors to a task beneath their station — yet one whose outcome will be remembered. And that your marines shall find the {_beast_name} a suitable challenge. As things stand rumours say {get_beast_rumor(_beast_name, star.p_type[planet])}"; //pip.image="event_march" gar_pop.add_option({ str1: "Happy Hunting" }); gar_pop.image=""; gar_pop.cooldown=8; + gar_pop.pop_data.beast_name = _beast_name; + mission_data.beast_name = _beast_name; obj_controller.cooldown=20; scr_event_log("",$"Beast hunters deployed to {numeral_name} for {_mission_length} months.", star.name); } } +///@mixin obj_star function complete_beast_hunt_mission(targ_planet, problem_index){ var planet = new PlanetData(targ_planet, self); if (problem_has_key_and_value(targ_planet,problem_index,"stage","active")){ + var _problem_data = p_problem_other_data[targ_planet][problem_index]; _mission_string = ""; var man_conditions = { "job": "hunt_beast", @@ -535,7 +617,8 @@ function complete_beast_hunt_mission(targ_planet, problem_index){ trophy_owner : array_random_element(_successful_hunters), system: self.name, planet : targ_planet, - target_fleet : array_random_element(_navy_fleets) + target_fleet : array_random_element(_navy_fleets), + beast :_problem_data.beast_name, }; var _options = { @@ -563,7 +646,10 @@ function complete_beast_hunt_mission(targ_planet, problem_index){ } } function init_deliver_trophy_mission(){ - text = $"After your marines return there is a great feast to honour them. Much fanfare is made of the great trophy {pop_data.trophy_owner.name_role()} bears, a great monstrous head as tall as he is that the governor proclaims must be the largest of it's kind and the momst fearsome beast in the sector."; + pop_data.trophy_name = format_beast_trophy(pop_data.beast); + text = $"Much fanfare is made of the great trophy {pop_data.trophy_owner.name_role()} bears: {pop_data.trophy_name}."; + text += $" The governor proclaims it proof that {_beast_name} was the most fearsome predator in the sector."; + text += $"\n\nAn astropathic message is later recieved from the Commander of an Imperial Navy fleet explaining that his fleet is currrently home to the {irandom_numeral(100)},{irandom_numeral(100)} and {irandom_numeral(100)} {pop_data.system} Regiments and pleads that the trophy be handed over to his fleet in order to boost the moral of the regiments and fleet in general"; @@ -632,6 +718,17 @@ function deliver_trophy_mission_fleet_destroyed(){ ); } +function get_beast_epithet(_planet_type){ + switch (_planet_type){ + case "Feudal": return "The King-Slayer"; + case "Ice": return "The Pale Reaper"; + case "Death": return "The Emperor’s Fang"; + } + return ""; +} + + + ///@mixin FleetEvent function deliver_trophy_end_turn_check(){ show_debug_message($"evetn_Data = {fleetevent_data}"); diff --git a/scripts/scr_planetary_feature/scr_planetary_feature.gml b/scripts/scr_planetary_feature/scr_planetary_feature.gml index 6a7dd29f1d..9893ffe50b 100644 --- a/scripts/scr_planetary_feature/scr_planetary_feature.gml +++ b/scripts/scr_planetary_feature/scr_planetary_feature.gml @@ -75,6 +75,7 @@ function NewPlanetFeature(feature_type, other_data={}) constructor{ faction2 = "imperium"; explore_size = irandom_range(1000, 10000); explored = 0; + planet_display = "Old Battle Ground"; break; case P_features.Secret_Base: base_type = base_types.Lair; @@ -236,7 +237,9 @@ function system_feature_bool(system, search_feature){ for (var sys =1; sys<5; sys++){ sys_bool = planet_feature_bool(system[sys], search_feature) if (sys_bool==1){ - break;} + sys_bool = sys; + break; + } } return sys_bool; } diff --git a/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml b/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml index f4c6c26d9a..5ac980cf66 100644 --- a/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml +++ b/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml @@ -36,7 +36,7 @@ function get_player_fleet_intercept_time(star,time_abundance){ var _travel = -1 var _nearest_player_fleet = instance_nearest(star.x, star.y, obj_p_fleet); if (instance_exists(_nearest_player_fleet)){ - _travel = get_viable_travel_time(time_abundance, _nearest_player_fleet.x, _nearest_player_fleet.y, star.x, star.y, _nearest_fleet, false); + _travel = get_viable_travel_time(time_abundance, _nearest_player_fleet.x, _nearest_player_fleet.y, star.x, star.y, _nearest_player_fleet, false); } } function fleet_has_roles(fleet="none", roles){ From d8abe160177a7b4ae2b5c805c8aefcd637bc8570 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Thu, 18 Dec 2025 23:54:46 +0000 Subject: [PATCH 22/31] add stylistic depth --- scripts/scr_mission_functions/scr_mission_functions.gml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/scr_mission_functions/scr_mission_functions.gml b/scripts/scr_mission_functions/scr_mission_functions.gml index 78ef377826..7ce47b651e 100644 --- a/scripts/scr_mission_functions/scr_mission_functions.gml +++ b/scripts/scr_mission_functions/scr_mission_functions.gml @@ -557,9 +557,9 @@ function init_beast_hunt_mission(planet, star, mission_slot){ ///@mixin obj_star function complete_beast_hunt_mission(targ_planet, problem_index){ - var planet = new PlanetData(targ_planet, self); + var _planet = new PlanetData(targ_planet, self); if (problem_has_key_and_value(targ_planet,problem_index,"stage","active")){ - var _problem_data = p_problem_other_data[targ_planet][problem_index]; + var _problem_data = problems_data[problem_index]; _mission_string = ""; var man_conditions = { "job": "hunt_beast", @@ -619,6 +619,7 @@ function complete_beast_hunt_mission(targ_planet, problem_index){ planet : targ_planet, target_fleet : array_random_element(_navy_fleets), beast :_problem_data.beast_name, + system_type : _planet.planet_type; }; var _options = { @@ -761,7 +762,8 @@ function deliver_trophy_end_turn_check(){ if (_present){ var _text = "{_marine.role(name)} is able to rendevous with the imperial navy at {_meet_point.name}." _text += $" The guard regiments of {fleetevent_data.system} are overjoyed at the delivery of the trophy and find the beast that the head came from adorns many of the regiments banners."; - _text += $" While The task is for the most part thankless your chapters esteem has risen greatly with the exploits of {_marine.name_role()} spreading far and wide amoung guard regiments."; + var _marine_epithet = get_beast_epithet(fleetevent_data.planet_type); + _text += $" While The task is for the most part thankless your chapters esteem has risen greatly with the exploits of {_marine.name_role()} spreading far and wide amoung guard regiments and has garnered the epithet {_marine_epithet}."; var _roll = roll_dice_chapter(1, 100, "high"); if (_roll>30 && _roll<70){ //TODO would be cool to have this changed to be a guard specific piece of equipment From 6b22193caf76ffefffad35ccf759dea0d075c41a Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Fri, 19 Dec 2025 21:13:38 +0000 Subject: [PATCH 23/31] minor improvements --- scripts/scr_PlanetData/scr_PlanetData.gml | 2 +- scripts/scr_buttons/scr_buttons.gml | 4 +++- scripts/scr_cheatcode/scr_cheatcode.gml | 5 +++- scripts/scr_draw_text/scr_draw_text.gml | 20 +++++++++------- scripts/scr_enemy_ai_b/scr_enemy_ai_b.gml | 2 +- .../scr_marine_struct/scr_marine_struct.gml | 17 +++++++++---- .../scr_mechanicus_fleet_functions.gml | 4 ++-- .../scr_mission_functions.gml | 15 ++++++------ .../scr_ork_fleet_functions.gml | 2 +- scripts/scr_ui_manage/scr_ui_manage.gml | 24 +++++++++++++++++-- 10 files changed, 66 insertions(+), 29 deletions(-) diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 30c516c715..0199acb18e 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -116,7 +116,7 @@ function PlanetData(planet, system) constructor{ system.dispo[planet] = player_disposition; } - static collect_planet_group(group=SPECIALISTS_STANDARD,opposite=false,search_conditions = {companies:"all"}){ + static collect_planet_group = function(group=SPECIALISTS_STANDARD,opposite=false,search_conditions = {companies:"all"}){ return(collect_role_group(group,[system.name,planet],opposite,search_conditions)) } diff --git a/scripts/scr_buttons/scr_buttons.gml b/scripts/scr_buttons/scr_buttons.gml index 2c034b960a..0c8d2f7a6d 100644 --- a/scripts/scr_buttons/scr_buttons.gml +++ b/scripts/scr_buttons/scr_buttons.gml @@ -69,6 +69,7 @@ function ReactiveString(text, x1 = 0, y1 = 0, data = false) constructor{ tooltip = ""; max_width = -1; scale_text=false; + scale = 1; move_data_to_current_scope(data); @@ -91,7 +92,8 @@ function ReactiveString(text, x1 = 0, y1 = 0, data = false) constructor{ h = string_height(text) * scale; } } else { - w = string_width(text); + w = string_width(text) * scale; + h = string_height(text) * scale; } pop_draw_return_values(); diff --git a/scripts/scr_cheatcode/scr_cheatcode.gml b/scripts/scr_cheatcode/scr_cheatcode.gml index 3e4941c35b..9ca7c0f482 100644 --- a/scripts/scr_cheatcode/scr_cheatcode.gml +++ b/scripts/scr_cheatcode/scr_cheatcode.gml @@ -527,11 +527,14 @@ function draw_planet_debug_problems(){ case "deliver_trophy": var _unit = fetch_unit(scr_random_marine("",0)); var _navy_fleets = get_imperial_navy_fleets(); + var _plan_type = target.p_type[obj_controller.selecting_planet]; var _pop_data = { trophy_owner : _unit, system: target.name, planet : obj_controller.selecting_planet, - target_fleet : array_random_element(_navy_fleets) + target_fleet : array_random_element(_navy_fleets), + beast : get_beast_name_by_planet_type(_plan_type) , + planet_type :_plan_type , } var _pop = instance_create(0,0,obj_popup); diff --git a/scripts/scr_draw_text/scr_draw_text.gml b/scripts/scr_draw_text/scr_draw_text.gml index a1a3fdae9b..d74566b1ce 100644 --- a/scripts/scr_draw_text/scr_draw_text.gml +++ b/scripts/scr_draw_text/scr_draw_text.gml @@ -62,16 +62,20 @@ function draw_text_glow_transformed(_x, _y, _text, _text_scale = [1,1], _angle = /// @function draw_text_outline /// @description This function will draw text in a similar way to draw_text(), only now the text will have an outline that may improve readability. -function draw_text_outline(_x, _y, _text, _outl_col=c_black, _text_col=-1){ +function draw_text_outline(_x, _y, _text, _outl_col=c_black, _text_col=-1,scale =1){ var _cur_color = draw_get_color(); draw_set_color(_outl_col); - draw_text(_x-1.5, _y, _text); - draw_text(_x+1.5, _y, _text); - draw_text(_x, _y-1.5, _text); - draw_text(_x, _y+1.5, _text); - if (_text_col != -1) draw_set_color(_text_col); - else draw_set_color(_cur_color); - draw_text(_x, _y, _text); + draw_text_transformed(_x-1.5, _y, _text, scale, scale, 0); + draw_text_transformed(_x+1.5, _y, _text, scale, scale, 0); + draw_text_transformed(_x, _y-1.5, _text, scale, scale, 0); + draw_text_transformed(_x, _y+1.5, _text, scale, scale, 0); + if (_text_col != -1){ + draw_set_color(_text_col); + } + else{ + draw_set_color(_cur_color); + } + draw_text_transformed(_x, _y, _text,scale, scale, 0); draw_set_color(_cur_color); } diff --git a/scripts/scr_enemy_ai_b/scr_enemy_ai_b.gml b/scripts/scr_enemy_ai_b/scr_enemy_ai_b.gml index 3d66a6b699..7922c04042 100644 --- a/scripts/scr_enemy_ai_b/scr_enemy_ai_b.gml +++ b/scripts/scr_enemy_ai_b/scr_enemy_ai_b.gml @@ -93,7 +93,7 @@ function scr_enemy_ai_b() { } if (badd == 1) { - scr_alert("red", "owner", "Planet " + planet_string + " has succeeded to the Tau Empire!", x, y); + scr_alert("red", "owner", "Planet {planet_numeral_name(i)} has succeed ed to the Tau Empire!", x, y); if (visited == 1) { //visited variable checks whether the star has been visited by the chapter or not 1 for true 0 for false if (p_type[i] == "Forge") { diff --git a/scripts/scr_marine_struct/scr_marine_struct.gml b/scripts/scr_marine_struct/scr_marine_struct.gml index a2828d9c12..89f005640e 100644 --- a/scripts/scr_marine_struct/scr_marine_struct.gml +++ b/scripts/scr_marine_struct/scr_marine_struct.gml @@ -820,7 +820,13 @@ function TTRPG_stats(faction, comp, mar, class = "marine", other_spawn_data = {} return ""; }; - static add_epithet(epithet){ + static add_epithet = function(epithet){ + if (is_string(epithet)){ + epithet = { + title : epithet, + story : "", + } + } array_push(epithets,epithet); } @@ -2004,7 +2010,7 @@ function TTRPG_stats(faction, comp, mar, class = "marine", other_spawn_data = {} } //quick way of getting name and role combined in string - static name_role = function() { + static name_role = function(include_epithet = true) { var temp_role = role(); if (squad != "none") { if (struct_exists(obj_ini.squad_types[$ obj_ini.squads[squad].type], temp_role)) { @@ -2014,9 +2020,12 @@ function TTRPG_stats(faction, comp, mar, class = "marine", other_spawn_data = {} } } } + var _name = "{temp_role} {name()}"; - if (array_length(epithest)){ - _name += $" {epithets[0]}"; + if (include_epithet){ + if (array_length(epithets)){ + _name += $" {epithets[0].title}"; + } } return string("{0} {1}", temp_role, name()); }; diff --git a/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml b/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml index e6fdf75f87..b07f942107 100644 --- a/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml +++ b/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml @@ -41,11 +41,11 @@ function mech_fleet_explore_battle_grounds(){ if (_battle_ground.explored == 0){ var _text = $"The Mechanicus have arrived on {_p_data.name()} It will now be impossible to access the site without Mechanicus surveillance any potential rescources will now be fully put towards their aimsin service of the Ommnissiah"; - scr_popup($"Mechanicus Scavange {_p_data.name()}") + scr_popup($"Mechanicus Scavange {_p_data.name()}",_text, "mech"); } else { var _marines = _p_data.collect_planet_group("all"); if (array_length(_marines)){ - if () + if (true){} } } } \ No newline at end of file diff --git a/scripts/scr_mission_functions/scr_mission_functions.gml b/scripts/scr_mission_functions/scr_mission_functions.gml index 7ce47b651e..bd6044378b 100644 --- a/scripts/scr_mission_functions/scr_mission_functions.gml +++ b/scripts/scr_mission_functions/scr_mission_functions.gml @@ -474,7 +474,7 @@ function get_beast_rumor(_planet_type, _beast_name){ ); } - return ""; + return $"{_beast_name} is the most fesarsome fauna in the entire segment according to locals"; } @@ -511,7 +511,7 @@ function get_beast_name_by_planet_type(_planet_type){ ); } - return "Unknown Horror"; + return "Glistening Horror"; } @@ -533,14 +533,13 @@ function init_beast_hunt_mission(planet, star, mission_slot){ mission_data.stage = "active"; var _mission_length=(irandom_range(2,5)); star.p_timer[planet][mission_slot] = _mission_length; - star.p_problem_other_data = {}; //pop.image="ancient_ruins"; var gar_pop=instance_create(0,0,obj_popup); //TODO some new universal methods for popups var _beast_name = get_beast_name_by_planet_type(star.p_type[planet]); - gar_pop.title=$"Marines assigned to hunt {_beast_name} beasts around {numeral_name}"; - gar_pop.text=$"The governor thanks you for lending your warriors to a task beneath their station — yet one whose outcome will be remembered. And that your marines shall find the {_beast_name} a suitable challenge. As things stand rumours say {get_beast_rumor(_beast_name, star.p_type[planet])}"; + gar_pop.title=$"Hunt {_beast_name} beasts around {numeral_name}"; + gar_pop.text=$"The governor thanks you for lending your warriors to a task beneath their station — yet one whose outcome will be remembered. And that your marines shall find the {_beast_name} a suitable challenge. As things stand rumours say {get_beast_rumor(star.p_type[planet])}"; //pip.image="event_march" gar_pop.add_option({ str1: "Happy Hunting" @@ -559,7 +558,7 @@ function init_beast_hunt_mission(planet, star, mission_slot){ function complete_beast_hunt_mission(targ_planet, problem_index){ var _planet = new PlanetData(targ_planet, self); if (problem_has_key_and_value(targ_planet,problem_index,"stage","active")){ - var _problem_data = problems_data[problem_index]; + var _problem_data = _planet.problems_data[problem_index]; _mission_string = ""; var man_conditions = { "job": "hunt_beast", @@ -619,7 +618,7 @@ function complete_beast_hunt_mission(targ_planet, problem_index){ planet : targ_planet, target_fleet : array_random_element(_navy_fleets), beast :_problem_data.beast_name, - system_type : _planet.planet_type; + planet_type : _planet.planet_type, }; var _options = { @@ -649,7 +648,7 @@ function complete_beast_hunt_mission(targ_planet, problem_index){ function init_deliver_trophy_mission(){ pop_data.trophy_name = format_beast_trophy(pop_data.beast); text = $"Much fanfare is made of the great trophy {pop_data.trophy_owner.name_role()} bears: {pop_data.trophy_name}."; - text += $" The governor proclaims it proof that {_beast_name} was the most fearsome predator in the sector."; + text += $" The governor proclaims it proof that {pop_data.beast} was the most fearsome predator in the sector."; text += $"\n\nAn astropathic message is later recieved from the Commander of an Imperial Navy fleet explaining that his fleet is currrently home to the {irandom_numeral(100)},{irandom_numeral(100)} and {irandom_numeral(100)} {pop_data.system} Regiments and pleads that the trophy be handed over to his fleet in order to boost the moral of the regiments and fleet in general"; diff --git a/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml b/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml index 0b58398dce..0ec8e96db5 100644 --- a/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml +++ b/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml @@ -77,7 +77,7 @@ function ork_fleet_arrive_target(){ } } if (ork_attack_planet>0){ - p_tyranids[ork_attack_planet] -= round(standard_fleet_strength_calc()); + p_tyranids[ork_attack_planet] -= round(standard_fleet_strength_calc(_ork_fleet)); var _pdata = new PlanetData(ork_attack_planet, self); diff --git a/scripts/scr_ui_manage/scr_ui_manage.gml b/scripts/scr_ui_manage/scr_ui_manage.gml index a935f8e312..cd9f7612c4 100644 --- a/scripts/scr_ui_manage/scr_ui_manage.gml +++ b/scripts/scr_ui_manage/scr_ui_manage.gml @@ -446,6 +446,22 @@ function reset_manage_unit_constants(unit){ unit_manage_image = unit.draw_unit_image(); temp[122] = unit.handle_stat_growth(); + + var _string_data = { + colour : #50a076, + scale : 0.7, + halign :fa_center, + font :fnt_40k_30b, + scale_text :true, + max_width : 250, + }; + + var _name=unit.name(); + if (array_length(unit.epithets)){ + _name += unit.epithets[0].title; + } + unit_manage_constants.name = new ReactiveString(_name,0,0,_string_data); + /*if (man[sel]="vehicle"){ // TODO }*/ @@ -706,8 +722,12 @@ function draw_sprite_and_unit_equip_data(){ draw_set_font(fnt_40k_14b); draw_text_transformed_outline(_name_box.x1, _name_box.y1, _name_box.text1, 1, 1, 0); draw_text_transformed_outline(_name_box.x1, _name_box.y2, _name_box.text2, 1, 1, 0); - draw_set_font(fnt_40k_30b); - draw_text_transformed_outline(_name_box.x1, _name_box.y3, _name_box.text3, 0.7, 0.7, 0); + + unit_manage_constants.name.update({ + x1: xx + 402, + y1: yy + 76, + }); + unit_manage_constants.name.draw(); // Draw unit info From 03b9e6e937a382935e402f4db1983ae088d8ca53 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Sat, 20 Dec 2025 02:16:44 +0000 Subject: [PATCH 24/31] better searching capabilities --- scripts/is_specialist/is_specialist.gml | 188 ++++++++++++++---- scripts/scr_PlanetData/scr_PlanetData.gml | 9 +- .../scr_mission_functions.gml | 97 ++++----- .../scr_player_fleet_functions.gml | 1 - 4 files changed, 204 insertions(+), 91 deletions(-) diff --git a/scripts/is_specialist/is_specialist.gml b/scripts/is_specialist/is_specialist.gml index 26ec8f1be5..092b24c4d3 100644 --- a/scripts/is_specialist/is_specialist.gml +++ b/scripts/is_specialist/is_specialist.gml @@ -229,10 +229,13 @@ function collect_role_group(group=SPECIALISTS_STANDARD, location="", opposite=fa var _total_count = 0; if (struct_exists(search_conditions, "max")){ _max_count = search_conditions.max; + search_conditions.max_wanted = search_conditions.max; } - if (!struct_exists(search_conditions, "companies")){ - search_conditions.companies = "all"; - } + search_conditions.group = group; + search_conditions.location = location; + search_conditions.opposite = opposite; + + var _conditions = new SearchConditions(search_conditions); for (var com=0;com<=10;com++){ if (_max_count>0){ if (array_length(_units)>=_max_count){ @@ -242,55 +245,158 @@ function collect_role_group(group=SPECIALISTS_STANDARD, location="", opposite=fa var _wanted_companies = search_conditions.companies; if (_wanted_companies!="all"){ if (is_array(_wanted_companies)){ - if (!array_contains(_wanted_companies, com)) then continue; + if (!array_contains(_wanted_companies, com)){ + continue; + } } else { - if (_wanted_companies != com) then continue; + if (_wanted_companies != com){ + continue; + } } } for (var i=0;i0){ - if (array_length(_units)>=_max_count){ + if (_conditions.end_loop){ break; - } } - if array_length(_units) - _add=false; - unit=fetch_unit([com,i]); - if (unit.name()=="") then continue; - if (group!="all"){ - if (is_array(group)){ - if (array_length(group) == 3) { - _is_special_group = unit.IsSpecialist(group[0], group[1], group[2]); - } else { - _is_special_group = unit.IsSpecialist(group[0], group[1]); - } + _unit=fetch_unit([com,i]); + + if (_conditions.evaluate(_unit)){ + array_push(_units, _unit); + } + } + } + return _units; +} + + +function SearchConditions(data) constructor{ + group = "all"; + opposite = false; + location = ""; + max_wanted = 0; + companies = "all"; + + static update_constants = function(data){ + move_data_to_current_scope(data); + group_is_complex = is_array(group); + if (group_is_complex){ + if (array_length(_group) == 3){ + group_search_heads = true; + } else { + group_search_heads = false; + } + } + complex_location = is_array(location); + + search_companies = !is_string(companies); + if (search_companies){ + search_multiple_companies = is_array(search_companies); + } + + if (max_wanted > 0){ + found = 0; + } + + end_loop = false; + } + + update_constants(data); + + static evaluate = function(unit){ + if (unit.name()==""){ + return false; + } + if (search_companies){ + if (search_multiple_companies){ + if (!array_contains(_wanted_companies, unit.company)){ + return false; + } + } else { + if (_wanted_companies != unit.company){ + return false; + } + } + } + + var _add = false; + if (group!="all"){ + var _group = group; + if (group_is_array){ + if (group_search_heads) { + _is_special_group = unit.IsSpecialist(_group[0], _group[1], _group[2]); } else { - _is_special_group = unit.IsSpecialist(group); + _is_special_group = unit.IsSpecialist(_group[0], _group[1]); } } else { - _is_special_group = true; + _is_special_group = unit.IsSpecialist(_group); } - if ((_is_special_group && !opposite) || (!_is_special_group && opposite)){ - if (location==""){ - _add=true; - } else if (!is_array(location)){ - _add=unit.is_at_location(location); - } else { - _add=unit.is_at_location(location[0], location[1], location[2]); - } - } - if (_add){ - if (struct_exists(search_conditions, "stat")){ - _add = stat_valuator(search_conditions.stat, unit); - } - if (struct_exists(search_conditions,"job")){ - _add = (unit.assignment() == search_conditions.job); - } - } - if (_add) then array_push(_units, obj_ini.TTRPG[com][i]); - } + } else { + _is_special_group = true; + } + if ((_is_special_group && !opposite) || (!_is_special_group && opposite)){ + if (location==""){ + _add=true; + } else if (!complex_location){ + _add=unit.is_at_location(location); + } else { + _add=unit.is_at_location(location[0], location[1], location[2]); + } + } + if (_add){ + if (struct_exists(self, "stat")){ + _add = stat_valuator(stat, unit); + } + if (struct_exists(self,"job")){ + _add = (unit.assignment() == job); + } + } + + if (max_wanted > 0 && _add){ + found++; + if (found>max_wanted){ + _add = false; + end_loop = true; + } + } + + + return _add; + } + +} + + +function UnitGroup(units) constructor{ + self.units = units; + + static number = function(){ + return array_length(units); + } + + static has_role = function(role){ + for (var i=0;i Date: Sat, 20 Dec 2025 18:05:40 +0000 Subject: [PATCH 25/31] better improvements to searching units and sorting --- scripts/is_specialist/is_specialist.gml | 108 ++++++++++++++---- scripts/scr_PlanetData/scr_PlanetData.gml | 39 +++++-- .../scr_mechanicus_fleet_functions.gml | 8 +- 3 files changed, 124 insertions(+), 31 deletions(-) diff --git a/scripts/is_specialist/is_specialist.gml b/scripts/is_specialist/is_specialist.gml index 092b24c4d3..b1449285d5 100644 --- a/scripts/is_specialist/is_specialist.gml +++ b/scripts/is_specialist/is_specialist.gml @@ -275,6 +275,7 @@ function SearchConditions(data) constructor{ location = ""; max_wanted = 0; companies = "all"; + allegiance = ""; static update_constants = function(data){ move_data_to_current_scope(data); @@ -302,55 +303,100 @@ function SearchConditions(data) constructor{ update_constants(data); - static evaluate = function(unit){ - if (unit.name()==""){ - return false; - } + static oposite_switch = function(val){ + return opposite ? !val : val; + } + + static company_evaluate = function(){ + var _add = true; if (search_companies){ if (search_multiple_companies){ if (!array_contains(_wanted_companies, unit.company)){ - return false; + _add = false; } } else { if (_wanted_companies != unit.company){ - return false; + _add = false; } } + _add = oposite_switch(_add); } - var _add = false; + return _add; + } + + static group_evaluate = function(){ + + var _add = true; if (group!="all"){ var _group = group; if (group_is_array){ if (group_search_heads) { - _is_special_group = unit.IsSpecialist(_group[0], _group[1], _group[2]); + _add = unit.IsSpecialist(_group[0], _group[1], _group[2]); } else { - _is_special_group = unit.IsSpecialist(_group[0], _group[1]); + _add = unit.IsSpecialist(_group[0], _group[1]); } } else { - _is_special_group = unit.IsSpecialist(_group); + _add = unit.IsSpecialist(_group); } - } else { - _is_special_group = true; + _add = oposite_switch(_add); } - if ((_is_special_group && !opposite) || (!_is_special_group && opposite)){ - if (location==""){ - _add=true; - } else if (!complex_location){ + return _add; + } + + static location_evaluate = function(){ + var _add = true; + if (location!=""){ + if (!complex_location){ _add=unit.is_at_location(location); } else { _add=unit.is_at_location(location[0], location[1], location[2]); } - } + _add = oposite_switch(_add); + } + + return _add; + } + + static checks_order = [ + company_evaluate, + group_evaluate, + location_evaluate + ]; + + + static evaluate = function(unit){ + self.unit = unit; + if (unit.name()==""){ + return false; + } + + var _add = true; + for (var i=0;i 0 && _add){ found++; if (found>max_wanted){ @@ -383,6 +429,26 @@ function UnitGroup(units) constructor{ return false; } + static has_base_group = function(group){ + for (var i=0;i 0){ + text = ""; + scr_popup("Conflict of Interest",) + } + } + + } @@ -1583,16 +1606,16 @@ function PlanetData(planet, system) constructor{ var find_nid_chance = 50 - planet_garrison.total_garrison; if (population_influences[eFACTION.Tyranids] > 50) { var find_cult_chance = irandom(50); - var alert_text = $"A hidden Genestealer Cult in {name} Has suddenly burst forth from hiding!"; + var alert_text = $"A hidden Genestealer Cult on {name()} Has suddenly burst forth from hiding!"; if (planet_garrison.garrison_force) { - var alert_text = $"A hidden Genestealer Cult in {name} Has been discovered by marine garrisons!"; + var alert_text = $"A hidden Genestealer Cult on {name()} Has been discovered by marine garrisons!"; find_cult_chance -= 25; } if (find_cult_chance < 1) { cult.hiding = false; scr_popup("System Lost", alert_text, "Genestealer Cult", ""); set_new_owner(eFACTION.Tyranids); - scr_event_log("red", $"A hidden Genestealer Cult in {name} {i} has Started a revolt.", name); + scr_event_log("red", $"A hidden Genestealer Cult on {name()} has Started a revolt.", system.name); edit_forces(eFACTION.Tyranids,1); } } @@ -1715,12 +1738,12 @@ function PlanetData(planet, system) constructor{ } scr_alert("purple", "owner", tixt, x, y); - scr_event_log("purple", tixt, name); + scr_event_log("purple", tixt, system.name); } } else { tixt = $"Marine garrisons prevents rebellion on {name()}"; scr_alert("green", "owner", tixt, x, y); - scr_event_log("green", tixt, name); + scr_event_log("green", tixt, system.name); corruption -= irandom(5); } // Cult crushed; don't bother showing if there's already fighting going on over there @@ -1756,7 +1779,7 @@ function PlanetData(planet, system) constructor{ var n_name = name(); scr_popup("Heretic Revolt", $"A massive heretic uprising on {n_name} threatens to plunge the star system into chaos.", "chaos_cultist", ""); scr_alert("red", "owner", $"Massive heretic uprising on {n_name}.", x, y); - scr_event_log("purple", $"Massive heretic uprising on {n_name}.", name); + scr_event_log("purple", $"Massive heretic uprising on {n_name}.", system.name); } // Huge uprising if ((_rando >= 100) && (planet_forces[eFACTION.Heretics] < 5)) { @@ -1771,7 +1794,7 @@ function PlanetData(planet, system) constructor{ if ((_rando >= 41) && (!notixt) && tixt != "") { scr_alert("red", "owner", tixt, x, y); - scr_event_log("purple", tixt, name); + scr_event_log("purple", tixt, system.name); } // if (planet_forces[eFACTION.Heretics]>2){obj_controller.x=self.x;obj_controller.y=self.y;} } // End traitors cult diff --git a/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml b/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml index b07f942107..5f0dd00cc5 100644 --- a/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml +++ b/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml @@ -41,11 +41,15 @@ function mech_fleet_explore_battle_grounds(){ if (_battle_ground.explored == 0){ var _text = $"The Mechanicus have arrived on {_p_data.name()} It will now be impossible to access the site without Mechanicus surveillance any potential rescources will now be fully put towards their aimsin service of the Ommnissiah"; - scr_popup($"Mechanicus Scavange {_p_data.name()}",_text, "mech"); + scr_popup($"Mechanicus Scavange {_p_data.name()}", _text, "mech"); } else { var _marines = _p_data.collect_planet_group("all"); if (array_length(_marines)){ - if (true){} + var _heritecs = obj_controller.tech_status == "heretics"; + if (_heritecs){ + _text = "The Rumours of the heretical practices of your marines have not gone un-noticed your presence is thusly even more enraging to mechanicus"; + } + } } } \ No newline at end of file From 03d54dbb4a2392c173e565c392f252778f02780a Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Sat, 20 Dec 2025 19:09:17 +0000 Subject: [PATCH 26/31] coonsistent use of active_roles and other sorting --- ChapterMaster.yyp | 1 + objects/obj_controller/Alarm_5.gml | 11 +- objects/obj_controller/Alarm_6.gml | 67 +-- objects/obj_ncombat/Alarm_1.gml | 52 +-- scripts/is_specialist/is_specialist.gml | 404 ------------------ scripts/scr_PlanetData/scr_PlanetData.gml | 15 +- .../scr_UnitGroup_and_group_selection.gml | 403 +++++++++++++++++ .../scr_UnitGroup_and_group_selection.yy | 13 + .../scr_specialist_training.gml | 52 ++- 9 files changed, 524 insertions(+), 494 deletions(-) create mode 100644 scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.gml create mode 100644 scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.yy diff --git a/ChapterMaster.yyp b/ChapterMaster.yyp index f1a3b07771..6869cb597b 100644 --- a/ChapterMaster.yyp +++ b/ChapterMaster.yyp @@ -958,6 +958,7 @@ {"id":{"name":"scr_unit_size","path":"scripts/scr_unit_size/scr_unit_size.yy",},}, {"id":{"name":"scr_unit_spawn_functions","path":"scripts/scr_unit_spawn_functions/scr_unit_spawn_functions.yy",},}, {"id":{"name":"scr_unit_traits","path":"scripts/scr_unit_traits/scr_unit_traits.yy",},}, + {"id":{"name":"scr_UnitGroup_and_group_selection","path":"scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.yy",},}, {"id":{"name":"scr_uuid_generate","path":"scripts/scr_uuid_generate/scr_uuid_generate.yy",},}, {"id":{"name":"scr_vehicle_count","path":"scripts/scr_vehicle_count/scr_vehicle_count.yy",},}, {"id":{"name":"scr_vehicle_helpers","path":"scripts/scr_vehicle_helpers/scr_vehicle_helpers.yy",},}, diff --git a/objects/obj_controller/Alarm_5.gml b/objects/obj_controller/Alarm_5.gml index 1117ba4e26..e387384e6f 100644 --- a/objects/obj_controller/Alarm_5.gml +++ b/objects/obj_controller/Alarm_5.gml @@ -15,6 +15,7 @@ var spikky=0; var roll=0; var novice_type=""; var unit; +var _roles = active_roles(); try_and_report_loop("chaos_spread", function(){ @@ -82,7 +83,7 @@ while (i1){ - scr_alert("green","recruitment",$"{recruits_finished}x {obj_ini.role[100][12]} have joined X Company.",0,0); + scr_alert("green","recruitment",$"{recruits_finished}x {_roles[12]} have joined X Company.",0,0); } @@ -414,10 +415,10 @@ if (disposition[eFACTION.Ork]>=60) then scr_loyalty("Xeno Associate","+"); if (disposition[eFACTION.Tau]>=60) then scr_loyalty("Xeno Associate","+"); var loyalty_counter=0; -loyalty_counter=scr_role_count(obj_ini.role[100][15],""); +loyalty_counter=scr_role_count(_roles[15],""); if (loyalty_counter==0) then scr_loyalty("Lack of Apothecary","+"); -loyalty_counter=scr_role_count(obj_ini.role[100][14],""); +loyalty_counter=scr_role_count(_roles[14],""); if (loyalty_counter==0) then scr_loyalty("Undevout","+"); // TODO in another PR rework how Non-Codex Size is determined, perhaps the inquisition needs to pass some checks or do an investigation event // which you could eventually interrupt (kill the team) and cover it up? diff --git a/objects/obj_controller/Alarm_6.gml b/objects/obj_controller/Alarm_6.gml index 039a9cc5e3..171a033801 100644 --- a/objects/obj_controller/Alarm_6.gml +++ b/objects/obj_controller/Alarm_6.gml @@ -10,6 +10,7 @@ if (menu==1) and (managing>0){ var manz=0,vanz=0,stahp=0; sel_promoting=1; + var _roles = active_roles(); for(var f=0; f0){ // sets up count for the marines if (man[f]=="man"){ manz+=1; - if (unit.role()==obj_ini.role[100][5]) { cap+=1;} - else if (unit.role()==obj_ini.role[100][15]) { apo+=1;} - else if (unit.role()==obj_ini.role[100][14]) { chap+=1;} - else if (unit.role()==obj_ini.role[100][17]) { lib+=1;} - else if (unit.role()==obj_ini.role[100][16]) { tech+=1;} - else if (unit.role()==obj_ini.role[100][6]) { drea+=1;} - else if (unit.role()==$"Venerable {obj_ini.role[100][6]}"){ vdrea+=1;} - else if (unit.role()==obj_ini.role[100][11]) { bear+=1;} - else if (unit.role()==obj_ini.role[100][8]) { tct+=1;} - else if (unit.role()==obj_ini.role[100][10]) { assa+=1;} - else if (unit.role()==obj_ini.role[100][9]) { dev+=1;} - else if (unit.role()==obj_ini.role[100][12]) { sco+=1;} - else if (unit.role()==obj_ini.role[100][2]) { hon+=1;} - else if (unit.role()==obj_ini.role[100][3]) { ve+=1;} - else if (unit.role()==obj_ini.role[100][4]) { ter+=1;} - else if (unit.role()==obj_ini.role[100][18]) { sgt++;} - else if (unit.role()==obj_ini.role[100][19]) { vet_sgt++;} + if (unit.role()==_roles[5]) { cap+=1;} + else if (unit.role()==_roles[15]) { apo+=1;} + else if (unit.role()==_roles[14]) { chap+=1;} + else if (unit.role()==_roles[17]) { lib+=1;} + else if (unit.role()==_roles[16]) { tech+=1;} + else if (unit.role()==_roles[6]) { drea+=1;} + else if (unit.role()==$"Venerable {_roles[6]}"){ vdrea+=1;} + else if (unit.role()==_roles[11]) { bear+=1;} + else if (unit.role()==_roles[8]) { tct+=1;} + else if (unit.role()==_roles[10]) { assa+=1;} + else if (unit.role()==_roles[9]) { dev+=1;} + else if (unit.role()==_roles[12]) { sco+=1;} + else if (unit.role()==_roles[2]) { hon+=1;} + else if (unit.role()==_roles[3]) { ve+=1;} + else if (unit.role()==_roles[4]) { ter+=1;} + else if (unit.role()==_roles[18]) { sgt++;} + else if (unit.role()==_roles[19]) { vet_sgt++;} else if (unit.role()=="Codiciery") { codi+=1;} else if (unit.role()=="Lexicanum") { lexi+=1;} - else if (unit.role()==obj_ini.role[100][eROLE.Ancient]) { champ+=1;} + else if (unit.role()==_roles[eROLE.Ancient]) { champ+=1;} } // sets up count for the vehicles // TODO This needs to be extended to accomodate the selection text like the man ones @@ -62,22 +63,22 @@ if (menu==1) and (managing>0){ selecting_dudes=""; // Infantry text if (cap>0){ - selecting_dudes+=string(cap)+" "+string(obj_ini.role[100][5]); + selecting_dudes+=string(cap)+" "+string(_roles[5]); if (cap>1) then selecting_dudes+="s"; selecting_dudes+=", "; } if (chap>0){ - selecting_dudes+=string(chap)+" "+string(obj_ini.role[100][14]); + selecting_dudes+=string(chap)+" "+string(_roles[14]); if (chap>1) then selecting_dudes+="s"; selecting_dudes+=", "; } if (champ>0){ - selecting_dudes+=$"{champ} {obj_ini.role[100][eROLE.Ancient]}"; + selecting_dudes+=$"{champ} {_roles[eROLE.Ancient]}"; if (chap>1) then selecting_dudes+="s"; selecting_dudes+=", "; } if (apo>0){ - selecting_dudes+=string(apo)+" "+string(obj_ini.role[100][15]); + selecting_dudes+=string(apo)+" "+string(_roles[15]); if (apo>1) then selecting_dudes+="s"; selecting_dudes+=", "; } @@ -97,17 +98,17 @@ if (menu==1) and (managing>0){ selecting_dudes+=", "; } if (bear>0){ - selecting_dudes+=string(bear)+" "+string(obj_ini.role[100][11]); + selecting_dudes+=string(bear)+" "+string(_roles[11]); if (bear>1) then selecting_dudes+="s"; selecting_dudes+=", "; } if (hon>0){ - selecting_dudes+=string(hon)+" "+string(obj_ini.role[100][2]); + selecting_dudes+=string(hon)+" "+string(_roles[2]); if (hon>1) then selecting_dudes+="s"; selecting_dudes+=", "; } if (tech>0){ - selecting_dudes+=string(tech)+" "+string(obj_ini.role[100][16]); + selecting_dudes+=string(tech)+" "+string(_roles[16]); if (tech>1) then selecting_dudes+="s"; selecting_dudes+=", "; } @@ -117,42 +118,42 @@ if (menu==1) and (managing>0){ selecting_dudes+=", "; } if (ve>0){ - selecting_dudes+=string(ve)+" "+string(obj_ini.role[100][3]); + selecting_dudes+=string(ve)+" "+string(_roles[3]); if (ve>1) then selecting_dudes+="s"; selecting_dudes+=", "; } if (tct>0){ - selecting_dudes+=string(tct)+" "+string(obj_ini.role[100][8]); + selecting_dudes+=string(tct)+" "+string(_roles[8]); if (tct>1) then selecting_dudes+="s"; selecting_dudes+=", "; } if (dev>0){ - selecting_dudes+=string(dev)+" "+string(obj_ini.role[100][9]); + selecting_dudes+=string(dev)+" "+string(_roles[9]); if (dev>1) then selecting_dudes+="s"; selecting_dudes+=", "; } if (assa>0){ - selecting_dudes+=string(assa)+" "+string(obj_ini.role[100][eROLE.Assault]); + selecting_dudes+=string(assa)+" "+string(_roles[eROLE.Assault]); if (sgt>1) then selecting_dudes+="s"; selecting_dudes+=", "; } if (sco>0){ - selecting_dudes+=string(sco)+" "+string(obj_ini.role[100][12]); + selecting_dudes+=string(sco)+" "+string(_roles[12]); if (sco>1) then selecting_dudes+="s"; selecting_dudes+=", "; } if (drea>0){ - selecting_dudes+=string(drea)+" "+string(obj_ini.role[100][6]); + selecting_dudes+=string(drea)+" "+string(_roles[6]); if (drea>1) then selecting_dudes+="s"; selecting_dudes+=", "; } if (sgt>0){ - selecting_dudes+=string(sgt)+" "+string(obj_ini.role[100][18]); + selecting_dudes+=string(sgt)+" "+string(_roles[18]); if (sgt>1) then selecting_dudes+="s"; selecting_dudes+=", "; } if (vet_sgt>0){ - selecting_dudes+=string(vet_sgt)+" "+string(obj_ini.role[100][19]); + selecting_dudes+=string(vet_sgt)+" "+string(_roles[19]); if (vet_sgt>1) then selecting_dudes+="s"; selecting_dudes+=", "; } diff --git a/objects/obj_ncombat/Alarm_1.gml b/objects/obj_ncombat/Alarm_1.gml index 53186af849..d467834988 100644 --- a/objects/obj_ncombat/Alarm_1.gml +++ b/objects/obj_ncombat/Alarm_1.gml @@ -1,5 +1,7 @@ var a1;a1=""; +var _roles = active_roles(); + if (ally>0) and (ally_forces>0){ if (ally=3){ @@ -133,24 +135,24 @@ if (string_count("_attack",battle_special)>0){ if (tacticals>0) and (veterans>0){ - p2=string(tacticals+veterans)+" "+string(obj_ini.role[100][8])+"s, "; + p2=string(tacticals+veterans)+" "+string(_roles[8])+"s, "; } if (tacticals>0) and (veterans=0){ - if (tacticals=1) then p2=string(tacticals)+" "+string(obj_ini.role[100][8])+", "; - if (tacticals>1) then p2=string(tacticals)+" "+string(obj_ini.role[100][8])+"s, "; + if (tacticals=1) then p2=string(tacticals)+" "+string(_roles[8])+", "; + if (tacticals>1) then p2=string(tacticals)+" "+string(_roles[8])+"s, "; } if (tacticals=0) and (veterans>0){ - if (veterans=1) then p2=string(veterans)+" "+string(obj_ini.role[100][3])+", "; - if (veterans>1) then p2=string(veterans)+" "+string(obj_ini.role[100][3])+"s, "; + if (veterans=1) then p2=string(veterans)+" "+string(_roles[3])+", "; + if (veterans>1) then p2=string(veterans)+" "+string(_roles[3])+"s, "; } if (assaults>0){ - if (assaults=1) then p2+=string(assaults)+" "+string(obj_ini.role[100][10])+", "; - if (assaults>1) then p2+=string(assaults)+" "+string(obj_ini.role[100][10])+"s, "; + if (assaults=1) then p2+=string(assaults)+" "+string(_roles[10])+", "; + if (assaults>1) then p2+=string(assaults)+" "+string(_roles[10])+"s, "; } if (devastators>0){ - if (devastators=1) then p2+=string(devastators)+" "+string(obj_ini.role[100][9])+", "; - if (devastators>1) then p2+=string(devastators)+" "+string(obj_ini.role[100][9])+"s, "; + if (devastators=1) then p2+=string(devastators)+" "+string(_roles[9])+", "; + if (devastators>1) then p2+=string(devastators)+" "+string(_roles[9])+"s, "; } if (temp<200) and (terminators>0){ @@ -159,37 +161,37 @@ if (temp<200) and (terminators>0){ } if (temp<200) and (chaplains>0){ - if (chaplains=1) then p2+=string(chaplains)+" "+string(obj_ini.role[100][14])+", "; - if (chaplains>1) then p2+=string(chaplains)+" "+string(obj_ini.role[100][14])+", "; + if (chaplains=1) then p2+=string(chaplains)+" "+string(_roles[14])+", "; + if (chaplains>1) then p2+=string(chaplains)+" "+string(_roles[14])+", "; } if (temp<200) and (apothecaries>0){ - if (apothecaries=1) then p2+=string(apothecaries)+" "+string(obj_ini.role[100][15])+", "; - if (apothecaries>1) then p2+=string(apothecaries)+" "+string(obj_ini.role[100][15])+", "; + if (apothecaries=1) then p2+=string(apothecaries)+" "+string(_roles[15])+", "; + if (apothecaries>1) then p2+=string(apothecaries)+" "+string(_roles[15])+", "; } if (temp<200) and (librarians>0){ - if (librarians=1) then p2+=string(librarians)+" "+string(obj_ini.role[100,17])+", "; - if (librarians>1) then p2+=string(librarians)+" "+string(obj_ini.role[100,17])+", "; + if (librarians=1) then p2+=string(librarians)+" "+string(_roles[17])+", "; + if (librarians>1) then p2+=string(librarians)+" "+string(_roles[17])+", "; } if (temp<200) and (techmarines>0){ - if (techmarines=1) then p2+=string(techmarines)+" "+string(obj_ini.role[100][16])+", "; - if (techmarines>1) then p2+=string(techmarines)+" "+string(obj_ini.role[100][16])+", "; + if (techmarines=1) then p2+=string(techmarines)+" "+string(_roles[16])+", "; + if (techmarines>1) then p2+=string(techmarines)+" "+string(_roles[16])+", "; } if (temp<200) and (sgts>0){ - if (techmarines=1) then p2+=string(techmarines)+" "+string(obj_ini.role[100][18])+", "; - if (techmarines>1) then p2+=string(techmarines)+" "+string(obj_ini.role[100][18])+", "; + if (techmarines=1) then p2+=string(techmarines)+" "+string(_roles[18])+", "; + if (techmarines>1) then p2+=string(techmarines)+" "+string(_roles[18])+", "; } if (temp<200) and (vet_sgts>0){ - if (techmarines=1) then p2+=string(techmarines)+" "+string(obj_ini.role[100][19])+", "; - if (techmarines>1) then p2+=string(techmarines)+" "+string(obj_ini.role[100][19])+", "; + if (techmarines=1) then p2+=string(techmarines)+" "+string(_roles[19])+", "; + if (techmarines>1) then p2+=string(techmarines)+" "+string(_roles[19])+", "; } if (scouts>0){ - if (scouts=1) then p2+=string(scouts)+" "+string(obj_ini.role[100][12])+", "; - if (scouts>1) then p2+=string(scouts)+" "+string(obj_ini.role[100][12])+"s, "; + if (scouts=1) then p2+=string(scouts)+" "+string(_roles[12])+", "; + if (scouts>1) then p2+=string(scouts)+" "+string(_roles[12])+"s, "; } @@ -226,8 +228,8 @@ if (standard_bearers>1) and (dropping=0) then p5=" Chapter Ancients hold your C if (dreadnoughts+predators+land_raiders>3){ p6=" Forming up the armoured division is "; - if (dreadnoughts=1) then p6+=string(dreadnoughts)+" "+string(obj_ini.role[100][6])+", "; - if (dreadnoughts>1) then p6+=string(dreadnoughts)+" "+string(obj_ini.role[100][6])+"s, "; + if (dreadnoughts=1) then p6+=string(dreadnoughts)+" "+string(_roles[6])+", "; + if (dreadnoughts>1) then p6+=string(dreadnoughts)+" "+string(_roles[6])+"s, "; if (rhinos=1) then p6+=string(rhinos)+" Rhino, "; if (rhinos>1) then p6+=string(rhinos)+" Rhinos, "; diff --git a/scripts/is_specialist/is_specialist.gml b/scripts/is_specialist/is_specialist.gml index b1449285d5..46041abf28 100644 --- a/scripts/is_specialist/is_specialist.gml +++ b/scripts/is_specialist/is_specialist.gml @@ -211,407 +211,3 @@ function is_specialist(unit_role, type = SPECIALISTS_STANDARD, include_trainee = return array_contains(_specialists, unit_role); } - -//TODO write this out with proper formatting when i can be assed -//Used to quikcly collect groups of marines with given parameters -// group takes a string relating to options in the role_groups function, to ignore filtering by group use "all" - // can also pass an array to filter for mutiple groups -// location takes wther a string with a system name or an array with 3 parameters [,,] -// if opposite is true then then the roles defined in the group argument are ignored and all others collected -// search conditions - // companies, takes either an int or an arrat to define which companies to search in - // any stat allowed by the stat_valuator basically allows you to look for marines whith certain stat lines - // job allows you to find marines forfuling certain tasks like garrison or forge etc - -function collect_role_group(group=SPECIALISTS_STANDARD, location="", opposite=false, search_conditions = {companies:"all"}){ - var _units = [], unit, count=0, _add=false, _is_special_group; - var _max_count = 0; - var _total_count = 0; - if (struct_exists(search_conditions, "max")){ - _max_count = search_conditions.max; - search_conditions.max_wanted = search_conditions.max; - } - search_conditions.group = group; - search_conditions.location = location; - search_conditions.opposite = opposite; - - var _conditions = new SearchConditions(search_conditions); - for (var com=0;com<=10;com++){ - if (_max_count>0){ - if (array_length(_units)>=_max_count){ - break; - } - } - var _wanted_companies = search_conditions.companies; - if (_wanted_companies!="all"){ - if (is_array(_wanted_companies)){ - if (!array_contains(_wanted_companies, com)){ - continue; - } - } else { - if (_wanted_companies != com){ - continue; - } - } - } - for (var i=0;i 0){ - found = 0; - } - - end_loop = false; - } - - update_constants(data); - - static oposite_switch = function(val){ - return opposite ? !val : val; - } - - static company_evaluate = function(){ - var _add = true; - if (search_companies){ - if (search_multiple_companies){ - if (!array_contains(_wanted_companies, unit.company)){ - _add = false; - } - } else { - if (_wanted_companies != unit.company){ - _add = false; - } - } - _add = oposite_switch(_add); - } - - return _add; - } - - static group_evaluate = function(){ - - var _add = true; - if (group!="all"){ - var _group = group; - if (group_is_array){ - if (group_search_heads) { - _add = unit.IsSpecialist(_group[0], _group[1], _group[2]); - } else { - _add = unit.IsSpecialist(_group[0], _group[1]); - } - } else { - _add = unit.IsSpecialist(_group); - } - _add = oposite_switch(_add); - } - return _add; - } - - static location_evaluate = function(){ - var _add = true; - if (location!=""){ - if (!complex_location){ - _add=unit.is_at_location(location); - } else { - _add=unit.is_at_location(location[0], location[1], location[2]); - } - _add = oposite_switch(_add); - } - - return _add; - } - - static checks_order = [ - company_evaluate, - group_evaluate, - location_evaluate - ]; - - - static evaluate = function(unit){ - self.unit = unit; - if (unit.name()==""){ - return false; - } - - var _add = true; - for (var i=0;i 0 && _add){ - found++; - if (found>max_wanted){ - _add = false; - end_loop = true; - } - } - - - return _add; - } - -} - - -function UnitGroup(units) constructor{ - self.units = units; - - static number = function(){ - return array_length(units); - } - - static has_role = function(role){ - for (var i=0;i _stat_val[1]){ - match = false; - break; - } - break; - - case "exless": - if (unit[$ _stat_val[0]] >= _stat_val[1]){ - match = false; - break; - } - break; - } - } - return match; -} - -function collect_by_religeon(religion, sub_cult="", location=""){ - var _units = [], unit, count=0, _add=false; - for (var com=0;com<=10;com++){ - for (var i=1;i 0) { - for (var veh = 0; veh < array_length(vehicles); veh++) { - unit = vehicles[veh]; - add_vehicle_to_manage_arrays(unit); - } - } - other_manage_data(); - man_current = 0; - man_max = MANAGE_MAN_MAX; - - if (selection_data.select_type == MissionSelectType.Squads){ - new_company_struct(); - company_data.has_squads = true; - company_data.squad_location = selection_data.system.name; - company_data.squad_search(); - managing = -1; - } - } - } catch (_exception) { - //handle and send player back to map - handle_exception(_exception); - scr_toggle_manage(); - } -} diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 5d41675791..c0f8f71ac8 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -689,9 +689,16 @@ function PlanetData(planet, system) constructor{ allegiance : "mechanicus" }); - if (array_length(_priests) > 0){ - text = ""; - scr_popup("Conflict of Interest",) + if (_priests.number > 0){ + if (_priests.number == _techmarines.number){ + text = "Without any technical staff wholly loyal to the chapter the TechPriests Quickly set too Work sequestering any valuable resources for the Omnissiah"; + text += + scr_popup("Mars Control"); + } else { + text = "After Unloading Marines too site it becomes clear there is discontent among the group.\n"; + text = "A contingent of the force comprised of Techpriests are unhappy with the decision.\n"; + scr_popup("Conflict of Interest",) + } } } @@ -1073,7 +1080,7 @@ function PlanetData(planet, system) constructor{ if (!is_hulk){ - if (improve=1){ + if (improve){ draw_set_color(c_green); draw_rectangle(xx+481,yy+280,xx+716,yy+298,0); draw_sprite(spr_requisition,0,xx+657,yy+283); diff --git a/scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.gml b/scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.gml new file mode 100644 index 0000000000..f9feafcad1 --- /dev/null +++ b/scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.gml @@ -0,0 +1,403 @@ +//TODO write this out with proper formatting when i can be assed +//Used to quikcly collect groups of marines with given parameters +// group takes a string relating to options in the role_groups function, to ignore filtering by group use "all" + // can also pass an array to filter for mutiple groups +// location takes wther a string with a system name or an array with 3 parameters [,,] +// if opposite is true then then the roles defined in the group argument are ignored and all others collected +// search conditions + // companies, takes either an int or an arrat to define which companies to search in + // any stat allowed by the stat_valuator basically allows you to look for marines whith certain stat lines + // job allows you to find marines forfuling certain tasks like garrison or forge etc + +function collect_role_group(group=SPECIALISTS_STANDARD, location="", opposite=false, search_conditions = {companies:"all"}){ + var _units = [], unit, count=0, _add=false, _is_special_group; + var _max_count = 0; + var _total_count = 0; + if (struct_exists(search_conditions, "max")){ + _max_count = search_conditions.max; + search_conditions.max_wanted = search_conditions.max; + } + search_conditions.group = group; + search_conditions.location = location; + search_conditions.opposite = opposite; + + var _conditions = new SearchConditions(search_conditions); + for (var com=0;com<=10;com++){ + if (_max_count>0){ + if (array_length(_units)>=_max_count){ + break; + } + } + var _wanted_companies = search_conditions.companies; + if (_wanted_companies!="all"){ + if (is_array(_wanted_companies)){ + if (!array_contains(_wanted_companies, com)){ + continue; + } + } else { + if (_wanted_companies != com){ + continue; + } + } + } + for (var i=0;i 0){ + found = 0; + } + + end_loop = false; + } + + update_constants(data); + + static oposite_switch = function(val){ + return opposite ? !val : val; + } + + static company_evaluate = function(){ + var _add = true; + if (search_companies){ + if (search_multiple_companies){ + if (!array_contains(_wanted_companies, unit.company)){ + _add = false; + } + } else { + if (_wanted_companies != unit.company){ + _add = false; + } + } + _add = oposite_switch(_add); + } + + return _add; + } + + static group_evaluate = function(){ + + var _add = true; + if (group!="all"){ + var _group = group; + if (group_is_array){ + if (group_search_heads) { + _add = unit.IsSpecialist(_group[0], _group[1], _group[2]); + } else { + _add = unit.IsSpecialist(_group[0], _group[1]); + } + } else { + _add = unit.IsSpecialist(_group); + } + _add = oposite_switch(_add); + } + return _add; + } + + static location_evaluate = function(){ + var _add = true; + if (location!=""){ + if (!complex_location){ + _add=unit.is_at_location(location); + } else { + _add=unit.is_at_location(location[0], location[1], location[2]); + } + _add = oposite_switch(_add); + } + + return _add; + } + + static checks_order = [ + company_evaluate, + group_evaluate, + location_evaluate + ]; + + + static evaluate = function(unit){ + self.unit = unit; + if (unit.name()==""){ + return false; + } + + var _add = true; + for (var i=0;i 0 && _add){ + found++; + if (found>max_wanted){ + _add = false; + end_loop = true; + } + } + + + return _add; + } + +} + + +function UnitGroup(units) constructor{ + self.units = units; + + static number = function(){ + return array_length(units); + } + + static has_role = function(role){ + for (var i=0;i _stat_val[1]){ + match = false; + break; + } + break; + + case "exless": + if (unit[$ _stat_val[0]] >= _stat_val[1]){ + match = false; + break; + } + break; + } + } + return match; +} + +function collect_by_religeon(religion, sub_cult="", location=""){ + var _units = [], unit, count=0, _add=false; + for (var com=0;com<=10;com++){ + for (var i=1;i 0) { + for (var veh = 0; veh < array_length(vehicles); veh++) { + unit = vehicles[veh]; + add_vehicle_to_manage_arrays(unit); + } + } + other_manage_data(); + man_current = 0; + man_max = MANAGE_MAN_MAX; + + if (selection_data.select_type == MissionSelectType.Squads){ + new_company_struct(); + company_data.has_squads = true; + company_data.squad_location = selection_data.system.name; + company_data.squad_search(); + managing = -1; + } + } + } catch (_exception) { + //handle and send player back to map + handle_exception(_exception); + scr_toggle_manage(); + } +} \ No newline at end of file diff --git a/scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.yy b/scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.yy new file mode 100644 index 0000000000..2d2594c762 --- /dev/null +++ b/scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.yy @@ -0,0 +1,13 @@ +{ + "$GMScript":"v1", + "%Name":"scr_UnitGroup_and_group_selection", + "isCompatibility":false, + "isDnD":false, + "name":"scr_UnitGroup_and_group_selection", + "parent":{ + "name":"marines_and_profiles", + "path":"folders/Scripts/marines_and_profiles.yy", + }, + "resourceType":"GMScript", + "resourceVersion":"2.0", +} \ No newline at end of file diff --git a/scripts/scr_specialist_training/scr_specialist_training.gml b/scripts/scr_specialist_training/scr_specialist_training.gml index 7cf686d1fa..7b52f7363b 100644 --- a/scripts/scr_specialist_training/scr_specialist_training.gml +++ b/scripts/scr_specialist_training/scr_specialist_training.gml @@ -1,14 +1,15 @@ function specialistfunct (specialist, req_exp) { + var _roles = active_roles(); var spec_tips = [ - string("{0} Potential", obj_ini.role[100][16]), - string("{0} Potential", obj_ini.role[100][15]), - string("{0} Potential", obj_ini.role[100][14]), - string("{0} Potential", obj_ini.role[100][17]), - string("{0} Applicant", obj_ini.role[100][16]), - string("{0} Applicant", obj_ini.role[100][15]), - string("{0} Applicant", obj_ini.role[100][14]), - string("{0} Applicant", obj_ini.role[100][17]), + string("{0} Potential", _roles[16]), + string("{0} Potential", _roles[15]), + string("{0} Potential", _roles[14]), + string("{0} Potential", _roles[17]), + string("{0} Applicant", _roles[16]), + string("{0} Applicant", _roles[15]), + string("{0} Applicant", _roles[14]), + string("{0} Applicant", _roles[17]), string("Promote to Marine") ]; @@ -50,7 +51,7 @@ function specialistfunct (specialist, req_exp) { break; } - if (role() == obj_ini.role[100][12]) { + if (role() == _roles[12]) { colors[0] = c_fuchsia; } @@ -59,7 +60,7 @@ function specialistfunct (specialist, req_exp) { } if (experience >= req_exp) { - if (!(role() == obj_ini.role[100][12])) { + if (!(role() == _roles[12])) { spec_tip = tips_list[1]; } else { spec_tip = tips_list[2]; @@ -77,6 +78,7 @@ function specialistfunct (specialist, req_exp) { // specialist - Integer index (0: Techmarine, 1: Librarian, 2: Chaplain, 3: Apothecary) // Returns: Array containing company and position of selected marine, or "none" if no suitable marine found function spec_data_set(specialist) { + var _roles = active_roles(); var _data = spec_train_data[specialist]; var _search = { "stat": _data.req, @@ -89,10 +91,10 @@ function spec_data_set(specialist) { var random_marine=scr_random_marine( // TODO LOW SEARCH_OPTIONAL // Make this function handle optional search_params [ - obj_ini.role[100][8], - obj_ini.role[100][18], - obj_ini.role[100][10], - obj_ini.role[100][9] + _roles[8], + _roles[18], + _roles[10], + _roles[9] ], _data.min_exp, _search @@ -102,13 +104,14 @@ function spec_data_set(specialist) { function apothecary_training(){ + var _roles = active_roles(); // ** Training ** // * Apothecary * var recruit_count=0; var training_points_values = ARR_apothecary_training_tiers; apothecary_recruit_points += training_points_values[training_apothecary] - novice_type = string("{0} Aspirant",obj_ini.role[100][15]) + novice_type = string("{0} Aspirant",_roles[15]) if (training_apothecary>0){ recruit_count=scr_role_count(novice_type,""); @@ -123,7 +126,7 @@ function apothecary_training(){ apothecary_recruit_points-=48; unit = fetch_unit(random_marine); scr_alert("green","recruitment",unit.name_role()+" has finished training.",0,0); - unit.update_role(obj_ini.role[100][15]); + unit.update_role(_roles[15]); unit.role_tag = [0, 0, 0, 0]; unit.add_exp(10); @@ -171,7 +174,7 @@ function apothecary_training(){ } } else { training_apothecary = 0; - scr_alert("red","recruitment",$"No marines available for {obj_ini.role[100][eROLE.Apothecary]} traning",0,0); + scr_alert("red","recruitment",$"No marines available for {_roles[eROLE.Apothecary]} traning",0,0); } } } @@ -179,13 +182,14 @@ function apothecary_training(){ function chaplain_training(){ + var _roles = active_roles(); // * Chaplain training * // TODO add functionality for Space Wolves and Iron Hands var recruit_count=0; var training_points_values = ARR_chaplain_training_tiers; if (global.chapter_name!="Space Wolves") and (global.chapter_name!="Iron Hands"){ chaplain_points += training_points_values[training_chaplain]; - novice_type = string("{0} Aspirant",obj_ini.role[100][14]); + novice_type = string("{0} Aspirant",_roles[14]); if (training_chaplain>0){ recruit_count=scr_role_count(novice_type,""); @@ -197,7 +201,7 @@ function chaplain_training(){ unit = fetch_unit(random_marine); scr_alert("green","recruitment",unit.name_role()+" has finished training.",0,0); chaplain_points-=48; - unit.update_role(obj_ini.role[100][14]); + unit.update_role(_roles[14]); unit.role_tag = [0, 0, 0, 0]; unit.add_exp(10); chaplain_aspirant=0; @@ -242,7 +246,7 @@ function chaplain_training(){ } } else { training_chaplain = 0; - scr_alert("red","recruitment",$"No remaining {obj_ini.role[100][eROLE.Chaplain]} applicant marines for training",0,0); + scr_alert("red","recruitment",$"No remaining {_roles[eROLE.Chaplain]} applicant marines for training",0,0); } } } @@ -251,6 +255,7 @@ function chaplain_training(){ function librarian_training(){ + var _roles = active_roles(); var recruit_count=0; // * Psycher Training * var training_points_values = ARR_chaplain_training_tiers; @@ -309,11 +314,12 @@ function librarian_training(){ } function techmarine_training(){ + var _roles = active_roles(); var recruit_count=0; var training_points_values = [ 0, 1,2,4,6,10,14]; tech_points += training_points_values[training_techmarine]; - novice_type = string("{0} Aspirant",obj_ini.role[100][16]); + novice_type = string("{0} Aspirant",_roles[16]); if (training_techmarine>0){ recruit_count=scr_role_count(novice_type,""); @@ -330,7 +336,7 @@ function techmarine_training(){ unit = fetch_unit(random_marine) tech_points-=360; - unit.update_role(obj_ini.role[100][16]); + unit.update_role(_roles[16]); unit.role_tag = [0, 0, 0, 0]; unit.add_exp(30); @@ -418,7 +424,7 @@ function techmarine_training(){ } } else{ training_techmarine = 0; - scr_alert("red","recruitment",$"No marines with sufficient technology aptitude for {obj_ini.role[100][eROLE.Techmarine]} training",0,0); + scr_alert("red","recruitment",$"No marines with sufficient technology aptitude for {_roles[eROLE.Techmarine]} training",0,0); } } } From 2f8b5179230e692427fdf1a3956242a92d7ac0f7 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Sun, 21 Dec 2025 02:32:52 +0000 Subject: [PATCH 27/31] compile and event tweaking --- .../scr_UnitGroup_and_group_selection.gml | 7 +- .../scr_chapter_managent_events.gml | 179 +++++++++++++++++- scripts/scr_event_code/scr_event_code.gml | 103 +--------- scripts/scr_random_event/scr_random_event.gml | 135 ++++--------- 4 files changed, 226 insertions(+), 198 deletions(-) diff --git a/scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.gml b/scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.gml index f9feafcad1..9276fc9794 100644 --- a/scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.gml +++ b/scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.gml @@ -67,7 +67,7 @@ function SearchConditions(data) constructor{ move_data_to_current_scope(data); group_is_complex = is_array(group); if (group_is_complex){ - if (array_length(_group) == 3){ + if (array_length(group) == 3){ group_search_heads = true; } else { group_search_heads = false; @@ -174,7 +174,7 @@ function SearchConditions(data) constructor{ if (_add){ if (struct_exists(self,"job")){ _add = oposite_switch((unit.assignment() == job)); - }); + } } if (_add){ @@ -185,7 +185,7 @@ function SearchConditions(data) constructor{ if (max_wanted > 0 && _add){ found++; - if (found>max_wanted){ + if (found > max_wanted){ _add = false; end_loop = true; } @@ -231,7 +231,6 @@ function UnitGroup(units) constructor{ return true; } } - return false; } diff --git a/scripts/scr_chapter_managent_events/scr_chapter_managent_events.gml b/scripts/scr_chapter_managent_events/scr_chapter_managent_events.gml index 48ca6fb654..d3a03fdf7e 100644 --- a/scripts/scr_chapter_managent_events/scr_chapter_managent_events.gml +++ b/scripts/scr_chapter_managent_events/scr_chapter_managent_events.gml @@ -285,4 +285,181 @@ function new_forge_master_chosen(pick){ scr_move_unit_info(pick.company, 0, pick.marine_number, i); } } -} \ No newline at end of file +} + + + +function strange_build_event(){ + log_message("RE: Fey Mood"); + var _search_params = {trait : ["crafter","tinkerer"], trait_any : true} + var marine_and_company = scr_random_marine("",0, _search_params); + if (marine_and_company == "none"){ + marine_and_company = scr_random_marine("",0, "none"); + } + if(marine_and_company != "none"){ + var marine = marine_and_company[0]; + var company = marine_and_company[1]; + var text=""; + var _unit = fetch_unit(marine_and_company); + var role = _unit.role(); + text = _unit.name_role(); + text+=" is taken by a strange mood and starts building!"; + + + var crafted_object; + var craft_roll=roll_dice_chapter(1, 100, "low"); + var heritical_item = false; + + //this bit should be improved, idk what duke was checking for here + //TODO make craft chance reflective of crafters skill, rewards players for having skilled tech area + if (scr_has_disadv("Tech-Heresy")) { + craft_roll+=20; + } + if (_unit.has_trait("tech_heretic")){ + craft_roll+=60; + } + if (scr_has_adv("Crafter")) { + if (craft_roll>80) { + craft_roll-=10; + } + if (craft_roll<60) { + craft_roll+=10; + } + } + + if (craft_roll<=50){ + crafted_object=choose("Icon","Icon","Statue"); + } + else if ((craft_roll>50) && (craft_roll<=60)) { + crafted_object=choose("Bike","Rhino"); + } + else if ((craft_roll>60) && (craft_roll<=80)) { + crafted_object="Artifact"; + } + else { + crafted_object=choose("baby","robot","demon","fusion"); + heritical_item=1; + } + + + add_event({ + e_id : "strange_building", + duration : 1, + name : _unit.name(), + company : company, + marine : marine, + crafted : crafted_object, + }) + + scr_popup("Can He Build marine?!?",text,"tech_build",""); + + var marine_is_planetside = _unit.planet_location>0; + if (marine_is_planetside && heritical_item) { + var _system = star_by_name(_unit.location_string); + var _planet = _unit.planet_location; + if (_system!="none"){ + with (_system){ + p_hurssy[_planet]+=6; + p_hurssy_time[_planet]=2; + } + } + } + else if (!marine_is_planetside and heritical_item){ + var _fleet = find_ships_fleet(_unit.ship_location); + if (_fleet!="none"){ + //the intended code for here was to add some sort of chaos event on the ship stashed up ready to fire in a few turns + } + } + return true; + } + return false; +} + +function init_mutated_gene_random_event(){ + //TODO make reprocussions to ignoring this + log_message("RE: Gene-Seed Mutation"); + var text = "The Chapter's gene-seed has mutated! Apothecaries are scrambling to control the damage and prevent further contamination. What is thy will?"; + var _opt1 = "Dispose of "; + var _percent_remove = 0; + if (obj_controller.gene_seed <= 30) { + _opt1 += "100% of the gene-seed."; + _percent_remove = 100; + } + if ((obj_controller.gene_seed > 30) && (obj_controller.gene_seed < 60)) { + _opt1 += "50% of all gene-seed."; + _percent_remove = 50; + } + if (obj_controller.gene_seed >= 60) { + _opt1 += "33% of all gene-seed."; + _percent_remove = 33; + } + + var _opt2 = "Tell the apothecaries to let it be."; + + + var _pop_data = { + percent_remove : _percent_remove, + options : [ + { + str1:_opt1, + choice_func : event_dispose_of_mutated_gene, + }, + { + str1:_opt2, + choice_func : function(){ + scr_loyalty("Mutant Gene-Seed", "+"); + popup_default_close(); + } + }, + ] + } + + scr_popup("Gene-Seed Mutated!",text,"gene_bad",_pop_data); + scr_event_log("red","The Chapter Gene-Seed has mutated."); + + return true; +} + + +function event_dispose_of_mutated_gene(){ + if (pop_data.percent_remove > 0){ + obj_controller.gene_seed -= (obj_controller.gene_seed * (pop_data.percent_remove/100)) + } + popup_default_close(); +} + + +function init_marine_distinguishment_event(){ + log_message("RE: Promotion"); + var marine_and_company = scr_random_marine([obj_ini.role[100][8],obj_ini.role[100][12],obj_ini.role[100][9],obj_ini.role[100][10]],0); + if(marine_and_company == "none") + { + log_error("RE: Promotion, couldn't pick a space marine"); + return false; + } + var marine=marine_and_company[1]; + var company=marine_and_company[0]; + var _unit = fetch_unit(marine_and_company); + var role=_unit.role(); + var text = _unit.name_role(); + var company_text = scr_convert_company_to_string(company); + //var company_text = scr_company_string(company); + if(company_text != ""){ + company_text = $"({company_text})"; + } + text += company_text; + text += " has distinguished himself.\n\nHe is up for review to be promoted."; + + if (company != 10){ + _unit.add_exp(10); + } + else { + _unit.add_exp(max(20, _unit.experience)); + } + + scr_popup("Promotions!",text,"distinguished",""); + scr_event_log("green",text); + return true; +} + + diff --git a/scripts/scr_event_code/scr_event_code.gml b/scripts/scr_event_code/scr_event_code.gml index 35bf476edc..e71fd4f1f7 100644 --- a/scripts/scr_event_code/scr_event_code.gml +++ b/scripts/scr_event_code/scr_event_code.gml @@ -92,7 +92,7 @@ function event_end_turn_action(){ // Starts chaos invasion if (_event.e_id=="chaos_invasion"){ var xx=0,yy=0,flee=0,dirr=0; - var star_id = scr_random_find(1,true,"",""); + var star_id = scr_random_find(0,true,"",""); if(star_id != undefined){ scr_event_log("purple",$"Chaos Fleets exit the warp near the {star_id.name} system.", star_id.name); for(var j=0; j<4; j++){ @@ -103,9 +103,9 @@ function event_end_turn_action(){ flee.owner=eFACTION.Chaos; flee.sprite_index=spr_fleet_chaos; flee.image_index=4; - flee.capital_number=choose(0,1); - flee.frigate_number=choose(2,3); - flee.escort_number=choose(4,5,6); + flee.capital_number=choose(0,0,0,1); + flee.frigate_number=choose(2,2,,3); + flee.escort_number=choose(4,4,4,5,6); flee.cargo_data.csm = true; obj_controller.chaos_fleets+=1; flee.action_x=star_id.x; @@ -301,91 +301,6 @@ function handle_discovered_governor_assasinations(){ } } -function strange_build_event(){ - log_message("RE: Fey Mood"); - var _search_params = {trait : ["crafter","tinkerer"], trait_any : true} - var marine_and_company = scr_random_marine("",0, _search_params); - if (marine_and_company == "none"){ - marine_and_company = scr_random_marine("",0, "none"); - } - if(marine_and_company != "none"){ - var marine = marine_and_company[0]; - var company = marine_and_company[1]; - var text=""; - var _unit = fetch_unit(marine_and_company); - var role = _unit.role(); - text = _unit.name_role(); - text+=" is taken by a strange mood and starts building!"; - - - var crafted_object; - var craft_roll=roll_dice_chapter(1, 100, "low"); - var heritical_item = false; - - //this bit should be improved, idk what duke was checking for here - //TODO make craft chance reflective of crafters skill, rewards players for having skilled tech area - if (scr_has_disadv("Tech-Heresy")) { - craft_roll+=20; - } - if (_unit.has_trait("tech_heretic")){ - craft_roll+=60; - } - if (scr_has_adv("Crafter")) { - if (craft_roll>80) { - craft_roll-=10; - } - if (craft_roll<60) { - craft_roll+=10; - } - } - - if (craft_roll<=50){ - crafted_object=choose("Icon","Icon","Statue"); - } - else if ((craft_roll>50) && (craft_roll<=60)) { - crafted_object=choose("Bike","Rhino"); - } - else if ((craft_roll>60) && (craft_roll<=80)) { - crafted_object="Artifact"; - } - else { - crafted_object=choose("baby","robot","demon","fusion"); - heritical_item=1; - } - - - add_event({ - e_id : "strange_building", - duration : 1, - name : _unit.name(), - company : company, - marine : marine, - crafted : crafted_object, - }) - - scr_popup("Can He Build marine?!?",text,"tech_build",""); - - var marine_is_planetside = _unit.planet_location>0; - if (marine_is_planetside && heritical_item) { - var _system = star_by_name(_unit.location_string); - var _planet = _unit.planet_location; - if (_system!="none"){ - with (_system){ - p_hurssy[_planet]+=6; - p_hurssy_time[_planet]=2; - } - } - } - else if (!marine_is_planetside and heritical_item){ - var _fleet = find_ships_fleet(_unit.ship_location); - if (_fleet!="none"){ - //the intended code for here was to add some sort of chaos event on the ship stashed up ready to fire in a few turns - } - } - return true; - } - return false; -} function make_faction_enemy_event(){ log_message("RE: Enemy"); @@ -405,7 +320,7 @@ function make_faction_enemy_event(){ if(array_length(factions) == 0){ log_error("RE: Enemy, no faction could be chosen"); - exit; + return false; } var chosen_faction = array_random_element(factions); @@ -449,12 +364,4 @@ function make_faction_enemy_event(){ return true; } return false; -} - - -function event_dispose_of_mutated_gene(){ - if (pop_data.percent_remove > 0){ - obj_controller.gene_seed -= (obj_controller.gene_seed * (pop_data.percent_remove/100)) - } - popup_default_close(); } \ No newline at end of file diff --git a/scripts/scr_random_event/scr_random_event.gml b/scripts/scr_random_event/scr_random_event.gml index b02d9853b5..c46129c8a9 100644 --- a/scripts/scr_random_event/scr_random_event.gml +++ b/scripts/scr_random_event/scr_random_event.gml @@ -36,7 +36,9 @@ function scr_random_event(execute_now) { if(execute_now) { var random_event_roll = irandom(100); - if ((last_event+30)<=turn) then random_event_roll=1;// If 30 turns without random event then do one + if ((last_event+30)<=turn){ + random_event_roll=1;// If 30 turns without random event then do one + } if (random_event_roll>5) then exit;// Frequency of events if ((turn-15) 1500){ + luck_roll+=20; + } + else if (obj_controller.marines > 1000){ + luck_roll+=10; + } + else if (obj_controller.marines > 500){ + luck_roll+=5; + }else if (obj_controller.marines <500){ + luck_roll-=5; + } + if (luck_roll<=45) then player_luck=luck.good; if (luck_roll>45) and (luck_roll<55) then player_luck=luck.neutral; if (luck_roll>=55) then player_luck=luck.bad; @@ -82,11 +96,11 @@ function scr_random_event(execute_now) { [ EVENT.warp_storms, EVENT.enemy_forces, - EVENT.crusade, // Reportly breaks often because of lack of imperial fleets and eats player ships // TODO LOW CRUSADE_EVENT // fix + EVENT.crusade, EVENT.enemy, // Save-scumming event, Should probably base this on something else than tech-scavs EVENT.mutation, EVENT.ship_lost, // Another save-scumming event, mainly due to rarity of player ships - //EVENT.chaos_invasion, // Spawns Chaos fleets way too close to player owned worlds with no warning and usually lots of big ships, save-scum galore and encourages fleet-based chapters // TODO LOW INVASION_EVENT // Make them spawn way farther with more warning, make them have a different goal or remove this event entirely + EVENT.chaos_invasion, EVENT.necron_awaken, // Inquisitor check for this is inverted EVENT.fallen, // Event mission cannot be completed and never expires // TODO LOW FALLEN_EVENT // fix ]; @@ -122,7 +136,7 @@ function scr_random_event(execute_now) { } break; case EVENT.mechanicus_mission: - if (known[eFACTION.Mechanicus] == 0 || obj_controller.disposition[3] < 50 || obj_controller.faction_status[eFACTION.Mechanicus] == "War") { + if (known[eFACTION.Mechanicus] == 0 || obj_controller.disposition[3] < 40 || obj_controller.faction_status[eFACTION.Mechanicus] == "War") { events_share[i] -= 1; events_total -= 1; } @@ -132,10 +146,7 @@ function scr_random_event(execute_now) { } break; case EVENT.enemy: - if(scr_has_adv("Scavangers")){ - events_share[i] += 2; - events_total += 2; - } + break; case EVENT.mutation: if(gene_seed < 5){ @@ -275,36 +286,7 @@ function scr_random_event(execute_now) { } else if (chosen_event == EVENT.promotion){ - log_message("RE: Promotion"); - var marine_and_company = scr_random_marine([obj_ini.role[100][8],obj_ini.role[100][12],obj_ini.role[100][9],obj_ini.role[100][10]],0); - if(marine_and_company == "none") - { - log_error("RE: Promotion, couldn't pick a space marine"); - exit; - } - var marine=marine_and_company[1]; - var company=marine_and_company[0]; - var _unit = obj_ini.TTRPG[company][marine]; - var role=_unit.role(); - var text = _unit.name_role(); - var company_text = scr_convert_company_to_string(company); - //var company_text = scr_company_string(company); - if(company_text != ""){ - company_text = "("+company_text+")"; - } - text += company_text; - text += " has distinguished himself.##He åis up for review to be promoted."; - - if (company != 10){ - _unit.add_exp(10); - } - else { - _unit.add_exp(max(20, _unit.experience)); - } - - scr_popup("Promotions!",text,"distinguished",""); - scr_event_log("green",text); - _evented = true; + _evented = init_marine_distinguishment_event() } else if (chosen_event == EVENT.strange_building){ @@ -659,11 +641,11 @@ function scr_random_event(execute_now) { log_error("RE: Enemy Forces, couldn't find a planet in the " + star_id.name +" system for the enemy"); exit; } - var planet = eligible_planets[irandom(array_length(eligible_planets) - 1)]; + var planet = array_random_element(eligible_planets); //var enemy = choose(7,8,9,10,13); var enemy = choose(7,8,9); var text; - var max_enemies_on_planet = 5; // I don't know the actual value, i need to change it; + var max_enemies_on_planet = 6; // I don't know the actual value, i need to change it; switch(enemy) { case 7: @@ -681,22 +663,22 @@ function scr_random_event(execute_now) { star_id.p_tyranids[planet] += 5; star_id.p_tyranids[planet] = min(star_id.p_tyranids[planet], max_enemies_on_planet); break; - //case 10: this doesn't work - // text = "Heretics"; - // star_id.p_heretics[planet] = 4; - // star_id.p_heretics[planet] = min(star_id.p_heretics[planet], max_enemies_on_planet); - // break; - //case 13: - // text = "Necron"; // I don't know if its a good idea to spawn necrons from this event, leaving it in for now - // star_id.p_necron[planet] = 4; - // star_id.p_necron[planet] = min(star_id.p_necron[planet], max_enemies_on_planet); - // break; + case 10: + text = "Heretics"; + star_id.p_heretics[planet] = 4; + star_id.p_heretics[planet] = min(star_id.p_heretics[planet], max_enemies_on_planet); + break; + case 13: + text = "Necron"; // I don't know if its a good idea to spawn necrons from this event, leaving it in for now + star_id.p_necron[planet] = 4; + star_id.p_necron[planet] = min(star_id.p_necron[planet], max_enemies_on_planet); + break; default: log_error("RE: Enemy Forces, couldn't pick an enemy faction"); exit; } - scr_alert("red","enemy", $"{text} forces suddenly appear at {star_id.name} {planet}!",star_id.x,star_id.y); - scr_event_log("red",$"{text} forces suddenly appear at {star_id.name} {planet}!"); + scr_alert("red","enemy", $"A Space Hulk carrying {text} breaches Space and has crashed Into {star_id.name} {planet}!",star_id.x,star_id.y); + scr_event_log("red",$"A Space Hulk carrying {text} Space Hulk Crashes Into System {star_id.name} {planet}!"); _evented = true; } } @@ -711,47 +693,7 @@ function scr_random_event(execute_now) { } else if ((chosen_event == EVENT.mutation)) { - //TODO make reprocussions to ignoring this - log_message("RE: Gene-Seed Mutation"); - var text = "The Chapter's gene-seed has mutated! Apothecaries are scrambling to control the damage and prevent further contamination. What is thy will?"; - var _opt1 = "Dispose of "; - var _percent_remove = 0; - if (obj_controller.gene_seed <= 30) { - _opt1 += "100% of the gene-seed."; - _percent_remove = 100; - } - if ((obj_controller.gene_seed > 30) && (obj_controller.gene_seed < 60)) { - _opt1 += "50% of all gene-seed."; - _percent_remove = 50; - } - if (obj_controller.gene_seed >= 60) { - _opt1 += "33% of all gene-seed."; - _percent_remove = 33; - } - - var _opt2 = "Tell the apothecaries to let it be."; - - - var _pop_data = { - percent_remove : _percent_remove, - options : [ - { - str1:_opt1, - choice_func : event_dispose_of_mutated_gene, - }, - { - str1:_opt2, - choice_func : function(){ - scr_loyalty("Mutant Gene-Seed", "+"); - popup_default_close(); - } - }, - ] - } - - scr_popup("Gene-Seed Mutated!",text,"gene_bad",_pop_data); - _evented = true; - scr_event_log("red","The Chapter Gene-Seed has mutated."); + init_mutated_gene_random_event(); } else if (chosen_event == EVENT.ship_lost){ @@ -842,10 +784,13 @@ function event_fallen(){ log_error("RE: Hunt the Fallen, coulnd't assign a problem to the planet"); return; } + + var _planet = system_datas[planet]; + _planet.refresh_data(); - var text = "Sources indicate one of the Fallen may be upon "+string(star.name)+" "+string(scr_roman(planet))+". We have "+string(eta)+" months to send out a strike team and scour the planet. Any longer and any Fallen that might be there will have escaped."; + var text = $"Sources indicate one of the Fallen may be upon {_planet.name()} . We have {eta} months to send out a strike team and scour the planet. Any longer and any Fallen that might be there will have escaped."; scr_popup("Hunt the Fallen",text,"fallen",""); - scr_event_log("","Sources indicate one of the Fallen may be upon "+string(star.name)+" "+string(scr_roman(planet))+". We have "+string(eta)+" months to investigate."); + scr_event_log("",$"Sources indicate one of the Fallen may be upon {_planet.name()}. We have {eta} months to investigate."); var star_alert = instance_create(star.x+16,star.y-24,obj_star_event); star_alert.image_alpha=1; star_alert.image_speed=1; From 5f1c21b57a04463c5923227b79282b389cb86526 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Sun, 21 Dec 2025 03:19:19 +0000 Subject: [PATCH 28/31] governor profiles --- ChapterMaster.yyp | 1 + objects/obj_star/Create_0.gml | 5 + scripts/scr_PlanetData/scr_PlanetData.gml | 99 +++++++++++ scripts/scr_governors/scr_governors.gml | 29 ++++ scripts/scr_governors/scr_governors.yy | 13 ++ scripts/scr_purge_world/scr_purge_world.gml | 174 +++++--------------- 6 files changed, 190 insertions(+), 131 deletions(-) create mode 100644 scripts/scr_governors/scr_governors.gml create mode 100644 scripts/scr_governors/scr_governors.yy diff --git a/ChapterMaster.yyp b/ChapterMaster.yyp index 6869cb597b..5ca74e6db3 100644 --- a/ChapterMaster.yyp +++ b/ChapterMaster.yyp @@ -830,6 +830,7 @@ {"id":{"name":"scr_get_item_names","path":"scripts/scr_get_item_names/scr_get_item_names.yy",},}, {"id":{"name":"scr_gift_items","path":"scripts/scr_gift_items/scr_gift_items.yy",},}, {"id":{"name":"scr_gov_disp","path":"scripts/scr_gov_disp/scr_gov_disp.yy",},}, + {"id":{"name":"scr_governors","path":"scripts/scr_governors/scr_governors.yy",},}, {"id":{"name":"scr_ground_ai_helpers","path":"scripts/scr_ground_ai_helpers/scr_ground_ai_helpers.yy",},}, {"id":{"name":"scr_has_adv","path":"scripts/scr_has_adv/scr_has_adv.yy",},}, {"id":{"name":"scr_has_disadv","path":"scripts/scr_has_disadv/scr_has_disadv.yy",},}, diff --git a/objects/obj_star/Create_0.gml b/objects/obj_star/Create_0.gml index 936b1e2bfa..23f59b6afe 100644 --- a/objects/obj_star/Create_0.gml +++ b/objects/obj_star/Create_0.gml @@ -69,6 +69,11 @@ p_influence = array_create_advanced(_planet_array_size, array_create(15, 0)); p_problem = array_create_advanced(_planet_array_size, array_create(8, "")); p_problem_other_data = array_create_advanced(_planet_array_size, array_create_advanced(8, {})); p_timer = array_create_advanced(_planet_array_size, array_create(8, -1)); +p_governor = []; + +for (var i=1;i<8;i++){ + array_push(p_governor, new GovernorProfile()); +} system_datas = array_create(8, 0); diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index c0f8f71ac8..dbcdc3a425 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -1851,6 +1851,105 @@ function PlanetData(planet, system) constructor{ } } + static purge = scr_purge_world; + + static assasinate_governor_setup = function(){ + var aroll=roll_dice_chapter(1, 100, "high"); + var chance = 100; + // var siz_penalty=0; + var o=0; + var yep=0; + + // Disposition + aroll += floor(star.dispo[planet] / 10); + + // Advantages + if (scr_has_adv("Ambushers")){ + aroll+=10; + } + if (scr_has_adv("Lightning Warriors")){ + aroll+=5; + } + + // Size - unused + // if ((action_score > 5) && (action_score <= 10)) { siz_penalty = 5; } + // if ((action_score > 10) && (action_score <= 20)) { siz_penalty = 20; } + // if ((action_score > 20) && (action_score <= 50)) { siz_penalty = 30; } + // if ((action_score > 50) && (action_score <= 100)) { siz_penalty = 50; } + // if ((action_score > 100) && (action_score <= 200)) { siz_penalty = 75; } + // if (action_score > 200) { siz_penalty = 125; } + + var spec1=0,spec2=0,txt=""; // TODO consider making it a battle with Planetary governor's guards + txt="Your Astartes descend upon the surface of {name()} and plot the movements and schedule of the governor. "; + txt+="Once the time is right their target is ambushed " + txt+="choose("in their home","in the streets","while driving","taking a piss")+" and tranquilized. "; + + if(scr_has_disadv("Never Forgive")) then spec1=1; + if (global.chapter_name="Space Wolves" || obj_ini.progenitor == ePROGENITOR.SPACE_WOLVES) { + spec1=3; + } + else if (global.chapter_name="Iron Hands" || obj_ini.progenitor == ePROGENITOR.IRON_HANDS) { + spec1=6; + } + if (obj_ini.omophagea=1){ + spec1=choose(spec1,20); + } + + if (spec1=1) then txt+="They are brought to the already-prepared facilities for Fallen, tortured to make "+string(choose("him","him","her"))+" appear a heretic, and then incinerated. "; + if (spec1=3) then txt+=string(choose("He","He","She"))+" is tossed to the Fenrisian Wolves and viciously mauled, torn apart, and eaten. The beasts leave nothing but bloody scraps. "; + if (spec1=6) then txt+=string(choose("He","He","She"))+" is stuck in with the other criminals, and scum, to be turned into a servitor. Soon nothing remains that could be likened to the former Governor. "; + if (spec1=20){ + if (action_score>1) then txt+="Things get out of hand, and the Governor is torn limb from limb and consumed. "+string(choose("His","His","Her"))+" flesh is torn off and eaten, bone pulverized, and marrow sucked free. "; + if (action_score=1) then txt+="Your battle brother chops apart the Governor and eats a sizeable portion of "+string(choose("his","his","her"))+" flesh, focusing upon the eyes, teeth, and fingers. Once full the rest is disposed of. "; + } + + if (spec1=0){ + spec2=choose(1,2,3,4,5,5,5); + if (spec2=1) then txt+="Their still-living body is disintegrated by acid. "; + if (spec2=2) then txt+="The Governor is jettisoned into the local star at the first opporunity. "; + if (spec2=3) then txt+=string(choose("He","He","She"))+" is burned as fuel for one of your vessels. "; + if (spec2=4) then txt+="A few grenades is all it takes to blow "+string(choose("his","his","her"))+" body to smithereens. "; + if (spec2=5) then txt+=string(choose("He","He","She"))+" is executed in a mundane fashion and buried. "; + } + + txt+="What is thy will?"; + + var pip=instance_create(0,0,obj_popup); + pip.title="Planetary Governor Assassinated"; + pip.text=txt; + pip.planet=planet; + pip.p_data = new PlanetData(planet,star); + var options = [ + { + str1 : "Allow the official successor to become Planetary Governor.", + choice_func : allow_governor_successor, + }, + { + str1 : "Ensure that a sympathetic successor will be the one to rule.", + choice_func : install_sympathetic_successor, + }, + { + str1 : "Remove all successors and install a loyal Chapter Serf.", + choice_func : install_chapter_surf, + }, + ] + pip.add_option(options); + pip.cooldown=20; + + // Result- this is the multiplier for the chance of discovery with the inquisition, can also be used to determine + // the new Governor disposition if they are the official successor + if (aroll < chance){// Discovered + pip.estimate=2; + } else if (aroll >= chance){// Success + pip.estimate=1; + } + // If there are enemy non-chaos forces then they may be used as a cover + // Does not work with chaos because if the governor dies, with chaos present, the new governor would possibly be investigated + if (planet_forces[eFACTION.Ork]>=4) or (planet_forces[eFACTION.Necrons]>=3) or (planet_forces[eFACTION.Tyranids]>=5){ + pip.estimate=pip.estimate*0.5; + } + } + } diff --git a/scripts/scr_governors/scr_governors.gml b/scripts/scr_governors/scr_governors.gml new file mode 100644 index 0000000000..fa2c8ea1ba --- /dev/null +++ b/scripts/scr_governors/scr_governors.gml @@ -0,0 +1,29 @@ +function GovernorProfile(){ + born = obj_controlller.turn - irandom_range(240,2400); + + static age = function(){ + born - obj_controlller.turn; + } + + gender = choose(GENDER.Female,GENDER.Male); + + name = global.name_generator.generate_imperial_name(); + + astartes_view = irandom(4);//0 hates astartes 4 likes astartes + + sector_commander_view = irandom(4); + + personal_security = irandom(4); + + constitution = 10; + strength = 10; + luck = 10; + dexterity = 10; + wisdom = irandom_range(25, 50); + piety = irandom_range(25, 60); + charisma = irandom_range(25, 60); + technology = irandom_range(10, 40); + intelligence = irandom_range(25, 50); + weapon_skill = 5; + ballistic_skill = 5; +} \ No newline at end of file diff --git a/scripts/scr_governors/scr_governors.yy b/scripts/scr_governors/scr_governors.yy new file mode 100644 index 0000000000..99d71d1e81 --- /dev/null +++ b/scripts/scr_governors/scr_governors.yy @@ -0,0 +1,13 @@ +{ + "$GMScript":"v1", + "%Name":"scr_governors", + "isCompatibility":false, + "isDnD":false, + "name":"scr_governors", + "parent":{ + "name":"marines_and_profiles", + "path":"folders/Scripts/marines_and_profiles.yy", + }, + "resourceType":"GMScript", + "resourceVersion":"2.0", +} \ No newline at end of file diff --git a/scripts/scr_purge_world/scr_purge_world.gml b/scripts/scr_purge_world/scr_purge_world.gml index b81a2eae37..df567654e4 100644 --- a/scripts/scr_purge_world/scr_purge_world.gml +++ b/scripts/scr_purge_world/scr_purge_world.gml @@ -1,19 +1,19 @@ function scr_purge_world(star, planet, action_type, action_score) { - var pop_before,pop_after,sci1,sci2,txt1,txt2, max_kill, overkill, heres_before, heres_after, kill; + var pop_before,pop_after,sci1,influence_reduction,txt1,txt2, max_kill, overkill, heres_before, heres_after, kill; var isquest,thequest,questnum;isquest=0;thequest="";questnum=0;pop_after=0;txt1="";txt2="";overkill=0; if ((action_type==DropType.PurgeFire) or (action_type==DropType.PurgeSelective)) and (star.p_traitors[planet]=0) and (star.p_chaos[planet]=0) and (obj_controller.turn>=obj_controller.chaos_turn){ - if (planet_feature_bool(star.p_feature[planet],P_features.Warlord10) == 1) and (obj_controller.known[10]=0) and (obj_controller.faction_gender[10]=1) then with(obj_drop_select){ + if (has_feature(P_features.Warlord10) == 1) and (obj_controller.known[10]=0) and (obj_controller.faction_gender[10]=1) then with(obj_drop_select){ var pop=instance_create(0,0,obj_popup); pop.image="chaos_symbol"; pop.title="Concealed Heresy"; pop.text=$"Your astartes set out and begin to cleanse {planet_numeral_name(planet, star)} of possible heresy. The general populace appears to be devout in their faith, but a disturbing trend appears- the odd citizen cursing your forces, frothing at the mouth, and screaming out heresy most foul. One week into the cleansing a large hostile force is detected approaching and encircling your forces."; exit; } - if (planet_feature_bool(star.p_feature[planet],P_features.Warlord10) == 1) and (obj_controller.known[10]>=2) and (obj_controller.faction_gender[10]=1) then with(obj_drop_select){ + if (has_feature(P_features.Warlord10) == 1) and (obj_controller.known[10]>=2) and (obj_controller.faction_gender[10]=1) then with(obj_drop_select){ attacking=10; obj_controller.cooldown=30;combating=1;// Start battle here @@ -60,9 +60,8 @@ function scr_purge_world(star, planet, action_type, action_score) { txt1+=choose(" position themselves over the target in close orbit, and unleash", " unload"); if (ships_selected=1) then txt1+="s"; txt1+= $" annihilation upon {planet_numeral_name(planet, star)}. Even from space the explosions can be seen, {choose("tearing ground", "hammering", "battering", "thundering")} across the planet's surface."; - - if (star.p_large[planet]=0) then max_kill=action_score*15000000; - if (star.p_large[planet]=1) then max_kill=action_score*0.015;// Population if large + + max_kill = population_small_conversion(0.015) * max_kill; pop_before=star.p_population[planet]; @@ -75,26 +74,27 @@ function scr_purge_world(star, planet, action_type, action_score) { kill=min(max_kill,overkill,pop_before);// How many people ARE going to be killed pop_after=pop_before-kill; - sci1=0;sci2=0; + sci1=0; + influence_reduction=0; if (pop_before>0) then sci1=(pop_after/pop_before)*100;// Relative % of people murderized - if (sci1>0) then sci2=min((sci1*2),action_score*2);// How much hurresy to get rid of - heres_after=heres_before-sci2; + if (sci1>0) then influence_reduction=min((sci1*2),action_score*2);// How much hurresy to get rid of + heres_after=heres_before-influence_reduction; if (pop_before>0) and (pop_after=0) then heres_after=0; - if (star.p_large[planet]=0) then pop_after=round(pop_after); + if (!population_large) then pop_after=round(pop_after); if (pop_after<=0) and (pop_before>0) then heres_after=0; - var _displayed_population = star.p_large[planet] == 1 ? $"{pop_before} billion" : scr_display_number(floor(pop_before)); - var _displayed_killed = star.p_large[planet] == 1 ? $"{kill} billion" : scr_display_number(floor(kill)); + var _displayed_population = large_population ? $"{pop_before} billion" : scr_display_number(floor(pop_before)); + var _displayed_killed = large_population ? $"{kill} billion" : scr_display_number(floor(kill)); txt1 += $"##The world had {_displayed_population} Imperium subjects. {_displayed_killed} were purged over the duration of the bombardment.##Heresy has fallen down to {max(0, heres_after)}%."; if (pop_after<=0){ if (star.p_owner[planet]=2) and (obj_controller.faction_status[2]!="War"){ - if (star.p_type[planet]="Temperate" || star.p_type[planet]="Hive" || star.p_type[planet]="Desert"){ + if (planet_type="Temperate" || planet_type="Hive" || planet_type="Desert"){ var _disp_hit = -10; - if (star.p_type[planet]="Temperate") then _disp_hit = -5; - if (star.p_type[planet]="Desert") then _disp_hit = -3; + if (planet_type="Temperate") then _disp_hit = -5; + if (planet_type="Desert") then _disp_hit = -3; scr_audience(eFACTION.Imperium, "bombard_angry", _disp_hit, "", 0, 0); } @@ -102,8 +102,8 @@ function scr_purge_world(star, planet, action_type, action_score) { } if (star.p_owner[planet]=3) and (obj_controller.faction_status[3]!="War"){ - if (star.p_type[planet]="Forge") then _disp_hit =-15; - if (star.p_type[planet]="Ice") then _disp_hit =-7; + if (planet_type="Forge") then _disp_hit =-15; + if (planet_type="Ice") then _disp_hit =-7; scr_audience(eFACTION.Inquisition, "bombard_angry", _disp_hit, "", 0, 0); } @@ -133,11 +133,11 @@ function scr_purge_world(star, planet, action_type, action_score) { } }else if (isquest=0){ // TODO add more variation, with planets, features, marine equipment perhaps? txt1=choose( - $"Timing their visits right, Your forces scour {star.name} {planet} burning down whatever the local heretic communities call their homes. Their screams were quickly extinguished by fire, turning whatever it was before, into ash.", - $"Your forces scour {star.name} {planet}, burning homes and towns that reek of heresy. The screams and wails of the damned carry through the air." + $"Timing their visits right, Your forces scour {name()} burning down whatever the local heretic communities call their homes. Their screams were quickly extinguished by fire, turning whatever it was before, into ash.", + $"Your forces scour {name()}, burning homes and towns that reek of heresy. The screams and wails of the damned carry through the air." ); - if (star.p_large[planet]=0) then max_kill=action_score*12000;// Population if normal + if (!population_large) then max_kill=action_score*12000;// Population if normal if (star.p_large[planet]=1) then max_kill=action_score*0.0000012;// Population if large pop_before=star.p_population[planet]; @@ -150,17 +150,17 @@ function scr_purge_world(star, planet, action_type, action_score) { kill=min(max_kill,overkill,pop_before);// How many people ARE going to be killed - if (star.p_large[planet]=0) then pop_after=pop_before-kill; + if (!population_large) then pop_after=pop_before-kill; if (star.p_large[planet]=1) then pop_after=pop_before; - sci1=0;sci2=0; + sci1=0;influence_reduction=0; if (pop_before>0) then sci1=(pop_after/pop_before)*100;// Relative % of people murderized - if (sci1>0) then sci2=min((sci1*2),round(action_score/25));// How much hurresy to get rid of - heres_after=heres_before-sci2; + if (sci1>0) then influence_reduction=min((sci1*2),round(action_score/25));// How much hurresy to get rid of + heres_after=heres_before-influence_reduction; if (pop_before>0) and (pop_after=0) then heres_after=0; var nid_influence = star.p_influence[planet][eFACTION.Tyranids]; - if (planet_feature_bool(star.p_feature[planet], P_features.Gene_Stealer_Cult)) { + if (has_feature( P_features.Gene_Stealer_Cult)) { var cult = return_planet_features(star.p_feature[planet], P_features.Gene_Stealer_Cult)[0]; if (cult.hiding) {} } else { @@ -171,9 +171,9 @@ function scr_purge_world(star, planet, action_type, action_score) { txt1 += " There are signs of a genestealer infestation but the cultists are too unorganized to do any real damage to their influence on this world"; } } - if (star.p_large[planet]=0) then pop_after=round(pop_after); + if (!population_large) then pop_after=round(pop_after); if (pop_after<=0) and (pop_before>0) then heres_after=0; - if (star.p_large[planet]=0) then txt1+="##The planet had a population of "+string(scr_display_number(floor(pop_before)))+" and "+string(scr_display_number(floor(kill)))+" were purged over the duration of the cleansing.##Heresy has fallen down to "+string(max(0,heres_after))+"%."; + if (!population_large) then txt1+="##The planet had a population of "+string(scr_display_number(floor(pop_before)))+" and "+string(scr_display_number(floor(kill)))+" were purged over the duration of the cleansing.##Heresy has fallen down to "+string(max(0,heres_after))+"%."; if (star.p_large[planet]=1) then txt1+="##The planet had a population of "+string(pop_before)+" billion and "+string(scr_display_number(action_score*12000))+" were purged over the duration of the cleansing.##Heresy has fallen down to "+string(max(0,heres_after))+"%."; } } @@ -205,7 +205,7 @@ function scr_purge_world(star, planet, action_type, action_score) { $"Your marines move across {star.name} {scr_roman(planet)}, rooting out sources of corruption. Heretics are dragged from their lairs and executed in the streets." ); - if (star.p_large[planet]=0) then max_kill=action_score*30;// Population if normal + if (!population_large) then max_kill=action_score*30;// Population if normal if (star.p_large[planet]=1) then max_kill=0;// Population if large pop_before=star.p_population[planet]; @@ -215,14 +215,14 @@ function scr_purge_world(star, planet, action_type, action_score) { // Minimum kills kill=min(action_score*30,pop_before);// How many people ARE going to be killed - if (star.p_large[planet]=0) then pop_after=pop_before-kill; - sci2=round(action_score/50); - heres_after=heres_before-sci2; + if (!population_large) then pop_after=pop_before-kill; + influence_reduction=round(action_score/50); + heres_after=heres_before-influence_reduction; if (pop_before>0) and (pop_after=0) then heres_after=0; - if (star.p_large[planet]=0) then pop_after=round(pop_after); + if (!population_large) then pop_after=round(pop_after); if (pop_after<=0) and (pop_before>0) then heres_after=0; - if (star.p_large[planet]=0) then txt1+="##The planet had a population of "+string(scr_display_number(floor(pop_before)))+" and "+string(scr_display_number(floor(kill)))+" die over the duration of the search.##Heresy has fallen to "+string(max(0,heres_after))+"%."; + if (!population_large) then txt1+="##The planet had a population of "+string(scr_display_number(floor(pop_before)))+" and "+string(scr_display_number(floor(kill)))+" die over the duration of the search.##Heresy has fallen to "+string(max(0,heres_after))+"%."; if (star.p_large[planet]=1) then txt1+="##The planet had a population of "+string(pop_before)+" billion and "+string(action_score*30)+" die over the duration of the search.##Heresy has fallen to "+string(max(0,heres_after))+"%."; } } @@ -230,109 +230,21 @@ function scr_purge_world(star, planet, action_type, action_score) { if (action_type=DropType.PurgeAssassinate){ - var aroll=roll_dice_chapter(1, 100, "high"); - var chance = 100; - // var siz_penalty=0; - var o=0; - var yep=0; - - // Disposition - aroll += floor(star.dispo[planet] / 10); - - // Advantages - if(scr_has_adv("Ambushers")) then aroll+=10; - if(scr_has_adv("Lightning Warriors")) then aroll+=5; - - // Size - unused - // if ((action_score > 5) && (action_score <= 10)) { siz_penalty = 5; } - // if ((action_score > 10) && (action_score <= 20)) { siz_penalty = 20; } - // if ((action_score > 20) && (action_score <= 50)) { siz_penalty = 30; } - // if ((action_score > 50) && (action_score <= 100)) { siz_penalty = 50; } - // if ((action_score > 100) && (action_score <= 200)) { siz_penalty = 75; } - // if (action_score > 200) { siz_penalty = 125; } - - var spec1=0,spec2=0,txt=""; // TODO consider making it a battle with Planetary governor's guards - txt="Your Astartes descend upon the surface of "+string(star.name)+" "+string(scr_roman(planet))+" and plot the movements and schedule of the governor. "; - txt+="Once the time is right their target is ambushed "+choose("in their home","in the streets","while driving","taking a piss")+" and tranquilized. "; - - if(scr_has_disadv("Never Forgive")) then spec1=1; - if (global.chapter_name="Space Wolves" || obj_ini.progenitor == ePROGENITOR.SPACE_WOLVES) { spec1=3; } - if (global.chapter_name="Iron Hands" || obj_ini.progenitor == ePROGENITOR.IRON_HANDS) { spec1=6; } - if (obj_ini.omophagea=1) then spec1=choose(spec1,20); - - if (spec1=1) then txt+="They are brought to the already-prepared facilities for Fallen, tortured to make "+string(choose("him","him","her"))+" appear a heretic, and then incinerated. "; - if (spec1=3) then txt+=string(choose("He","He","She"))+" is tossed to the Fenrisian Wolves and viciously mauled, torn apart, and eaten. The beasts leave nothing but bloody scraps. "; - if (spec1=6) then txt+=string(choose("He","He","She"))+" is stuck in with the other criminals, and scum, to be turned into a servitor. Soon nothing remains that could be likened to the former Governor. "; - if (spec1=20){ - if (action_score>1) then txt+="Things get out of hand, and the Governor is torn limb from limb and consumed. "+string(choose("His","His","Her"))+" flesh is torn off and eaten, bone pulverized, and marrow sucked free. "; - if (action_score=1) then txt+="Your battle brother chops apart the Governor and eats a sizeable portion of "+string(choose("his","his","her"))+" flesh, focusing upon the eyes, teeth, and fingers. Once full the rest is disposed of. "; - } - - if (spec1=0){ - spec2=choose(1,2,3,4,5,5,5); - if (spec2=1) then txt+="Their still-living body is disintegrated by acid. "; - if (spec2=2) then txt+="The Governor is jettisoned into the local star at the first opporunity. "; - if (spec2=3) then txt+=string(choose("He","He","She"))+" is burned as fuel for one of your vessels. "; - if (spec2=4) then txt+="A few grenades is all it takes to blow "+string(choose("his","his","her"))+" body to smithereens. "; - if (spec2=5) then txt+=string(choose("He","He","She"))+" is executed in a mundane fashion and buried. "; - } - - txt+="What is thy will?"; - - var pip=instance_create(0,0,obj_popup); - pip.title="Planetary Governor Assassinated"; - pip.text=txt; - pip.planet=planet; - pip.p_data = new PlanetData(planet,star); - var options = [ - { - str1 : "Allow the official successor to become Planetary Governor.", - choice_func : allow_governor_successor, - }, - { - str1 : "Ensure that a sympathetic successor will be the one to rule.", - choice_func : install_sympathetic_successor, - }, - { - str1 : "Remove all successors and install a loyal Chapter Serf.", - choice_func : install_chapter_surf, - }, - ] - pip.add_option(options); - pip.cooldown=20; - - // Result- this is the multiplier for the chance of discovery with the inquisition, can also be used to determine - // the new Governor disposition if they are the official successor - if (aroll < chance){// Discovered - pip.estimate=2; - } else if (aroll >= chance){// Success - pip.estimate=1; - } - // If there are enemy non-chaos forces then they may be used as a cover - // Does not work with chaos because if the governor dies, with chaos present, the new governor would possibly be investigated - if (star.p_orks[planet]>=4) or (star.p_necrons[planet]>=3) or (star.p_tyranids[planet]>=5){ - pip.estimate=pip.estimate*0.5; - } - } - - - - - - - + } if (action_type!=DropType.PurgeAssassinate){ if (isquest=0){// DO EET txt2=txt1; - star.p_heresy[planet]-=sci2; - star.p_influence[planet][eFACTION.Tau]-=sci2; - if (action_type Date: Sun, 21 Dec 2025 04:01:13 +0000 Subject: [PATCH 29/31] streamline purging --- objects/obj_star_select/Draw_64.gml | 8 +- scripts/scr_PlanetData/scr_PlanetData.gml | 4 + scripts/scr_purge_world/scr_purge_world.gml | 203 +++++++++++--------- 3 files changed, 119 insertions(+), 96 deletions(-) diff --git a/objects/obj_star_select/Draw_64.gml b/objects/obj_star_select/Draw_64.gml index 59447440bd..71f597d563 100644 --- a/objects/obj_star_select/Draw_64.gml +++ b/objects/obj_star_select/Draw_64.gml @@ -186,7 +186,9 @@ if (obj_controller.selecting_planet!=0){ if (p_data.player_forces>0){ if (is_enemy){ button1="Attack"; - button2="Purge"; + if (p_data.population){ + button2="Purge"; + } } } } @@ -199,7 +201,9 @@ if (obj_controller.selecting_planet!=0){ else { button1="Attack"; button2="Raid"; - button3="Purge"; + if (p_data.population){ + button2="Purge"; + } } if (torpedo>0){ diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index dbcdc3a425..45c8ba0aa7 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -100,6 +100,10 @@ function PlanetData(planet, system) constructor{ refresh_data(); + static total_corruption(){ + return secret_corruption + corruption; + } + static edit_player_forces = function(val){ system.p_player[planet]+=val; player_forces = system.p_player[planet]; diff --git a/scripts/scr_purge_world/scr_purge_world.gml b/scripts/scr_purge_world/scr_purge_world.gml index df567654e4..88d2e66ce4 100644 --- a/scripts/scr_purge_world/scr_purge_world.gml +++ b/scripts/scr_purge_world/scr_purge_world.gml @@ -1,6 +1,6 @@ function scr_purge_world(star, planet, action_type, action_score) { - var pop_before,pop_after,sci1,influence_reduction,txt1,txt2, max_kill, overkill, heres_before, heres_after, kill; + var pop_before,pop_after,population_reduction_percentage,influence_reduction,txt1,txt2, max_kill, overkill, heres_before, heres_after, kill; var isquest,thequest,questnum;isquest=0;thequest="";questnum=0;pop_after=0;txt1="";txt2="";overkill=0; @@ -13,84 +13,93 @@ function scr_purge_world(star, planet, action_type, action_score) { pop.text=$"Your astartes set out and begin to cleanse {planet_numeral_name(planet, star)} of possible heresy. The general populace appears to be devout in their faith, but a disturbing trend appears- the odd citizen cursing your forces, frothing at the mouth, and screaming out heresy most foul. One week into the cleansing a large hostile force is detected approaching and encircling your forces."; exit; } - if (has_feature(P_features.Warlord10) == 1) and (obj_controller.known[10]>=2) and (obj_controller.faction_gender[10]=1) then with(obj_drop_select){ - - attacking=10; - obj_controller.cooldown=30;combating=1;// Start battle here - - instance_deactivate_all(true); - instance_activate_object(obj_controller); - instance_activate_object(obj_ini); - instance_activate_object(obj_drop_select); - - instance_create(0,0,obj_ncombat); - obj_ncombat.battle_object=p_target; - obj_ncombat.battle_loc=p_target.name; - obj_ncombat.battle_id=obj_controller.selecting_planet; - obj_ncombat.dropping=0; - obj_ncombat.attacking=10; - obj_ncombat.enemy=10; - obj_ncombat.formation_set=1; - - /* - obj_ncombat.battle_object=p_target; - obj_ncombat.battle_loc=p_target.name; - obj_ncombat.battle_id=obj_controller.selecting_planet; - obj_ncombat.dropping=1-attack; - obj_ncombat.attacking=attack; - obj_ncombat.enemy=attacking; - obj_ncombat.formation_set=formation_possible[formation_current]; - */ - - obj_ncombat.leader=1; - obj_ncombat.threat=5; - obj_ncombat.battle_special="WL10_later"; - scr_battle_allies(); - setup_battle_formations(); - roster.add_to_battle(); + if (has_feature(P_features.Warlord10) == 1) and (obj_controller.known[10]>=2) and (obj_controller.faction_gender[10]=1){ + with(obj_drop_select){ + + attacking=10; + obj_controller.cooldown=30; + combating=1;// Start battle here + + instance_deactivate_all(true); + instance_activate_object(obj_controller); + instance_activate_object(obj_ini); + instance_activate_object(obj_drop_select); + + instance_create(0,0,obj_ncombat); + obj_ncombat.battle_object=p_target; + obj_ncombat.battle_loc=p_target.name; + obj_ncombat.battle_id=obj_controller.selecting_planet; + obj_ncombat.dropping=0; + obj_ncombat.attacking=10; + obj_ncombat.enemy=10; + obj_ncombat.formation_set=1; + + obj_ncombat.leader=1; + obj_ncombat.threat=5; + obj_ncombat.battle_special="WL10_later"; + scr_battle_allies(); + setup_battle_formations(); + roster.add_to_battle(); + } } } + var heres_before = max(total_corruption(),population_influences[eFACTION.Tau],population_influences[eFACTION.Tyranids]);// Starting heresy + + var heres_target = "corruption"; + + if (max(population_influences[eFACTION.Tau],population_influences[eFACTION.Tyranids]) > total_corruption()){ + if (population_influences[eFACTION.Tau]>population_influences[eFACTION.Tyranids]){ + heres_target = "tau"; + } else{ + heres_target = "genestealers"; + } + + } + // TODO - while I don't expect Surface to Orbit weapons retaliating against player's purge bombardment, it might still be worthwhile to consider possible situations if (action_type=DropType.PurgeBombard){// Bombardment - txt1=choose("Your cruiser and larger ship", "The heavens rumble and thunder as your ship"); - if (ships_selected>1) then txt1+="s"; + var _ship = string_plural("ship",ships_selected); + txt1=choose($"Your cruiser and larger {_ship}", $"The heavens rumble and thunder as your {_ship}"); txt1+=choose(" position themselves over the target in close orbit, and unleash", " unload"); - if (ships_selected=1) then txt1+="s"; - txt1+= $" annihilation upon {planet_numeral_name(planet, star)}. Even from space the explosions can be seen, {choose("tearing ground", "hammering", "battering", "thundering")} across the planet's surface."; + var _adjective = choose("tearing ground", "hammering", "battering", "thundering"); + txt1+= $" annihilation upon {name()}. Even from space the explosions can be seen, {_adjective} across the planet's surface."; max_kill = population_small_conversion(0.015) * max_kill; - pop_before=star.p_population[planet]; - - heres_before=max(star.p_heresy[planet]+star.p_heresy_secret[planet],star.p_influence[planet][eFACTION.Tau]);// Starting heresy + pop_before=population; // Minimum kills - if (pop_before>0) then overkill=max(pop_before*0.1,((heres_before/200)*pop_before)); - if (pop_before=0) then overkill=0; + overkill=max(pop_before*0.1,((heres_before/200)*pop_before)); + kill=min(max_kill,overkill,pop_before);// How many people ARE going to be killed - pop_after=pop_before-kill; - sci1=0; + pop_after=max(pop_before-kill,0); + population_reduction_percentage=0; influence_reduction=0; - if (pop_before>0) then sci1=(pop_after/pop_before)*100;// Relative % of people murderized - if (sci1>0) then influence_reduction=min((sci1*2),action_score*2);// How much hurresy to get rid of + population_reduction_percentage=(pop_after/pop_before)*100;// Relative % of people murderized + + if (population_reduction_percentage>0){ + influence_reduction=min((population_reduction_percentage*2),action_score*2);// How much hurresy to get rid of + } heres_after=heres_before-influence_reduction; - if (pop_before>0) and (pop_after=0) then heres_after=0; + - if (!population_large) then pop_after=round(pop_after); - if (pop_after<=0) and (pop_before>0) then heres_after=0; + if (!population_large){ + pop_after=round(pop_after); + } + - var _displayed_population = large_population ? $"{pop_before} billion" : scr_display_number(floor(pop_before)); + var _displayed_population = display_population(); var _displayed_killed = large_population ? $"{kill} billion" : scr_display_number(floor(kill)); - txt1 += $"##The world had {_displayed_population} Imperium subjects. {_displayed_killed} were purged over the duration of the bombardment.##Heresy has fallen down to {max(0, heres_after)}%."; + txt1 += $"\n\nThe world had {_displayed_population} Imperium subjects. {_displayed_killed} were purged over the duration of the bombardment.\n\nHeresy has fallen down to {max(0, heres_after)}%."; if (pop_after<=0){ - if (star.p_owner[planet]=2) and (obj_controller.faction_status[2]!="War"){ + if (current_owner=2) and (obj_controller.faction_status[2]!="War"){ if (planet_type="Temperate" || planet_type="Hive" || planet_type="Desert"){ var _disp_hit = -10; if (planet_type="Temperate") then _disp_hit = -5; @@ -100,7 +109,7 @@ function scr_purge_world(star, planet, action_type, action_score) { } } } - if (star.p_owner[planet]=3) and (obj_controller.faction_status[3]!="War"){ + if (current_owner=3) and (obj_controller.faction_status[3]!="War"){ if (planet_type="Forge") then _disp_hit =-15; if (planet_type="Ice") then _disp_hit =-7; @@ -114,7 +123,7 @@ function scr_purge_world(star, planet, action_type, action_score) { if (action_type=DropType.PurgeFire){// Burn baby burn var i=0; - if (has_problem_planet(planet, "cleanse", star)){ + if (has_problem("cleanse")){ isquest=1; thequest="cleanse"; questnum=i; @@ -123,13 +132,12 @@ function scr_purge_world(star, planet, action_type, action_score) { if (isquest=1){ if (thequest="cleanse") and (action_score>=20){ remove_planet_problem(planet,thequest,star); - - if (obj_controller.demanding=0) then obj_controller.disposition[4]+=1; - if (obj_controller.demanding=1) then obj_controller.disposition[4]+=choose(0,0,1); + + alter_disposition(eFACTION.Inquisition,obj_controller.demanding ? choose(0,0,1) :1); txt1="Your marines scour the underhive of "+string(star.name)+" "+string(planet)+", spraying mutants down with promethium as they go. It takes several days but a sizeable dent is put in their numbers."; - scr_event_log("","Inquisition Mission Completed: The mutants of "+string(star.name)+" "+string(scr_roman(planet))+" have been cleansed by promethium."); - scr_gov_disp(star.name,planet,choose(1,2,3)); + scr_event_log("","Inquisition Mission Completed: The mutants of {name()} have been cleansed by promethium."); + add_disposition(choose(1,2,3)); } }else if (isquest=0){ // TODO add more variation, with planets, features, marine equipment perhaps? txt1=choose( @@ -138,31 +146,34 @@ function scr_purge_world(star, planet, action_type, action_score) { ); if (!population_large) then max_kill=action_score*12000;// Population if normal - if (star.p_large[planet]=1) then max_kill=action_score*0.0000012;// Population if large + if (large_population) then max_kill=action_score*0.0000012;// Population if large pop_before=star.p_population[planet]; - heres_before=max(star.p_heresy[planet]+star.p_heresy_secret[planet],star.p_influence[planet][eFACTION.Tau]);// Starting heresy - // Minimum kills if (pop_before>0) then overkill=min(pop_before*0.01,((heres_before/200)*pop_before)); if (pop_before=0) then overkill=0; kill=min(max_kill,overkill,pop_before);// How many people ARE going to be killed - if (!population_large) then pop_after=pop_before-kill; - if (star.p_large[planet]=1) then pop_after=pop_before; + if (!population_large) then pop_after=max(pop_before-kill,0); + if (large_population) then pop_after=pop_before; - sci1=0;influence_reduction=0; - if (pop_before>0) then sci1=(pop_after/pop_before)*100;// Relative % of people murderized - if (sci1>0) then influence_reduction=min((sci1*2),round(action_score/25));// How much hurresy to get rid of + population_reduction_percentage=0; + influence_reduction=0; + if (pop_before>0) then population_reduction_percentage=(pop_after/pop_before)*100;// Relative % of people murderized + if (population_reduction_percentage>0){ + influence_reduction=min((population_reduction_percentage*2),round(action_score/25));// How much hurresy to get rid of + } heres_after=heres_before-influence_reduction; if (pop_before>0) and (pop_after=0) then heres_after=0; - var nid_influence = star.p_influence[planet][eFACTION.Tyranids]; + var nid_influence = population_influences[eFACTION.Tyranids]; if (has_feature( P_features.Gene_Stealer_Cult)) { var cult = return_planet_features(star.p_feature[planet], P_features.Gene_Stealer_Cult)[0]; - if (cult.hiding) {} + if (cult.hiding) { + + } } else { if (nid_influence > 25) { txt1 += " Scores of mutant offspring from a genestealer infestation are burnt, while we have damaged their influence over this world, the mutants appear to lack the organisation of a true cult"; @@ -172,9 +183,12 @@ function scr_purge_world(star, planet, action_type, action_score) { } } if (!population_large) then pop_after=round(pop_after); - if (pop_after<=0) and (pop_before>0) then heres_after=0; - if (!population_large) then txt1+="##The planet had a population of "+string(scr_display_number(floor(pop_before)))+" and "+string(scr_display_number(floor(kill)))+" were purged over the duration of the cleansing.##Heresy has fallen down to "+string(max(0,heres_after))+"%."; - if (star.p_large[planet]=1) then txt1+="##The planet had a population of "+string(pop_before)+" billion and "+string(scr_display_number(action_score*12000))+" were purged over the duration of the cleansing.##Heresy has fallen down to "+string(max(0,heres_after))+"%."; + + if (!population_large){ + txt1+="\n\nThe planet had a population of "+string(scr_display_number(floor(pop_before)))+" and "+string(scr_display_number(floor(kill)))+" were purged over the duration of the cleansing.\n\nHeresy has fallen down to "+string(max(0,heres_after))+"%."; + }else { + txt1+="\n\nThe planet had a population of "+string(pop_before)+" billion and "+string(scr_display_number(action_score*12000))+" were purged over the duration of the cleansing.\n\nHeresy has fallen down to "+string(max(0,heres_after))+"%."; + } } } @@ -191,53 +205,55 @@ function scr_purge_world(star, planet, action_type, action_score) { if (thequest="purge") and (action_score>=10){ remove_planet_problem(planet, "purge", star); - if (obj_controller.demanding=0) then obj_controller.disposition[4]+=1; - if (obj_controller.demanding=1) then obj_controller.disposition[4]+=choose(0,0,1); + alter_disposition(eFACTION.Inquisition,obj_controller.demanding ? choose(0,0,1) :1); txt1="Your marines drop fast and hard, blowing through guards and mercenaries with minimal resistance. Before ten minutes have passed all your targets are executed."; - scr_event_log("","Inquisition Mission Completed: The unruly Nobles of "+string(star.name)+" "+string(scr_roman(planet))+" have been purged."); - scr_gov_disp(star.name,planet,choose(1,2,3)); + scr_event_log("","Inquisition Mission Completed: The unruly Nobles of {name()} have been purged."); + add_disposition(choose(1,2,3)); } } else if (isquest=0){ // TODO add more variation, with planets, features, possibly marine equipment txt1=choose( $"Your marines move across {star.name} {scr_roman(planet)}, searching for high profile targets. Once found, they are dragged outside from their lairs. Their execution would soon follow.", $"Your marines move across {star.name} {scr_roman(planet)}, rooting out sources of corruption. Heretics are dragged from their lairs and executed in the streets." - ); + ); if (!population_large) then max_kill=action_score*30;// Population if normal - if (star.p_large[planet]=1) then max_kill=0;// Population if large + if (large_population) then max_kill=0;// Population if large pop_before=star.p_population[planet]; - heres_before=max(star.p_heresy[planet]+star.p_heresy_secret[planet],star.p_influence[planet][eFACTION.Tau]);// Starting heresy - // Minimum kills kill=min(action_score*30,pop_before);// How many people ARE going to be killed - if (!population_large) then pop_after=pop_before-kill; + if (!population_large) then pop_after=max(pop_before-kill,0); influence_reduction=round(action_score/50); heres_after=heres_before-influence_reduction; if (pop_before>0) and (pop_after=0) then heres_after=0; if (!population_large) then pop_after=round(pop_after); - if (pop_after<=0) and (pop_before>0) then heres_after=0; - if (!population_large) then txt1+="##The planet had a population of "+string(scr_display_number(floor(pop_before)))+" and "+string(scr_display_number(floor(kill)))+" die over the duration of the search.##Heresy has fallen to "+string(max(0,heres_after))+"%."; - if (star.p_large[planet]=1) then txt1+="##The planet had a population of "+string(pop_before)+" billion and "+string(action_score*30)+" die over the duration of the search.##Heresy has fallen to "+string(max(0,heres_after))+"%."; + + if (!population_large) then txt1+=$"\n\nThe planet had a population of "+string(scr_display_number(floor(pop_before)))+" and "+string(scr_display_number(floor(kill)))+" die over the duration of the search.\n\nHeresy has fallen to "+string(max(0,heres_after))+"%."; + if (large_population) then txt1+=$"\n\nThe planet had a population of {pop_before} billion and {action_score*30} die over the duration of the search.\n\nHeresy has fallen to "+string(max(0,heres_after))+"%."; } } if (action_type=DropType.PurgeAssassinate){ - + assasinate_governor_setup(); } if (action_type!=DropType.PurgeAssassinate){ if (isquest=0){// DO EET txt2=txt1; - alter_corruption(-influence_reduction) - alter_influence(eFACTION.Tau , -influence_reduction); + if (heres_target == "corruption"){ + alter_corruption(-influence_reduction); + }else if (heres_target == "tau"){ + alter_influence(eFACTION.Tau , -influence_reduction); + }else if (heres_target == "genestealers"){ + alter_influence(eFACTION.Tyranids , -influence_reduction); + } if (action_type Date: Sun, 21 Dec 2025 22:38:24 +0000 Subject: [PATCH 30/31] error with hidden cult influence --- objects/obj_star_select/Draw_64.gml | 65 +-------------------- scripts/scr_PlanetData/scr_PlanetData.gml | 70 +++++++++++++++++++++-- scripts/scr_garrison/scr_garrison.gml | 13 +++-- 3 files changed, 76 insertions(+), 72 deletions(-) diff --git a/objects/obj_star_select/Draw_64.gml b/objects/obj_star_select/Draw_64.gml index 71f597d563..b8dd549b8b 100644 --- a/objects/obj_star_select/Draw_64.gml +++ b/objects/obj_star_select/Draw_64.gml @@ -170,8 +170,8 @@ draw_set_font(fnt_40k_14b); if (obj_controller.selecting_planet!=0){ if (p_data.planet != obj_controller.selecting_planet){ - delete p_data; p_data = new PlanetData(obj_controller.selecting_planet, target); + target.system_datas[obj_controller.selecting_planet] = p_data; } // Buttons that are available if (!buttons_selected){ @@ -273,7 +273,7 @@ if (obj_controller.selecting_planet!=0){ } } }else if (garrison!="" && !population){ - if (garrison.garrison_force ){ + if (garrison.garrison_force){ draw_set_font(fnt_40k_14); if (!garrison.garrison_leader){ garrison.find_leader() @@ -312,66 +312,7 @@ if (obj_controller.selecting_planet!=0){ } else if (population){ garrison_data_slate.title = "Population Report"; garrison_data_slate.inside_method = function(){ - draw_set_color(c_gray); - var xx = garrison_data_slate.XX; - var yy = garrison_data_slate.YY; - var cur_planet = obj_controller.selecting_planet; - var half_way = garrison_data_slate.height/2; - var spacing_x = 100 - var spacing_y = 65 - draw_set_halign(fa_left); - if (!target.space_hulk) { - if (obj_controller.faction_status[eFACTION.Imperium] != "War" && p_data.current_owner <= 5) || (obj_controller.faction_status[eFACTION.Imperium] == "War") { - colonist_button.update({ - x1:xx+35, - y1:half_way, - allow_click : array_length(potential_doners), - }); - colonist_button.draw(); - - recruiting_button.update({ - x1:xx+(spacing_x*2)+15, - y1:half_way, - allow_click : true, - }); - recruiting_button.draw(); - if (p_data.has_feature(P_features.Recruiting_World)) { - var _recruit_world = p_data.get_features(P_features.Recruiting_World)[0]; - if (_recruit_world.recruit_type == 0) && (obj_controller.faction_status[p_data.current_owner] != "War" && obj_controller.faction_status[p_data.current_owner] != "Antagonism" || p_data.player_disposition >= 50) { - draw_text(xx+(spacing_x*3)+35, half_way-20, "Open: Voluntery"); - } else if (_recruit_world.recruit_type == 0 && p_data.player_disposition <= 50) { - draw_text(xx+(spacing_x*3)+35, half_way-20, "Covert: Voluntery"); - } else { - draw_text(xx+(spacing_x*3)+35, half_way-20, "Abduct"); - } - recruitment_type_button.update({ - x1:xx+(spacing_x*3)+35, - y1:half_way, - allow_click : true, - }); - recruitment_type_button.draw(); - - draw_text(xx+(spacing_x*3)-15, half_way+(spacing_y)-20, $"Req:{_recruit_world.recruit_cost * 2}"); - if (_recruit_world.recruit_cost > 0) { - recruitment_costdown_button.update({ - x1:xx+(spacing_x*2)+35, - y1:half_way+(spacing_y), - allow_click : true, - }); - recruitment_costdown_button.draw(); - } - if (_recruit_world.recruit_cost < 5) { - recruitment_costup_button.update({ - x1:xx+(spacing_x*3)+35, - y1:half_way+(spacing_y), - allow_click : true, - }); - recruitment_costup_button.draw(); - } - } - } - } - + p_data.draw_planet_population_controls(); } garrison_data_slate.draw(344+main_data_slate.width-4, 160, 0.6, 0.6); } diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 45c8ba0aa7..2c02e93013 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -1004,15 +1004,15 @@ function PlanetData(planet, system) constructor{ var bar_start_point = xx+349; var bar_percent_length = (bar_width/100); var current_bar_percent = 0; - var hidden_cult = false; + var _hidden_cult = false; if (has_feature(P_features.Gene_Stealer_Cult)){ - hidden_cult = get_features(P_features.Gene_Stealer_Cult)[0].hiding; + _hidden_cult = get_features(P_features.Gene_Stealer_Cult)[0].hiding; } for (var i=1;i<13;i++){ if (population_influences[i]>0){ draw_set_color(global.star_name_colors[i]); - if (hidden_cult){ + if (_hidden_cult && i == eFACTION.Tyranids){ draw_set_color(global.star_name_colors[eFACTION.Imperium]); } var current_start = bar_start_point+(current_bar_percent*bar_percent_length) @@ -1031,7 +1031,7 @@ function PlanetData(planet, system) constructor{ draw_text(xx+480,yy+196,$"{name()} ({planet_type})"); } else if (is_craftworld){ - draw_text(xx+480,yy+196,string(system.name)+" (Craftworld)"); + draw_text(xx+480,yy+196,$"{system.name} (Craftworld)"); } else if (is_hulk){ draw_text(xx+480,yy+196,"Space Hulk"); } @@ -1294,6 +1294,68 @@ function PlanetData(planet, system) constructor{ } } + static draw_planet_population_controls = function(){ + draw_set_color(c_gray); + var _gar_slate = obj_star_select.garrison_data_slate; + var xx = _gar_slate.XX; + var yy = _gar_slate.YY; + var _half_way = _gar_slate.height/2; + var spacing_x = 100 + var spacing_y = 65 + draw_set_halign(fa_left); + if (!target.space_hulk) { + if (obj_controller.faction_status[eFACTION.Imperium] != "War" && current_owner <= 5) || (obj_controller.faction_status[eFACTION.Imperium] == "War") { + colonist_button.update({ + x1:xx+35, + y1:_half_way, + allow_click : array_length(potential_doners), + }); + colonist_button.draw(); + + recruiting_button.update({ + x1:xx+(spacing_x*2)+15, + y1:_half_way, + allow_click : true, + }); + recruiting_button.draw(); + if (has_feature(P_features.Recruiting_World)) { + var _recruit_world = get_features(P_features.Recruiting_World)[0]; + if (_recruit_world.recruit_type == 0) && (obj_controller.faction_status[current_owner] != "War" && obj_controller.faction_status[p_data.current_owner] != "Antagonism" || p_data.player_disposition >= 50) { + draw_text(xx+(spacing_x*3)+35, _half_way-20, "Open: Voluntery"); + } else if (_recruit_world.recruit_type == 0 && player_disposition <= 50) { + draw_text(xx+(spacing_x*3)+35, _half_way-20, "Covert: Voluntery"); + } else { + draw_text(xx+(spacing_x*3)+35, _half_way-20, "Abduct"); + } + recruitment_type_button.update({ + x1:xx+(spacing_x*3)+35, + y1:_half_way, + allow_click : true, + }); + recruitment_type_button.draw(); + + draw_text(xx+(spacing_x*3)-15, _half_way+(spacing_y)-20, $"Req:{_recruit_world.recruit_cost * 2}"); + if (_recruit_world.recruit_cost > 0) { + recruitment_costdown_button.update({ + x1:xx+(spacing_x*2)+35, + y1:_half_way+(spacing_y), + allow_click : true, + }); + recruitment_costdown_button.draw(); + } + if (_recruit_world.recruit_cost < 5) { + recruitment_costup_button.update({ + x1:xx+(spacing_x*3)+35, + y1:_half_way+(spacing_y), + allow_click : true, + }); + recruitment_costup_button.draw(); + } + } + } + } + } + static suffer_navy_bombard = function(strength){ diff --git a/scripts/scr_garrison/scr_garrison.gml b/scripts/scr_garrison/scr_garrison.gml index 36010cffda..7b18680380 100644 --- a/scripts/scr_garrison/scr_garrison.gml +++ b/scripts/scr_garrison/scr_garrison.gml @@ -147,19 +147,20 @@ function GarrisonForce(planet_operatives, turn_end=false, type="garrison") const } static garrison_report = function(){ - var system = obj_star_select.target; - var planet = obj_controller.selecting_planet; + var _system = obj_star_select.target; + var _p = obj_controller.selecting_planet; + var _planet = _system.system_datas[_p]; var report_string = "Hail My lord.##"; - report_string+=$"Report for garrison on {system.name} {scr_roman_numerals()[planet-1]} is as follows#"; + report_string+=$"Report for garrison on {_planet.name()} is as follows#"; if ((array_length(garrison_squads)) > 1){ report_string+= $"The garrison is comprised of {array_length(garrison_squads)} squads," } else {report_string+="The garrison is comprised of a single _squad,"} report_string+= $" with a total man count of {total_garrison}.#" - if (system.p_owner[planet] != eFACTION.Player && system.dispo[planet] >=-100) { - var disposition = disposition_description_chart(system.dispo[planet]); + if (_planet.current_owner!= eFACTION.Player && _planet.disposition >=-100) { + var disposition = disposition_description_chart(_planet.disposition); report_string += $"Our Relationship with the Rulers of the planet is {disposition}#"; - } else if (system.dispo[planet] < -1000) { + } else if (_planet.disposition < -1000) { if (system.p_owner[planet] == eFACTION.Player){ report_string += $"Rule of the planet is going well"; } else { From 3038c4a976af306edfc604c0f6f1a54339ff2a60 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Sat, 27 Dec 2025 02:30:29 +0000 Subject: [PATCH 31/31] keep grinding --- scripts/scr_PlanetData/scr_PlanetData.gml | 4 +- .../scr_drop_select_function.gml | 6 +- scripts/scr_governors/scr_governors.gml | 15 +- scripts/scr_purge_world/scr_purge_world.gml | 141 +++++++++++------- .../scr_unit_quick_find_pane.gml | 2 +- 5 files changed, 105 insertions(+), 63 deletions(-) diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 2c02e93013..b5bf5d223f 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -733,7 +733,7 @@ function PlanetData(planet, system) constructor{ _starship.funds_spent+=_requisition_spend; if (_requisition_spend>0 && _starship.funds_spent<_target_spend){ - scr_alert("green","owner",$"{_requisition_spend} Requision spent on Ancient Ship repairs in materials and outfitting (outfitting {(_starship.funds_spent/_target_spend)*100}%)",system.x,system.y); + scr_alert("green","owner",$"{_requisition_spend} Requisition spent on Ancient Ship repairs in materials and outfitting (outfitting {(_starship.funds_spent/_target_spend)*100}%)",system.x,system.y); } if (_starship.funds_spent>=_target_spend && _starship.engineer_score>=2000){// u2=tar; //TODO refactor into general new ship logic @@ -1972,7 +1972,7 @@ function PlanetData(planet, system) constructor{ if (spec1=0){ spec2=choose(1,2,3,4,5,5,5); if (spec2=1) then txt+="Their still-living body is disintegrated by acid. "; - if (spec2=2) then txt+="The Governor is jettisoned into the local star at the first opporunity. "; + if (spec2=2) then txt+="The Governor is jettisoned into the local star at the first opportunity. "; if (spec2=3) then txt+=string(choose("He","He","She"))+" is burned as fuel for one of your vessels. "; if (spec2=4) then txt+="A few grenades is all it takes to blow "+string(choose("his","his","her"))+" body to smithereens. "; if (spec2=5) then txt+=string(choose("He","He","She"))+" is executed in a mundane fashion and buried. "; diff --git a/scripts/scr_drop_select_function/scr_drop_select_function.gml b/scripts/scr_drop_select_function/scr_drop_select_function.gml index 574867809f..268a2ad58a 100644 --- a/scripts/scr_drop_select_function/scr_drop_select_function.gml +++ b/scripts/scr_drop_select_function/scr_drop_select_function.gml @@ -392,7 +392,11 @@ function drop_select_draw() { _purge_score = array_length(roster.selected_units); } - scr_purge_world(p_target, planet_number, purge, _purge_score); + var _p_data = p_target.system_data[planet_number]; + + _p_data.refresh_data(); + + _p_data.purge(); } } } diff --git a/scripts/scr_governors/scr_governors.gml b/scripts/scr_governors/scr_governors.gml index fa2c8ea1ba..d705fa05ff 100644 --- a/scripts/scr_governors/scr_governors.gml +++ b/scripts/scr_governors/scr_governors.gml @@ -1,11 +1,20 @@ function GovernorProfile(){ - born = obj_controlller.turn - irandom_range(240,2400); + born = obj_controlller.turn - irandom_range(240,4800); + + uid = scr_uuid_generate(); static age = function(){ - born - obj_controlller.turn; + var _age = born - obj_controlller.turn; + if (_age < 0){ + _age = (born * -1) + obj_controlller.turn; + } + + _age/=12; + + return age; } - gender = choose(GENDER.Female,GENDER.Male); + gender = set_gender(); name = global.name_generator.generate_imperial_name(); diff --git a/scripts/scr_purge_world/scr_purge_world.gml b/scripts/scr_purge_world/scr_purge_world.gml index 88d2e66ce4..c624797d0d 100644 --- a/scripts/scr_purge_world/scr_purge_world.gml +++ b/scripts/scr_purge_world/scr_purge_world.gml @@ -1,19 +1,22 @@ -function scr_purge_world(star, planet, action_type, action_score) { +function scr_purge_world(action_type, action_score) { - var pop_before,pop_after,population_reduction_percentage,influence_reduction,txt1,txt2, max_kill, overkill, heres_before, heres_after, kill; - var isquest,thequest,questnum;isquest=0;thequest="";questnum=0;pop_after=0;txt1="";txt2="";overkill=0; + var population_reduction_percentage,influence_reduction, max_kill, heres_before, heres_after, kill; + var isquest=0,thequest="",questnum=0,pop_after=0,txt1="",txt2="",overkill=0; - - if ((action_type==DropType.PurgeFire) or (action_type==DropType.PurgeSelective)) and (star.p_traitors[planet]=0) and (star.p_chaos[planet]=0) and (obj_controller.turn>=obj_controller.chaos_turn){ - if (has_feature(P_features.Warlord10) == 1) and (obj_controller.known[10]=0) and (obj_controller.faction_gender[10]=1) then with(obj_drop_select){ - var pop=instance_create(0,0,obj_popup); - pop.image="chaos_symbol"; - pop.title="Concealed Heresy"; - pop.text=$"Your astartes set out and begin to cleanse {planet_numeral_name(planet, star)} of possible heresy. The general populace appears to be devout in their faith, but a disturbing trend appears- the odd citizen cursing your forces, frothing at the mouth, and screaming out heresy most foul. One week into the cleansing a large hostile force is detected approaching and encircling your forces."; - exit; - } - if (has_feature(P_features.Warlord10) == 1) and (obj_controller.known[10]>=2) and (obj_controller.faction_gender[10]=1){ + var _pop_before = population; + var _no_chaos = (planet_forces[eFACTION.Heretics] + planet_forces[eFACTION.Chaos])==0 + if ((action_type==DropType.PurgeFire || action_type==DropType.PurgeSelective) && _no_chaos && obj_controller.turn>=obj_controller.chaos_turn){ + if (has_feature(P_features.Warlord10) && obj_controller.known[10]=0 && obj_controller.faction_gender[10]=1){ + with(obj_drop_select){ + var pop=instance_create(0,0,obj_popup); + pop.image="chaos_symbol"; + pop.title="Concealed Heresy"; + pop.text=$"Your astartes set out and begin to cleanse {planet_numeral_name(planet, star)} of possible heresy. The general populace appears to be devout in their faith, but a disturbing trend appears- the odd citizen cursing your forces, frothing at the mouth, and screaming out heresy most foul. One week into the cleansing a large hostile force is detected approaching and encircling your forces."; + exit; + } + } + if (has_feature(P_features.Warlord10) && obj_controller.known[10]>=2 && obj_controller.faction_gender[10]=1){ with(obj_drop_select){ attacking=10; @@ -69,19 +72,17 @@ function scr_purge_world(star, planet, action_type, action_score) { max_kill = population_small_conversion(0.015) * max_kill; - pop_before=population; - // Minimum kills - overkill=max(pop_before*0.1,((heres_before/200)*pop_before)); + overkill=max(_pop_before*0.1,((heres_before/200)*_pop_before)); - kill=min(max_kill,overkill,pop_before);// How many people ARE going to be killed + kill=min(max_kill,overkill,_pop_before);// How many people ARE going to be killed - pop_after=max(pop_before-kill,0); + pop_after=max(_pop_before-kill,0); population_reduction_percentage=0; influence_reduction=0; - population_reduction_percentage=(pop_after/pop_before)*100;// Relative % of people murderized + population_reduction_percentage=(pop_after/_pop_before)*100;// Relative % of people murderized if (population_reduction_percentage>0){ influence_reduction=min((population_reduction_percentage*2),action_score*2);// How much hurresy to get rid of @@ -99,20 +100,28 @@ function scr_purge_world(star, planet, action_type, action_score) { txt1 += $"\n\nThe world had {_displayed_population} Imperium subjects. {_displayed_killed} were purged over the duration of the bombardment.\n\nHeresy has fallen down to {max(0, heres_after)}%."; if (pop_after<=0){ - if (current_owner=2) and (obj_controller.faction_status[2]!="War"){ + if (current_owner=2 && obj_controller.faction_status[2]!="War"){ if (planet_type="Temperate" || planet_type="Hive" || planet_type="Desert"){ var _disp_hit = -10; - if (planet_type="Temperate") then _disp_hit = -5; - if (planet_type="Desert") then _disp_hit = -3; + if (planet_type="Temperate"){ + _disp_hit = -5; + } + if (planet_type="Desert"){ + _disp_hit = -3; + } scr_audience(eFACTION.Imperium, "bombard_angry", _disp_hit, "", 0, 0); } } } - if (current_owner=3) and (obj_controller.faction_status[3]!="War"){ + if (current_owner=3 && obj_controller.faction_status[3]!="War"){ - if (planet_type="Forge") then _disp_hit =-15; - if (planet_type="Ice") then _disp_hit =-7; + if (planet_type="Forge"){ + _disp_hit =-15; + } + if (planet_type="Ice"){ + _disp_hit =-7; + } scr_audience(eFACTION.Inquisition, "bombard_angry", _disp_hit, "", 0, 0); } @@ -130,12 +139,12 @@ function scr_purge_world(star, planet, action_type, action_score) { } if (isquest=1){ - if (thequest="cleanse") and (action_score>=20){ + if (thequest="cleanse" && action_score>=20){ remove_planet_problem(planet,thequest,star); alter_disposition(eFACTION.Inquisition,obj_controller.demanding ? choose(0,0,1) :1); - txt1="Your marines scour the underhive of "+string(star.name)+" "+string(planet)+", spraying mutants down with promethium as they go. It takes several days but a sizeable dent is put in their numbers."; + txt1="Your marines scour the underhive of {name()}, spraying mutants down with promethium as they go. It takes several days but a sizeable dent is put in their numbers."; scr_event_log("","Inquisition Mission Completed: The mutants of {name()} have been cleansed by promethium."); add_disposition(choose(1,2,3)); } @@ -143,34 +152,38 @@ function scr_purge_world(star, planet, action_type, action_score) { txt1=choose( $"Timing their visits right, Your forces scour {name()} burning down whatever the local heretic communities call their homes. Their screams were quickly extinguished by fire, turning whatever it was before, into ash.", $"Your forces scour {name()}, burning homes and towns that reek of heresy. The screams and wails of the damned carry through the air." - ); - - if (!population_large) then max_kill=action_score*12000;// Population if normal - if (large_population) then max_kill=action_score*0.0000012;// Population if large - - pop_before=star.p_population[planet]; + ); + + max_kill = population_large_conversion(12000) *action_score; // Minimum kills - if (pop_before>0) then overkill=min(pop_before*0.01,((heres_before/200)*pop_before)); - if (pop_before=0) then overkill=0; + overkill=min(_pop_before*0.01,((heres_before/200)*_pop_before)); - kill=min(max_kill,overkill,pop_before);// How many people ARE going to be killed + kill=min(max_kill,overkill,_pop_before);// How many people ARE going to be killed - if (!population_large) then pop_after=max(pop_before-kill,0); - if (large_population) then pop_after=pop_before; + if (!population_large){ + pop_after=max(_pop_before-kill,0); + } + if (large_population){ + pop_after=_pop_before; + } population_reduction_percentage=0; influence_reduction=0; - if (pop_before>0) then population_reduction_percentage=(pop_after/pop_before)*100;// Relative % of people murderized + if (_pop_before>0) { + population_reduction_percentage=(pop_after/_pop_before)*100;// Relative % of people murderized + } if (population_reduction_percentage>0){ influence_reduction=min((population_reduction_percentage*2),round(action_score/25));// How much hurresy to get rid of } heres_after=heres_before-influence_reduction; - if (pop_before>0) and (pop_after=0) then heres_after=0; + if (_pop_before>0 && pop_after=0) { + heres_after=0; + } var nid_influence = population_influences[eFACTION.Tyranids]; if (has_feature( P_features.Gene_Stealer_Cult)) { - var cult = return_planet_features(star.p_feature[planet], P_features.Gene_Stealer_Cult)[0]; + var cult = get_features(P_features.Gene_Stealer_Cult)[0]; if (cult.hiding) { } @@ -182,12 +195,14 @@ function scr_purge_world(star, planet, action_type, action_score) { txt1 += " There are signs of a genestealer infestation but the cultists are too unorganized to do any real damage to their influence on this world"; } } - if (!population_large) then pop_after=round(pop_after); + if (!population_large){ + pop_after=round(pop_after); + } if (!population_large){ - txt1+="\n\nThe planet had a population of "+string(scr_display_number(floor(pop_before)))+" and "+string(scr_display_number(floor(kill)))+" were purged over the duration of the cleansing.\n\nHeresy has fallen down to "+string(max(0,heres_after))+"%."; + txt1+="\n\nThe planet had a population of "+string(scr_display_number(floor(_pop_before)))+" and "+string(scr_display_number(floor(kill)))+" were purged over the duration of the cleansing.\n\nHeresy has fallen down to "+string(max(0,heres_after))+"%."; }else { - txt1+="\n\nThe planet had a population of "+string(pop_before)+" billion and "+string(scr_display_number(action_score*12000))+" were purged over the duration of the cleansing.\n\nHeresy has fallen down to "+string(max(0,heres_after))+"%."; + txt1+="\n\nThe planet had a population of "+string(_pop_before)+" billion and "+string(scr_display_number(action_score*12000))+" were purged over the duration of the cleansing.\n\nHeresy has fallen down to "+string(max(0,heres_after))+"%."; } } } @@ -202,7 +217,7 @@ function scr_purge_world(star, planet, action_type, action_score) { } if (isquest=1){ - if (thequest="purge") and (action_score>=10){ + if (thequest="purge" && action_score>=10){ remove_planet_problem(planet, "purge", star); alter_disposition(eFACTION.Inquisition,obj_controller.demanding ? choose(0,0,1) :1); @@ -218,23 +233,37 @@ function scr_purge_world(star, planet, action_type, action_score) { $"Your marines move across {star.name} {scr_roman(planet)}, rooting out sources of corruption. Heretics are dragged from their lairs and executed in the streets." ); - if (!population_large) then max_kill=action_score*30;// Population if normal - if (large_population) then max_kill=0;// Population if large + if (!population_large) { + max_kill=action_score*30;// Population if normal + } + if (large_population) { + max_kill=0;// Population if large + } - pop_before=star.p_population[planet]; + _pop_before=population; // Minimum kills - kill=min(action_score*30,pop_before);// How many people ARE going to be killed + kill=min(action_score*30,_pop_before);// How many people ARE going to be killed - if (!population_large) then pop_after=max(pop_before-kill,0); + if (!population_large) { + pop_after=max(_pop_before-kill,0); + } influence_reduction=round(action_score/50); heres_after=heres_before-influence_reduction; - if (pop_before>0) and (pop_after=0) then heres_after=0; + if (_pop_before>0 && pop_after=0) { + heres_after=0; + } - if (!population_large) then pop_after=round(pop_after); + if (!population_large) { + pop_after=round(pop_after); + } - if (!population_large) then txt1+=$"\n\nThe planet had a population of "+string(scr_display_number(floor(pop_before)))+" and "+string(scr_display_number(floor(kill)))+" die over the duration of the search.\n\nHeresy has fallen to "+string(max(0,heres_after))+"%."; - if (large_population) then txt1+=$"\n\nThe planet had a population of {pop_before} billion and {action_score*30} die over the duration of the search.\n\nHeresy has fallen to "+string(max(0,heres_after))+"%."; + if (!population_large) { + txt1+=$"\n\nThe planet had a population of "+string(scr_display_number(floor(_pop_before)))+" and "+string(scr_display_number(floor(kill)))+" die over the duration of the search.\n\nHeresy has fallen to "+string(max(0,heres_after))+"%."; + } + if (large_population) { + txt1+=$"\n\nThe planet had a population of {_pop_before} billion and {action_score*30} die over the duration of the search.\n\nHeresy has fallen to "+string(max(0,heres_after))+"%."; + } } } @@ -258,7 +287,7 @@ function scr_purge_world(star, planet, action_type, action_score) { if (action_type