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_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, "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) {
Expand Down
4 changes: 2 additions & 2 deletions scripts/exp_and_exp_growth/exp_and_exp_growth.gml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function unit_stat_growth(grow_stat=false){

var group_growths = [
["forge" , "technology"],
["libs" , "intelligence"],
["lib" , "intelligence"],
["chap" , "charisma"],
["apoth" , "intelligence"],
];
Expand Down Expand Up @@ -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();
Expand Down
339 changes: 160 additions & 179 deletions scripts/is_specialist/is_specialist.gml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
Expand Down
Loading