Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion objects/obj_controller/Alarm_6.gml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if (menu==1) and (managing>0){
if (man_sel[f]==1){
if (man[f]=="man"){
unit = display_unit[f];
if (ma_promote[f]==0 && (!unit.IsSpecialist("rank_and_file")) && (!unit.IsSpecialist("squad_leaders")) && (!unit.IsSpecialist("veterans"))) then sel_promoting=-1;
if (ma_promote[f]==0 && (!unit.IsSpecialist(SPECIALISTS_RANK_AND_FILE)) && (!unit.IsSpecialist(SPECIALISTS_SQUAD_LEADERS)) && (!unit.IsSpecialist(SPECIALISTS_VETERANS))) then sel_promoting=-1;
}

if (ma_role[f]=="Ork Sniper") or (ma_role[f]=="Flash Git") or (ma_role[f]=="Crusader") or (ma_role[f]=="Skitarii") then otha=1;
Expand Down
2 changes: 1 addition & 1 deletion objects/obj_event/Step_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ if (ticked=1){// Select a random marine and have them perform an action
repeat(20){
if (good=false){
good=true;ide=floor(random(attendants))+1;
if (unit.IsSpecialist("heads")) then good=false;
if (unit.IsSpecialist(SPECIALISTS_HEADS)) then good=false;
}
}
if (good=false) then good=true;
Expand Down
2 changes: 1 addition & 1 deletion objects/obj_p_assra/Alarm_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ for (o=0;o<array_length(origin.board_co);o++){
if (unit.hp()<=-15) and (obj_ini.race[co][i]=1) and (unit.name()!=""){
var seed_lost=0;
if (apothecary<=0){
if (unit.IsSpecialist("standard")){
if (unit.IsSpecialist(SPECIALISTS_STANDARD)){
obj_fleet.fallen_command+=1;
}else {
obj_fleet.fallen+=1;
Expand Down
2 changes: 1 addition & 1 deletion objects/obj_p_assra/Step_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ if (boarding=true) and (board_cooldown>=0) and (instance_exists(target)) and (in

if (unit.hp()<=0){
boarders_dead+=1;
if (unit.IsSpecialist("apoth") && unit.gear()=="Narthecium"){
if (unit.IsSpecialist(SPECIALISTS_APOTHECARIES) && unit.gear()=="Narthecium"){
apothecary-=1;
apothecary_had-=1;
}
Expand Down
2 changes: 1 addition & 1 deletion objects/obj_popup/Draw_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -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, "lib")){
// if (obj_controller.command_set[1]!=0 && !is_specialist(unit_role, SPECIALISTS_LIBRARIANS)){
for (i = 1; i <= 10; i++) {
var comp_data = company_promote_data[i - 1];
if (obj_controller.command_set[2] == 1) {
Expand Down
2 changes: 1 addition & 1 deletion objects/obj_popup/Mouse_50.gml
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ if (point_in_rectangle(mouse_x, mouse_y, xx+1465, yy+499,xx+1576,yy+518)){// Pro
}
mem_unit=obj_ini.TTRPG[target_comp][mahreens];
mem_unit.squad = move_squad;
if (!mem_unit.IsSpecialist("squad_leaders")){
if (!mem_unit.IsSpecialist(SPECIALISTS_SQUAD_LEADERS)){
mem_unit.update_role(role_name[target_role]);
mem_unit.alter_equipment({
"wep1":req_wep1,
Expand Down
4 changes: 2 additions & 2 deletions objects/obj_popup/Step_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -1878,7 +1878,7 @@ try {
if (image == "new_forge_master") {
if (pathway == "") {
obj_controller.complex_event = true;
techs = collect_role_group("forge");
techs = collect_role_group(SPECIALISTS_TECHS);
charisma_pick = 0;
experience_pick = 0;
talent_pick = 0;
Expand Down Expand Up @@ -2006,7 +2006,7 @@ try {
}
if (pathway == "tech_aftermath") {
var tech, t, i, check_tech, location_techs, location_heretics, delete_positions, heretic_data = [0, 0, 0], loyal_data = [0, 0, 0];
techs = collect_role_group("forge");
techs = collect_role_group(SPECIALISTS_TECHS);
var tech_count = array_length(techs);
for (i = 0; i < tech_count; i++) {
delete_positions = [];
Expand Down
10 changes: 5 additions & 5 deletions scripts/exp_and_exp_growth/exp_and_exp_growth.gml
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ function unit_stat_growth(grow_stat=false){
};

var group_growths = [
["forge" , "technology"],
["lib" , "intelligence"],
["chap" , "charisma"],
["apoth" , "intelligence"],
[SPECIALISTS_TECHS , "technology"],
[SPECIALISTS_LIBRARIANS , "intelligence"],
[SPECIALISTS_CHAPLAINS , "charisma"],
[SPECIALISTS_APOTHECARIES , "intelligence"],
];

var role_growth = [
Expand Down Expand Up @@ -258,7 +258,7 @@ function add_unit_exp(add_val){
instace_stat_point_gains = handle_stat_growth(true);
}

if (IsSpecialist("lib")) {
if (IsSpecialist(SPECIALISTS_LIBRARIANS)) {
_powers_learned = update_powers()
}
role_refresh();
Expand Down
61 changes: 44 additions & 17 deletions scripts/is_specialist/is_specialist.gml
Original file line number Diff line number Diff line change
@@ -1,15 +1,36 @@
#macro SPECIALISTS_APOTHECARIES "apothecaries"
#macro SPECIALISTS_CHAPLAINS "chaplains"
#macro SPECIALISTS_LIBRARIANS "librarians"
#macro SPECIALISTS_TECHS "techs"
#macro SPECIALISTS_STANDARD "standard"
#macro SPECIALISTS_VETERANS "veterans"
#macro SPECIALISTS_RANK_AND_FILE "rank_and_file"
#macro SPECIALISTS_SQUAD_LEADERS "squad_leaders"
#macro SPECIALISTS_COMMAND "command"
#macro SPECIALISTS_DREADNOUGHTS "dreadnoughts"
#macro SPECIALISTS_CAPTAIN_CANDIDATES "captain_candidates"
#macro SPECIALISTS_TRAINEES "trainees"
#macro SPECIALISTS_HEADS "heads"

/// @description Retrieves the active roles from the game, either from the obj_creation or obj_ini object.
/// @returns {array}
function active_roles(){
var _roles = instance_exists(obj_creation) ? obj_creation.role[100] : obj_ini.role[100];
return _roles;
}

/// @description Returns a list of roles based on the specified group, with optional inclusion of trainees and heads.
/// @param {integer} group The group of roles to retrieve (e.g., SPECIALISTS_STANDARD, SPECIALISTS_LIBRARIANS).
/// @param {bool} include_trainee Whether to include trainee roles (default is false).
/// @param {bool} include_heads Whether to include head roles (default is true).
/// @returns {array}
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;

switch (group) {
case "standard":
case SPECIALISTS_STANDARD:
_role_list = [
_roles[eROLE.Captain],
_roles[eROLE.Dreadnought],
Expand All @@ -24,14 +45,14 @@ function role_groups(group, include_trainee = false, include_heads = true) {
_roles[eROLE.HonourGuard]
];
if (include_trainee) {
_role_list = array_concat(_role_list, role_groups("trainee"));
_role_list = array_concat(_role_list, role_groups(SPECIALISTS_TRAINEES));
}
if (include_heads) {
_role_list = array_concat(_role_list, role_groups("heads"));
_role_list = array_concat(_role_list, role_groups(SPECIALISTS_HEADS));
}
break;

case "lib":
case SPECIALISTS_LIBRARIANS:
_role_list = [
_roles[eROLE.Librarian],
"Codiciery",
Expand All @@ -44,7 +65,7 @@ function role_groups(group, include_trainee = false, include_heads = true) {
array_push(_role_list, $"Chief {_roles[eROLE.Librarian]}");
}
break;
case "forge":
case SPECIALISTS_TECHS:
_role_list = [
_roles[eROLE.Techmarine],
"Techpriest"
Expand All @@ -56,7 +77,7 @@ function role_groups(group, include_trainee = false, include_heads = true) {
array_push(_role_list, "Forge Master");
}
break;
case "chap":
case SPECIALISTS_CHAPLAINS:
_role_list = [_roles[eROLE.Chaplain]];
if (_chap_name == "Iron Hands") {
array_push(_role_list, _roles[eROLE.Techmarine]);
Expand All @@ -74,7 +95,7 @@ function role_groups(group, include_trainee = false, include_heads = true) {
array_push(_role_list, "Master of Sanctity");
}
break;
case "apoth":
case SPECIALISTS_APOTHECARIES:
_role_list = [_roles[eROLE.Apothecary]];
if (_chap_name == "Space Wolves") {
array_push(_role_list, _roles[eROLE.Chaplain]);
Expand All @@ -93,15 +114,15 @@ function role_groups(group, include_trainee = false, include_heads = true) {
}
break;

case "trainee":
case SPECIALISTS_TRAINEES:
_role_list = [
$"{_roles[eROLE.Librarian]} Aspirant",
$"{_roles[eROLE.Apothecary]} Aspirant",
$"{_roles[eROLE.Chaplain]} Aspirant",
$"{_roles[eROLE.Techmarine]} Aspirant"
];
break;
case "heads":
case SPECIALISTS_HEADS:
_role_list = [
"Master of Sanctity",
$"Chief {_roles[eROLE.Librarian]}",
Expand All @@ -110,29 +131,29 @@ function role_groups(group, include_trainee = false, include_heads = true) {
"Master of the Apothecarion"
];
break;
case "veterans":
case SPECIALISTS_VETERANS:
_role_list = [
_roles[eROLE.Veteran],
_roles[eROLE.Terminator],
_roles[eROLE.VeteranSergeant],
_roles[eROLE.HonourGuard]
];
break;
case "rank_and_file":
case SPECIALISTS_RANK_AND_FILE:
_role_list = [
_roles[eROLE.Tactical],
_roles[eROLE.Devastator],
_roles[eROLE.Assault],
_roles[eROLE.Scout]
];
break;
case "squad_leaders":
case SPECIALISTS_SQUAD_LEADERS:
_role_list = [
_roles[eROLE.Sergeant],
_roles[eROLE.VeteranSergeant]
];
break;
case "command":
case SPECIALISTS_COMMAND:
_role_list = [
_roles[eROLE.Captain],
_roles[eROLE.Apothecary],
Expand All @@ -145,13 +166,13 @@ function role_groups(group, include_trainee = false, include_heads = true) {
_roles[eROLE.Champion]
];
break;
case "dreadnoughts":
case SPECIALISTS_DREADNOUGHTS:
_role_list = [
_roles[eROLE.Dreadnought],
$"Venerable {_roles[eROLE.Dreadnought]}"
];
break;
case "captain_candidates":
case SPECIALISTS_CAPTAIN_CANDIDATES:
_role_list = [
_roles[eROLE.Sergeant],
_roles[eROLE.VeteranSergeant],
Expand All @@ -167,7 +188,13 @@ function role_groups(group, include_trainee = false, include_heads = true) {
return _role_list;
}

function is_specialist(unit_role, type = "standard", include_trainee = false, include_heads = true) {
/// @description Checks if a given unit's role is a specialist within a specific role group.
/// @param {string} unit_role The role of the unit to check.
/// @param {integer} type The type of specialist group to check (default is SPECIALISTS_STANDARD).
/// @param {bool} include_trainee Whether to include trainee roles (default is false).
/// @param {bool} include_heads Whether to include head roles (default is true).
/// @returns {bool}
function is_specialist(unit_role, type = SPECIALISTS_STANDARD, include_trainee = false, include_heads = true) {
var _specialists = role_groups(type, include_trainee, include_heads);

return array_contains(_specialists, unit_role);
Expand All @@ -184,7 +211,7 @@ function is_specialist(unit_role, type = "standard", include_trainee = false, 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="standard", location="", opposite=false, search_conditions = {companies:"all"}){
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;
Expand Down
2 changes: 1 addition & 1 deletion scripts/scr_ComplexSet/scr_ComplexSet.gml
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ function ComplexSet(unit) constructor{
assign_modulars();
}

if (unit.IsSpecialist("forge")){
if (unit.IsSpecialist(SPECIALISTS_TECHS)){
if array_contains(["MK5 Heresy", "MK6 Corvus","MK7 Aquila", "MK8 Errant", "Artificer Armour"], unit_armour){
if (unit.has_trait("tinkerer")){
add_group({
Expand Down
8 changes: 4 additions & 4 deletions scripts/scr_after_combat/scr_after_combat.gml
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,10 @@ function after_battle_part2() {
var destroy;destroy=0;
if ((marine_dead[i]>0) or (obj_ncombat.defeat!=0)) and (marine_type[i]!="") and (ally[i]=false){
var comm=false;
if (_unit.IsSpecialist("standard",true)){
if (_unit.IsSpecialist(SPECIALISTS_STANDARD,true)){
obj_ncombat.final_command_deaths+=1;
var recent=true;
if (is_specialist(_unit.role, "trainee")){
if (is_specialist(_unit.role, SPECIALISTS_TRAINEES)){
recent=false
} else if (array_contains([string("Venerable {0}",obj_ini.role[100][6]), "Codiciery", "Lexicanum"], _unit.role())){
recent=false
Expand Down Expand Up @@ -441,7 +441,7 @@ function after_battle_part1() {

if (!marine_dead[i]){
// Apothecaries for saving marines;
if (unit.IsSpecialist("apoth", true)) {
if (unit.IsSpecialist(SPECIALISTS_APOTHECARIES, true)) {
skill_level = unit.intelligence * 0.0125;
if (marine_gear[i]=="Narthecium"){
skill_level*=2;
Expand All @@ -452,7 +452,7 @@ function after_battle_part1() {
}

// Techmarines for saving vehicles;
if (unit.IsSpecialist("forge", true)) {
if (unit.IsSpecialist(SPECIALISTS_TECHS, true)) {
skill_level = unit.technology / 10;
if (marine_mobi[i]=="Servo-arm") {
skill_level *= 1.5;
Expand Down
4 changes: 2 additions & 2 deletions scripts/scr_apothecary_ground/scr_apothecary_ground.gml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ function calculate_full_chapter_spread(){
}
}
tech_points_used += _unit.equipment_maintenance_burden();
_is_tech = (_unit.IsSpecialist("forge"));
_is_tech = (_unit.IsSpecialist(SPECIALISTS_TECHS));
if (_is_tech){
add_forge_points_to_stack(_unit);
}
is_healer = (((_unit.IsSpecialist("apoth",true) && _unit.gear()=="Narthecium") || (_unit.role()=="Sister Hospitaler")) && _unit.hp()>=10);
is_healer = (((_unit.IsSpecialist(SPECIALISTS_APOTHECARIES,true) && _unit.gear()=="Narthecium") || (_unit.role()=="Sister Hospitaler")) && _unit.hp()>=10);
if (is_healer){
add_apoth_points_to_stack(_unit);
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/scr_boarding_actions/scr_boarding_actions.gml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function create_boarding_craft(target_ship){
boarders-=1;
bear.boarders+=1;
unit = fetch_unit([board_co[o] , board_id[o]]);
if (unit.IsSpecialist("apoth")){
if (unit.IsSpecialist(SPECIALISTS_APOTHECARIES)){
if (unit.gear()=="Narthecium") and (unit.hp()>=10) then bear.apothecary+=1;
}
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/scr_clean/scr_clean.gml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function check_dead_marines(unit_struct, unit_index) {
obj_ncombat.red_thirst = 2;
}

if (unit_struct.IsSpecialist("dreadnoughts")) {
if (unit_struct.IsSpecialist(SPECIALISTS_DREADNOUGHTS)) {
dreads -= 1;
} else {
men -= 1;
Expand Down
8 changes: 4 additions & 4 deletions scripts/scr_company_struct/scr_company_struct.gml
Original file line number Diff line number Diff line change
Expand Up @@ -182,16 +182,16 @@ function CompanyStruct(comp) constructor{
} else if (unit.role() == role_set[eROLE.Champion]){
champion = unit;
} else {
if (unit.IsSpecialist("chap")) {
if (unit.IsSpecialist(SPECIALISTS_CHAPLAINS)) {
chaplain = unit;
}
if (unit.IsSpecialist("apoth")) {
if (unit.IsSpecialist(SPECIALISTS_APOTHECARIES)) {
apothecary = unit;
}
if (unit.IsSpecialist("forge")) {
if (unit.IsSpecialist(SPECIALISTS_TECHS)) {
tech_marine = unit;
}
if (unit.IsSpecialist("lib")) {
if (unit.IsSpecialist(SPECIALISTS_LIBRARIANS)) {
lib = unit;
}
}
Expand Down
4 changes: 2 additions & 2 deletions scripts/scr_company_view/scr_company_view.gml
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ function other_manage_data(){
if (unit.squad == "none"){


if (is_specialist(squad_type,"heads")) then n=1;
if (is_specialist(squad_type,SPECIALISTS_HEADS)) then n=1;
if (squad_type==obj_ini.role[100][6]) and (squad_type!=ma_role[v]) and (squad_type!="Venerable "+string(ma_role[v])) then n=2;
if (squad_type==obj_ini.role[100][6]) and (ma_role[v]=obj_ini.role[100][6]) then n=0;
if (squad_type==obj_ini.role[100][6]) and (ma_role[v]="Venerable "+string(obj_ini.role[100][6])) then n=0;
Expand Down Expand Up @@ -322,7 +322,7 @@ function other_manage_data(){
if (unit.role()=obj_ini.role[100][16]) then ma_promote[v]=1;

var target_company = 0;
if (unit.IsSpecialist("rank_and_file")){
if (unit.IsSpecialist(SPECIALISTS_RANK_AND_FILE)){
if (unit.company >= 8) then target_company = unit.company - 1;
else if (unit.company >= 6) then target_company = 5;
else if (unit.company >= 2) then target_company = 1;
Expand Down
Loading