diff --git a/objects/obj_popup/Draw_0.gml b/objects/obj_popup/Draw_0.gml index 0e8c32b198..11b9ff8ee8 100644 --- a/objects/obj_popup/Draw_0.gml +++ b/objects/obj_popup/Draw_0.gml @@ -1572,7 +1572,7 @@ try { } draw_text(xx + 1470, yy + 210, string_hash_to_newline("HQ [" + string(check) + "]")); check = " "; - // if (obj_controller.command_set[1]!=0 && !is_specialist(unit_role, "libs")){ + // if (obj_controller.command_set[1]!=0 && !is_specialist(unit_role, "lib")){ for (i = 1; i <= 10; i++) { var comp_data = company_promote_data[i - 1]; if (obj_controller.command_set[2] == 1) { diff --git a/scripts/exp_and_exp_growth/exp_and_exp_growth.gml b/scripts/exp_and_exp_growth/exp_and_exp_growth.gml index eeb5c17a20..287669ee41 100644 --- a/scripts/exp_and_exp_growth/exp_and_exp_growth.gml +++ b/scripts/exp_and_exp_growth/exp_and_exp_growth.gml @@ -90,7 +90,7 @@ function unit_stat_growth(grow_stat=false){ var group_growths = [ ["forge" , "technology"], - ["libs" , "intelligence"], + ["lib" , "intelligence"], ["chap" , "charisma"], ["apoth" , "intelligence"], ]; @@ -258,7 +258,7 @@ function add_unit_exp(add_val){ instace_stat_point_gains = handle_stat_growth(true); } - if (IsSpecialist("libs")) { + if (IsSpecialist("lib")) { _powers_learned = update_powers() } role_refresh(); diff --git a/scripts/is_specialist/is_specialist.gml b/scripts/is_specialist/is_specialist.gml index 96e28f6553..2029f39b2a 100644 --- a/scripts/is_specialist/is_specialist.gml +++ b/scripts/is_specialist/is_specialist.gml @@ -3,197 +3,174 @@ function active_roles(){ return _roles; } -function role_groups(group){ - var role_list = []; - var roles = active_roles(); - switch (group){ - case "lib": - role_list = [ - string("Chief {0}",roles[17]), - roles[17], //librarian - "Codiciery", - "Lexicanum", - ]; - break; - case "trainee": - role_list = [ - string("{0} Aspirant",roles[17]), - string("{0} Aspirant",roles[15]), - string("{0} Aspirant",roles[14]), - string("{0} Aspirant",roles[16]), - ]; - break; - case "heads": - role_list = [ - "Master of Sanctity", - string("Chief {0}", roles[17]), - "Forge Master", - "Chapter Master", - "Master of the Apothecarion" - ]; - break; - case "veterans": - role_list = [ - roles[3], //veterans - roles[4], //terminatore - roles[19], //vet sergeant - roles[2], //honour guard - ]; - break; - case "rank_and_file": - role_list = [ - roles[8], //tactical marine - roles[9], //devastator - roles[10], //assualt - roles[12], //scout - ]; - break; +function role_groups(group, include_trainee = false, include_heads = true) { + var _role_list = []; + var _roles = active_roles(); + var _chap_name = instance_exists(obj_creation) ? obj_creation.chapter_name : global.chapter_name; - case "squad_leaders": - role_list = [ - roles[18], //sergeant - roles[19], //vet sergeant - ] - break; - case "command": - role_list = [ - roles[5], - roles[14], - roles[15], - roles[16], - roles[17], - "Codiciery", - "Lexicanum", - roles[11], - roles[7], - ]; - break; - case "dreadnoughts": - role_list = [ - roles[6],//dreadnought - string("Venerable {0}",roles[6]), - ]; - break; + switch (group) { + case "standard": + _role_list = [ + _roles[eROLE.Captain], + _roles[eROLE.Dreadnought], + $"Venerable {_roles[eROLE.Dreadnought]}", + _roles[eROLE.Champion], + _roles[eROLE.Chaplain], + _roles[eROLE.Apothecary], + _roles[eROLE.Techmarine], + _roles[eROLE.Librarian], + "Codiciery", + "Lexicanum", + _roles[eROLE.HonourGuard] + ]; + if (include_trainee) { + _role_list = array_concat(_role_list, role_groups("trainee")); + } + if (include_heads) { + _role_list = array_concat(_role_list, role_groups("heads")); + } + break; + + case "lib": + _role_list = [ + _roles[eROLE.Librarian], + "Codiciery", + "Lexicanum" + ]; + if (include_trainee) { + array_push(_role_list, $"{_roles[eROLE.Librarian]} Aspirant"); + } + if (include_heads) { + array_push(_role_list, $"Chief {_roles[eROLE.Librarian]}"); + } + break; case "forge": - role_list = [ - roles[16],//techmarine - "Forge Master", + _role_list = [ + _roles[eROLE.Techmarine], "Techpriest" ]; - break; - case "captain_candidates": - role_list = [ - roles[eROLE.Sergeant], //sergeant - roles[eROLE.VeteranSergeant], - roles[eROLE.Champion], - roles[eROLE.Captain], - roles[eROLE.Terminator], - roles[eROLE.Veteran], - roles[11], - ]; - break; - } - return role_list; -} - -function is_specialist(unit_role, type="standard", include_trainee=false) { - - // unit_role - //TODO need to make all string roles not strings but array references - var roles = instance_exists(obj_creation) ? obj_creation.role[100] : obj_ini.role[100]; - var _chap_name = instance_exists(obj_creation) ? obj_creation.chapter_name : global.chapter_name; - switch(type){ - case "standard": - specialists = ["Chapter Master", - "Forge Master", - "Master of Sanctity", - "Master of the Apothecarion", - string("Chief {0}",roles[17]),//chief librarian - roles[5],//captain - roles[6],//dreadnought - string("Venerable {0}",roles[6]), - roles[7],//company_champion - roles[14],//chaplain - roles[15],//apothecary - roles[16],//techmarine - roles[17], //librarian - "Codiciery", - "Lexicanum", - roles[2],//honour guard - ]; - if (include_trainee){ - array_push(specialists, - string("{0} Aspirant",roles[17]), - string("{0} Aspirant",roles[15]), - string("{0} Aspirant",roles[14]), - string("{0} Aspirant",roles[16]), - ); + if (include_trainee) { + array_push(_role_list, $"{_roles[eROLE.Techmarine]} Aspirant"); } - break; - - case "libs": - specialists = role_groups("lib"); - if (include_trainee){ - array_push(specialists, string("{0} Aspirant",roles[17])); + if (include_heads) { + array_push(_role_list, "Forge Master"); } break; - case "forge": - specialists = role_groups("forge"); - if (include_trainee){ - array_push(specialists, string("{0} Aspirant",roles[16])); - } - break; case "chap": - specialists = [ - roles[14],//chaplain - "Master of Sanctity", - ]; - if (include_trainee){ - array_push(specialists, string("{0} Aspirant",roles[14])); + _role_list = [_roles[eROLE.Chaplain]]; + if (_chap_name == "Iron Hands") { + array_push(_role_list, _roles[eROLE.Techmarine]); + if (include_trainee) { + array_push(_role_list, $"{_roles[eROLE.Techmarine]} Aspirant"); + } + if (include_heads) { + array_push(_role_list, "Forge Master"); + } + } + if (include_trainee) { + array_push(_role_list, $"{_roles[eROLE.Chaplain]} Aspirant"); + } + if (include_heads) { + array_push(_role_list, "Master of Sanctity"); } - if (_chap_name == "Iron Hands"){ - array_push(specialists, roles[16]); - } break; case "apoth": - specialists = [ - roles[15], - "Master of the Apothecarion", - ]; - if (include_trainee){ - array_push(specialists, string("{0} Aspirant",roles[15])); - } - if (_chap_name == "Space Wolves"){ - array_push(specialists, roles[14]); - } - break; - case "heads": - specialists = role_groups("heads"); - break; - case "command": - specialists = role_groups("command"); - break; - case "trainee": - specialists = role_groups("trainee"); - break; - case "rank_and_file": - specialists = role_groups("rank_and_file"); - break; - case "squad_leaders": - specialists = role_groups("squad_leaders"); - break; - case "dreadnoughts": - specialists = role_groups("dreadnoughts"); - break; - case "veterans": - specialists = role_groups("veterans"); + _role_list = [_roles[eROLE.Apothecary]]; + if (_chap_name == "Space Wolves") { + array_push(_role_list, _roles[eROLE.Chaplain]); + if (include_trainee) { + array_push(_role_list, $"{_roles[eROLE.Chaplain]} Aspirant"); + } + if (include_heads) { + array_push(_role_list, "Master of Sanctity"); + } + } + if (include_trainee) { + array_push(_role_list, $"{_roles[eROLE.Apothecary]} Aspirant"); + } + if (include_heads) { + array_push(_role_list, "Master of the Apothecarion"); + } break; - case "captain_candidates": - specialists = role_groups("captain_candidates"); - break; - } - return array_contains(specialists,unit_role); + case "trainee": + _role_list = [ + $"{_roles[eROLE.Librarian]} Aspirant", + $"{_roles[eROLE.Apothecary]} Aspirant", + $"{_roles[eROLE.Chaplain]} Aspirant", + $"{_roles[eROLE.Techmarine]} Aspirant" + ]; + break; + case "heads": + _role_list = [ + "Master of Sanctity", + $"Chief {_roles[eROLE.Librarian]}", + "Forge Master", + "Chapter Master", + "Master of the Apothecarion" + ]; + break; + case "veterans": + _role_list = [ + _roles[eROLE.Veteran], + _roles[eROLE.Terminator], + _roles[eROLE.VeteranSergeant], + _roles[eROLE.HonourGuard] + ]; + break; + case "rank_and_file": + _role_list = [ + _roles[eROLE.Tactical], + _roles[eROLE.Devastator], + _roles[eROLE.Assault], + _roles[eROLE.Scout] + ]; + break; + case "squad_leaders": + _role_list = [ + _roles[eROLE.Sergeant], + _roles[eROLE.VeteranSergeant] + ]; + break; + case "command": + _role_list = [ + _roles[eROLE.Captain], + _roles[eROLE.Apothecary], + _roles[eROLE.Chaplain], + _roles[eROLE.Techmarine], + _roles[eROLE.Librarian], + "Codiciery", + "Lexicanum", + _roles[eROLE.Ancient], + _roles[eROLE.Champion] + ]; + break; + case "dreadnoughts": + _role_list = [ + _roles[eROLE.Dreadnought], + $"Venerable {_roles[eROLE.Dreadnought]}" + ]; + break; + case "captain_candidates": + _role_list = [ + _roles[eROLE.Sergeant], + _roles[eROLE.VeteranSergeant], + _roles[eROLE.Champion], + _roles[eROLE.Captain], + _roles[eROLE.Terminator], + _roles[eROLE.Veteran], + _roles[eROLE.Ancient] + ]; + break; + } + + return _role_list; +} + +function is_specialist(unit_role, type = "standard", include_trainee = false, include_heads = true) { + var _specialists = role_groups(type, include_trainee, include_heads); + + return array_contains(_specialists, unit_role); } //TODO write this out with proper formatting when i can be assed @@ -243,7 +220,11 @@ function collect_role_group(group="standard", location="", opposite=false, searc if (unit.name()=="") then continue; if (group!="all"){ if (is_array(group)){ - _is_special_group = unit.IsSpecialist(group[0], group[1]); + 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]); + } } else { _is_special_group = unit.IsSpecialist(group); } diff --git a/scripts/scr_company_struct/scr_company_struct.gml b/scripts/scr_company_struct/scr_company_struct.gml index 31ab43a45e..0bf6e9e3a5 100644 --- a/scripts/scr_company_struct/scr_company_struct.gml +++ b/scripts/scr_company_struct/scr_company_struct.gml @@ -145,6 +145,10 @@ function CompanyStruct(comp) constructor{ captain = "none"; champion = "none"; ancient = "none"; + chaplain = "none"; + apothecary = "none"; + tech_marine = "none"; + lib = "none"; static reset_squad_surface = function(){ if (is_array(squad_draw_surfaces)){ @@ -177,6 +181,19 @@ function CompanyStruct(comp) constructor{ ancient = unit; } else if (unit.role() == role_set[eROLE.Champion]){ champion = unit; + } else { + if (unit.IsSpecialist("chap")) { + chaplain = unit; + } + if (unit.IsSpecialist("apoth")) { + apothecary = unit; + } + if (unit.IsSpecialist("forge")) { + tech_marine = unit; + } + if (unit.IsSpecialist("lib")) { + lib = unit; + } } } } diff --git a/scripts/scr_complex_colour_kit/scr_complex_colour_kit.gml b/scripts/scr_complex_colour_kit/scr_complex_colour_kit.gml index 0a468ced0a..fa20359d09 100644 --- a/scripts/scr_complex_colour_kit/scr_complex_colour_kit.gml +++ b/scripts/scr_complex_colour_kit/scr_complex_colour_kit.gml @@ -411,7 +411,7 @@ function setup_complex_livery_shader(setup_role, game_setup=false, unit = "none" var _full_liveries = obj_ini.full_liveries; var _roles = obj_ini.role[100]; var data_set = obj_ini.full_liveries[0]; - if (is_specialist(setup_role, "libs")){ + if (is_specialist(setup_role, "lib")){ data_set = _full_liveries[eROLE.Librarian]; } else if (is_specialist(setup_role, "heads")){ if (is_specialist(setup_role, "apoth")){ diff --git a/scripts/scr_culture_visuals/scr_culture_visuals.gml b/scripts/scr_culture_visuals/scr_culture_visuals.gml index c9dd85ee43..57d086c79a 100644 --- a/scripts/scr_culture_visuals/scr_culture_visuals.gml +++ b/scripts/scr_culture_visuals/scr_culture_visuals.gml @@ -315,13 +315,13 @@ global.modular_drawing_items = [ sprite : spr_gear_librarian, body_types :[0], position : "right_pauldron_icons", - role_type : ["libs"], + role_type : ["lib"], }, { sprite : spr_gear_librarian_term, body_types :[2], position : "right_pauldron_icons", - role_type : ["libs"], + role_type : ["lib"], }, { sprite : spr_roman_centurian_crest, @@ -545,7 +545,7 @@ global.modular_drawing_items = [ sprite : spr_gear_hood2, body_types :[0], position : "mouth_variants", - role_type : ["libs"], + role_type : ["lib"], chapter_disadv : ["Warp Tainted"], }, { @@ -801,8 +801,8 @@ function DummyMarine()constructor{ return mobi[100][livery_picker.role_set > 0 ? livery_picker.role_set :eROLE.Tactical]; } } - static IsSpecialist = function(search_type="standard",include_trainee=false){ - return is_specialist(role(), search_type,include_trainee) + static IsSpecialist = function(search_type="standard",include_trainee=false, include_heads=true){ + return is_specialist(role(), search_type,include_trainee, include_heads); } static has_trait = marine_has_trait; diff --git a/scripts/scr_draw_unit_image/scr_draw_unit_image.gml b/scripts/scr_draw_unit_image/scr_draw_unit_image.gml index aefe881e5e..d54898654a 100644 --- a/scripts/scr_draw_unit_image/scr_draw_unit_image.gml +++ b/scripts/scr_draw_unit_image/scr_draw_unit_image.gml @@ -347,7 +347,7 @@ function scr_draw_unit_image(_background = false) { unit_specialization = UnitSpecialization.Apothecary; } } else // Librarian - if (is_specialist(unit_role, "libs", true)) { + if (is_specialist(unit_role, "lib", true)) { unit_specialization = UnitSpecialization.Librarian; } else // Death Company if (unit_role == "Death Company") { diff --git a/scripts/scr_drop_fiddle/scr_drop_fiddle.gml b/scripts/scr_drop_fiddle/scr_drop_fiddle.gml index a633e29ad7..9ad5ca69a6 100644 --- a/scripts/scr_drop_fiddle/scr_drop_fiddle.gml +++ b/scripts/scr_drop_fiddle/scr_drop_fiddle.gml @@ -51,7 +51,7 @@ function scr_drop_fiddle(argument0, argument1, argument2, argument3) { if (obj_ini.role[comp][i] == obj_ini.role[100][5]) then capts++; if (unit.IsSpecialist("chap", true)) then chaplains++; - if (unit.IsSpecialist("libs", true)) then psykers++; + if (unit.IsSpecialist("lib", true)) then psykers++; if (unit.IsSpecialist("apoth", true)) then apothecaries++; if (unit.IsSpecialist("forge", true)) then techmarines++; @@ -119,7 +119,7 @@ function scr_drop_fiddle(argument0, argument1, argument2, argument3) { if (obj_ini.role[comp][i] == obj_ini.role[100][5]) then capts--; if (unit.IsSpecialist("chap", true)) then chaplains--; - if (unit.IsSpecialist("libs", true)) then psykers--; + if (unit.IsSpecialist("lib", true)) then psykers--; if (unit.IsSpecialist("apoth", true)) then apothecaries--; if (unit.IsSpecialist("forge", true)) then techmarines--; diff --git a/scripts/scr_manage_task_selector/scr_manage_task_selector.gml b/scripts/scr_manage_task_selector/scr_manage_task_selector.gml index a1aeb2b48b..772a2524a2 100644 --- a/scripts/scr_manage_task_selector/scr_manage_task_selector.gml +++ b/scripts/scr_manage_task_selector/scr_manage_task_selector.gml @@ -82,6 +82,90 @@ function scr_manage_task_selector(){ managing = unit.company; update_general_manage_view(); exit; + break; + case "chaplain_promote": + unit = display_unit[i]; + unit.squad="none"; + var start_company = unit.company; + var end_company = selection_data.system; + var endslot = 0; + for (i=0;i 0) { if (marine_casting[g] == true) { diff --git a/scripts/scr_roster/scr_roster.gml b/scripts/scr_roster/scr_roster.gml index 6f51d1f325..0f6c469067 100644 --- a/scripts/scr_roster/scr_roster.gml +++ b/scripts/scr_roster/scr_roster.gml @@ -543,7 +543,7 @@ function add_unit_to_battle(unit,meeting, is_local){ //librarium roles - }else if (unit.IsSpecialist("libs",true)){ + }else if (unit.IsSpecialist("lib",true)){ col = obj_controller.bat_librarian_column; //librarium new_combat.librarians++; moov = 1; diff --git a/scripts/scr_special_view/scr_special_view.gml b/scripts/scr_special_view/scr_special_view.gml index 3a2092d57b..e976b9e535 100644 --- a/scripts/scr_special_view/scr_special_view.gml +++ b/scripts/scr_special_view/scr_special_view.gml @@ -66,7 +66,7 @@ function scr_special_view(command_group) { v=0; if (command_group==13) or (command_group==0){// Librarium - var libs = collect_role_group(["libs",true]); + var libs = collect_role_group(["lib",true]); for (var i=0;i 0 && managing <= 10 && (!cap_slot || !champ_slot || !ancient_slot)) { + if (managing > 0 && managing <= 10 && (!cap_slot || !champ_slot || !ancient_slot || !chaplain_slot || !tech_marine_slot || !apothecary_slot || !lib_slot)) { if (!cap_slot) { - draw_set_color(c_black); - draw_rectangle(xx + 25, yy + 64, xx + 974, yy + 85, 0); - draw_set_color(c_gray); - draw_rectangle(xx + 25, yy + 64, xx + 974, yy + 85, 1); - draw_set_halign(fa_center); - draw_set_color(c_yellow); - draw_text(xx + 500, yy + 66, "++New Captain Required++"); - draw_set_halign(fa_left); - draw_set_color(c_gray); - if (point_and_click([xx + 25, yy + 64, xx + 974, yy + 85])) { - var candidates = collect_role_group("captain_candidates"); - group_selection(candidates, { - purpose: $"{scr_roman_numerals()[managing - 1]} Company Captain Candidates", - purpose_code: "captain_promote", - number: 1, - system: managing, - feature: "none", - planet: 0, - selections: [] - }); - exit; - } + special_role_slot_open(xx, yy, {}, { + group: "captain_candidates", + location: "", + opposite: false + }, $"{scr_roman_numerals()[managing - 1]} Company Captain Candidates", "captain_promote", "New Captain Required"); yy += 20; cap_slot = true; + if (managing == -1) { + exit; + } continue; } if (!champ_slot) { - draw_set_color(c_black); - draw_rectangle(xx + 25, yy + 64, xx + 974, yy + 85, 0); - draw_set_color(c_gray); - draw_rectangle(xx + 25, yy + 64, xx + 974, yy + 85, 1); - draw_set_halign(fa_center); - draw_set_color(c_yellow); - draw_text(xx + 500, yy + 66, "++New Champion Required++"); - draw_set_halign(fa_left); - draw_set_color(c_gray); - if (point_and_click([xx + 25, yy + 64, xx + 974, yy + 85])) { - var search_params = { - companies: managing, - "stat": [ - ["weapon_skill", 44, "more"] - ] - }; - var candidates = collect_role_group("standard", "", true, search_params); - group_selection(candidates, { - purpose: $"{scr_roman_numerals()[managing - 1]} Champion Candidates", - purpose_code: "champion_promote", - number: 1, - system: managing, - feature: "none", - planet: 0, - selections: [] - }); - exit; - } + special_role_slot_open(xx, yy, { + companies: managing, + "stat": [ + ["weapon_skill", 44, "more"] + ] + }, { + group: "standard", + location: "", + opposite: false + }, $"{scr_roman_numerals()[managing - 1]} Champion Candidates", "champion_promote", "New Champion Required"); + yy += 20; champ_slot = true; + if (managing == -1) { + exit; + } continue; } if (!ancient_slot) { - draw_set_color(c_black); - draw_rectangle(xx + 25, yy + 64, xx + 974, yy + 85, 0); - draw_set_color(c_gray); - draw_rectangle(xx + 25, yy + 64, xx + 974, yy + 85, 1); - draw_set_halign(fa_center); - draw_set_color(c_yellow); - draw_text(xx + 500, yy + 66, "++New Ancient Required++"); - draw_set_halign(fa_left); - draw_set_color(c_gray); - if (point_and_click([xx + 25, yy + 64, xx + 974, yy + 85])) { - var search_params = { - companies: managing - }; - var candidates = collect_role_group("standard", "", true, search_params); - group_selection(candidates, { - purpose: $"{scr_roman_numerals()[managing - 1]} Company Ancient Candidates", - purpose_code: "ancient_promote", - number: 1, - system: managing, - feature: "none", - planet: 0, - selections: [] - }); + special_role_slot_open(xx, yy, { + companies: managing + }, { + group: "standard", + location: "", + opposite: true + }, $"{scr_roman_numerals()[managing - 1]} Company Ancient Candidates", "ancient_promote", "New Ancient Required"); + + yy += 20; + ancient_slot = true; + if (managing == -1) { exit; } + continue; + } + if (!chaplain_slot) { + special_role_slot_open(xx, yy, { + companies: [managing, 0] + }, { + group: ["chap", false, false], + location: "", + opposite: false + }, $"{scr_roman_numerals()[managing - 1]} Company Chaplain Candidates", "chaplain_promote", "New Company Chaplain Required"); yy += 20; - ancient_slot = true; + chaplain_slot = true; + if (managing == -1) { + exit; + } + continue; + } + if (!apothecary_slot) { + special_role_slot_open(xx, yy, { + companies: [managing, 0] + }, { + group: ["apoth", false, false], + location: "", + opposite: false + }, $"{scr_roman_numerals()[managing - 1]} Company Apothecary Candidates", "apothecary_promote", "New Company Apothecary Required"); + yy += 20; + apothecary_slot = true; + if (managing == -1) { + exit; + } + continue; + } + if (!tech_marine_slot) { + special_role_slot_open(xx, yy, { + companies: [managing, 0] + }, { + group: ["forge", false, false], + location: "", + opposite: false + }, $"{scr_roman_numerals()[managing - 1]} Company Tech Marine Candidates", "tech_marine_promote", "New Company Tech Marine Required"); + yy += 20; + tech_marine_slot = true; + if (managing == -1) { + exit; + } + continue; + } + if (!lib_slot) { + special_role_slot_open(xx, yy, { + companies: [managing, 0] + }, { + group: ["lib", false, false], + location: "", + opposite: false + }, $"{scr_roman_numerals()[managing - 1]} Company Librarian Candidates", "librarian_promote", "New Company Librarian Required"); + yy += 20; + lib_slot = true; + if (managing == -1) { + exit; + } continue; } } + if (sel >= array_length(display_unit)) { break; } @@ -770,7 +825,6 @@ function scr_ui_manage() { man_current++; } } - yy += 20; sel += 1; }