Skip to content

Commit

Permalink
fix: Specialists system refactor cleanup (#508)
Browse files Browse the repository at this point in the history
  • Loading branch information
MCPO-Spartan-117 authored Feb 24, 2025
1 parent f5ca368 commit 535d671
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 27 deletions.
8 changes: 4 additions & 4 deletions objects/obj_controller/Create_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -1381,25 +1381,25 @@ spec_train_data = [
name : "Techmarine",
min_exp : 30,
coord_offset : [0, 0],
req : [["technology",34, "more"]]
req : [["technology",34, "exmore"]]
},
{
name : "Librarian",
min_exp : 30,
coord_offset : [0, -7],
req : [["psionic", 8, "more"]]
req : [["psionic", 7, "exmore"]]
},
{
name : "Chaplain",
min_exp : 60,
coord_offset : [7, -7],
req : [["piety", 34, "more"], ["charisma", 29, "more"]]
req : [["piety", 34, "exmore"], ["charisma", 29, "exmore"]]
},
{
name : "Apothecary",
min_exp : 60,
coord_offset : [7, 0],
req : [["technology", 29, "more"], ["intelligence",44, "more"]]
req : [["technology", 29, "exmore"], ["intelligence",44, "exmore"]]
},
];
// Redefines training based on chapter
Expand Down
39 changes: 29 additions & 10 deletions scripts/is_specialist/is_specialist.gml
Original file line number Diff line number Diff line change
Expand Up @@ -274,17 +274,36 @@ function stat_valuator(search_params, unit){
match = false;
break;
}
if (_stat_val[2] == "more"){
switch _stat_val[2] {
case "inmore":
case "more":
if (unit[$ _stat_val[0]] < _stat_val[1]){
match = false;
break;
}
break;

if (unit[$ _stat_val[0]] < _stat_val[1]){
match = false;
break;
}
} else if(_stat_val[2] == "less"){
if (unit[$ _stat_val[0]] > _stat_val[1]){
match = false;
break;
}
case "exmore":
if (unit[$ _stat_val[0]] <= _stat_val[1]){
match = false;
break;
}
break;

case "inless":
case "less":
if (unit[$ _stat_val[0]] > _stat_val[1]){
match = false;
break;
}
break;

case "exless":
if (unit[$ _stat_val[0]] >= _stat_val[1]){
match = false;
break;
}
break;
}
}
return match;
Expand Down
10 changes: 5 additions & 5 deletions scripts/scr_load_controller/scr_load_controller.gml
Original file line number Diff line number Diff line change
Expand Up @@ -223,25 +223,25 @@ function scr_load_controller(save_id){
name : "Techmarine",
min_exp : 30,
coord_offset : [0, 0],
req : [["technology",34, "more"]]
req : [["technology",34, "exmore"]]
},
{
name : "Librarian",
min_exp : 30,
coord_offset : [0, -7],
req : [["psionic", 8, "more"]]
req : [["psionic", 7, "exmore"]]
},
{
name : "Chaplain",
min_exp : 60,
coord_offset : [7, -7],
req : [["piety", 34, "more"], ["charisma", 29, "more"]]
req : [["piety", 34, "exmore"], ["charisma", 29, "exmore"]]
},
{
name : "Apothecary",
min_exp : 60,
coord_offset : [7, 0],
req : [["technology", 29, "more"], ["intelligence",44, "more"]]
req : [["technology", 29, "exmore"], ["intelligence",44, "exmore"]]
},
]);

Expand Down Expand Up @@ -503,4 +503,4 @@ function scr_load_controller(save_id){
obj_controller.bat_scout_column=ini_read_real("Controller","bat_scout_column",1);

ini_close();
}
}
2 changes: 1 addition & 1 deletion scripts/scr_management/scr_management.gml
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ function scr_management(argument0) {

if (unit.role() == "Lexicanum") then num[4] += 1;

if (unit.role() == string(role_names[eROLE.Apothecary]) + " Aspirant") then num[5] += 1;
if (unit.role() == string(role_names[eROLE.Librarian]) + " Aspirant") then num[5] += 1;
}

with(obj_managment_panel){if (manage!=obj_controller.temp[71]) then instance_deactivate_object(id);}
Expand Down
13 changes: 6 additions & 7 deletions scripts/scr_specialist_training/scr_specialist_training.gml
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ function apothecary_training(){
if (random_marine != "none"){
marine_position=random_marine[1];
marine_company=random_marine[0];
open_slot=0;
g2=0;
// This gets the last open slot for company 0
var open_slot = find_company_open_slot(0);
if (open_slot!=-1){
Expand Down Expand Up @@ -247,7 +245,7 @@ function librarian_training(){


if (training_psyker>0){
recruit_count=scr_role_count(novice_type,"0");
recruit_count=scr_role_count(novice_type,"");
if (psyker_points>=goal){
if (recruit_count>0){
marine_position=0;
Expand Down Expand Up @@ -286,8 +284,10 @@ function librarian_training(){
scr_alert("red","recruitment","No remaining warp sensitive marines for training",0,0);
}else if (random_marine != "none"){
// This gets the last open slot for company 0
marine_position = random_marine[1];
marine_company = random_marine[0];
var open_slot = find_company_open_slot(0);
scr_move_unit_info(random_marine[0],0, random_marine[1], open_slot);
scr_move_unit_info(marine_company,0, marine_position, open_slot);
unit = fetch_unit([0,open_slot]);
unit.update_role(novice_type)
unit.update_powers();
Expand All @@ -301,7 +301,7 @@ function librarian_training(){
unit.update_mobility_item("");
scr_alert("green","recruitment",unit.name_role()+" begins training.",0,0);
with(obj_ini){
scr_company_order(random_marine[0]);
scr_company_order(marine_company);
scr_company_order(0);
}
}
Expand Down Expand Up @@ -368,7 +368,7 @@ function techmarine_training(){
}
}else if (tech_points>=4) and (recruit_count==0){
marine_position=0;
var _data = spec_train_data[1];
var _data = spec_train_data[0];
var marine_company=0;
var random_marine=scr_random_marine(
[
Expand All @@ -385,7 +385,6 @@ function techmarine_training(){
if (random_marine != "none"){
marine_position = random_marine[1];
marine_company = random_marine[0];
g2=0;
// This gets the last open slot for company 0
var open_slot = find_company_open_slot(0);
if (open_slot!=-1){
Expand Down

0 comments on commit 535d671

Please sign in to comment.