Skip to content

Commit 5181620

Browse files
feat: Recruitment types
1 parent 5f04a33 commit 5181620

5 files changed

Lines changed: 110 additions & 44 deletions

File tree

objects/obj_star_select/Create_0.gml

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,28 @@ recruiting_button.update({
4141
target : target,
4242
});
4343
recruiting_button.bind_method = function(){
44-
if (obj_controller.faction_status[eFACTION.Imperium] != "War" && p_data.current_owner <= 5) || (obj_controller.faction_status[eFACTION.Imperium] == "War") {
45-
if (!p_data.has_feature(P_features.Recruiting_World)) {
46-
array_push(target.p_feature[obj_controller.selecting_planet], new NewPlanetFeature(P_features.Recruiting_World));
47-
obj_controller.recruiting_worlds += $"{planet_numeral_name(obj_controller.selecting_planet, target)}|";
48-
} else {
49-
delete_features(target.p_feature[obj_controller.selecting_planet], P_features.Recruiting_World)
50-
obj_controller.recruiting_worlds=string_replace(obj_controller.recruiting_worlds,string(target.name)+" "+scr_roman(obj_controller.selecting_planet)+"|","");
51-
}
44+
if (!p_data.has_feature(P_features.Recruiting_World)) {
45+
array_push(target.p_feature[obj_controller.selecting_planet], new NewPlanetFeature(P_features.Recruiting_World));
46+
obj_controller.recruiting_worlds += $"{planet_numeral_name(obj_controller.selecting_planet, target)}|";
47+
} else {
48+
delete_features(target.p_feature[obj_controller.selecting_planet], P_features.Recruiting_World);
49+
obj_controller.recruiting_worlds=string_replace(obj_controller.recruiting_worlds,string(target.name)+" "+scr_roman(obj_controller.selecting_planet)+"|","");
50+
}
51+
};
52+
53+
recruitment_type_button = new PurchaseButton(0);
54+
recruitment_type_button.update({
55+
tooltip : "Change recruitment type",
56+
label : "Recruitment Type",
57+
target : target,
58+
});
59+
recruitment_type_button.bind_method = function(){
60+
var p_data = new PlanetData(obj_controller.selecting_planet, target);
61+
var _recruit_world = p_data.get_features(P_features.Recruiting_World)[0];
62+
if (_recruit_world.recruit_type < 1) {
63+
_recruit_world.recruit_type++
64+
} else {
65+
_recruit_world.recruit_type--
5266
}
5367
};
5468

objects/obj_star_select/Draw_64.gml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,25 +279,44 @@ if (obj_controller.selecting_planet!=0){
279279
} else if (population){
280280
garrison_data_slate.title = "Population Report";
281281
garrison_data_slate.inside_method = function(){
282+
draw_set_color(c_gray);
282283
var xx = garrison_data_slate.XX;
283284
var yy = garrison_data_slate.YY;
284285
var cur_planet = obj_controller.selecting_planet;
285286
var half_way = garrison_data_slate.height/2;
287+
var spacing_x = 100
288+
var spacing_y = 50
286289
draw_set_halign(fa_left);
287290
if (!target.space_hulk) {
288291
if (obj_controller.faction_status[eFACTION.Imperium] != "War" && p_data.current_owner <= 5) || (obj_controller.faction_status[eFACTION.Imperium] == "War") {
289292
colonist_button.update({
290-
x1:xx+20,
291-
y1:yy+half_way,
293+
x1:xx+35,
294+
y1:half_way,
292295
allow_click : array_length(potential_doners),
293296
});
294297
colonist_button.draw();
295298
recruiting_button.update({
296-
x1:xx+200,
297-
y1:yy+half_way,
299+
x1:xx+(spacing_x*2)+15,
300+
y1:half_way,
298301
allow_click : true,
299302
});
300303
recruiting_button.draw();
304+
if (p_data.has_feature(P_features.Recruiting_World)) {
305+
var _recruit_world = p_data.get_features(P_features.Recruiting_World)[0];
306+
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) {
307+
draw_text(xx+(spacing_x*3)+35, half_way-20, "Open: Voluntery");
308+
} else if (_recruit_world.recruit_type == 0 && p_data.player_disposition <= 50) {
309+
draw_text(xx+(spacing_x*3)+35, half_way-20, "Covert: Voluntery");
310+
} else {
311+
draw_text(xx+(spacing_x*3)+35, half_way-20, "Abduct");
312+
}
313+
recruitment_type_button.update({
314+
x1:xx+(spacing_x*3)+35,
315+
y1:half_way,
316+
allow_click : true,
317+
});
318+
recruitment_type_button.draw();
319+
}
301320
}
302321
}
303322

scripts/scr_draw_planet_features/scr_draw_planet_features.gml

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ function FeatureSelected(Feature, system, planet) constructor{
181181
generic = true;
182182
var _planet = planet_data.planet;
183183
var _star = obj_star_select.target;
184-
var current_owner = _star.p_owner[_planet];
185-
var player_disposition = _star.dispo[_planet];
184+
var p_data = new PlanetData(_planet, _star);
185+
var _recruit_world = p_data.get_features(P_features.Recruiting_World)[0];
186186
var _system_point_use = obj_controller.specialist_point_handler.point_breakdown.systems;
187187
var _spare_apoth_points = 0;
188188
if (struct_exists(_system_point_use, _star.name)) {
@@ -191,18 +191,30 @@ function FeatureSelected(Feature, system, planet) constructor{
191191
}
192192
title = "Marine Recruitment";
193193
body = $"There are {_spare_apoth_points} apothecary rescource points available for recruit screening,\n\n";
194-
var _recruit_find_chance = find_recruit_success_chance(_spare_apoth_points, _star, _planet);
194+
var _recruit_find_chance = find_recruit_success_chance(_spare_apoth_points, _star, _planet, 1);
195195

196196
body += $"There is a {_recruit_find_chance * 100}% of producing a successful recruit this month on the basis of the available apothecary time to screen candidates and the chances of the aspirants passing their trials to an acceptable standard,\n\n";
197197

198-
if (obj_controller.faction_status[current_owner] == "War" || obj_controller.faction_status[current_owner] == "Antagonism") && (player_disposition <= 50) { // TODO LOW RECRUITING_DIALOG // Make this more dynamic and maybe make a event for this.
199-
body += "Since our relations with the populations' faction are... strained, we are having to do our recruiting operation covertly, some of our brothers may resort to more extreme methods of recruitment,\n\n"
200-
} else if (obj_controller.faction_status[current_owner] == "War" || obj_controller.faction_status[current_owner] == "Antagonism") {
201-
body += "The population has grown accustomed to us and their Governor has given us the clear to openly recruit,\n\n"
198+
if (obj_controller.faction_status[p_data.current_owner] == "War" || obj_controller.faction_status[p_data.current_owner] == "Antagonism") && (p_data.player_disposition <= 50) { // TODO LOW RECRUITING_DIALOG // Make this more dynamic.
199+
if (_recruit_world.recruit_type == 0) {
200+
body += "Since our relations with the populations' faction are... strained, we are having to do our recruiting operation covertly,\n\n"
201+
} else {
202+
body += "Since our relations with the populations' faction are... strained, we are having to do our recruiting operation covertly,"
203+
body += " our brothers are authorized to use more extreme methods of recruitment,\n\n"
204+
}
205+
} else if (obj_controller.faction_status[p_data.current_owner] == "War" || obj_controller.faction_status[p_data.current_owner] == "Antagonism") {
206+
if (_recruit_world.recruit_type == 0) {
207+
body += "The population has grown accustomed to us and their Governor has given us the clear to openly recruit,\n\n"
208+
} else {
209+
body += "The population has grown accustomed to us and their Governor has given us the clear to openly recruit,"
210+
body += " however our brothers are still authorized to use more extreme methods of recruitment regardless,\n\n"
211+
}
212+
} else if (_recruit_world.recruit_type == 1){
213+
body += "We've authorized our brothers to use more extreme methods of recruitment, should we really allow this Milord?\n\n"
202214
}
203215

204-
if (player_disposition < 100) {
205-
body += "To increase recruit success chance more apothecaries will be required on the planet surface, we could also deploy garrisons to make the population more friendly to our chapter";
216+
if (p_data.player_disposition < 100) {
217+
body += "To increase recruit success chance more apothecaries will be required on the planet surface, we could also deploy garrisons to make the population more friendly to our chapter.";
206218
} else {
207219
body += "To increase recruit success chance more apothecaries will be required on the planet surface.";
208220
}

scripts/scr_planetary_feature/scr_planetary_feature.gml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ function NewPlanetFeature(feature_type, other_data={}) constructor{
142142
case P_features.OrkWarboss:
143143
player_hidden = 1;
144144
planet_display= "Ork Warboss";
145-
Warboss = "alive"
145+
Warboss = "alive";
146146
break;
147147
case P_features.Monastery:
148148
planet_display="Fortress Monastary";
@@ -152,11 +152,12 @@ function NewPlanetFeature(feature_type, other_data={}) constructor{
152152
break;
153153
case P_features.Recruiting_World:
154154
planet_display="Recruitment";
155-
player_hidden = 0
155+
player_hidden = 0;
156+
recruit_type = 0;
156157
break;
157158
default:
158159
player_hidden = 1;
159-
planet_display = 0
160+
planet_display = 0;
160161
}
161162
static load_json_data = function(data){
162163
var names = variable_struct_get_names(data);
@@ -364,4 +365,4 @@ function create_starship_event(){
364365
array_push(star.p_feature[planet], new NewPlanetFeature(P_features.Starship))
365366
scr_event_log("","Ancient Starship discovered on "+string(star.name)+" "+scr_roman(planet)+".", star.name);
366367
}
367-
}
368+
}

scripts/scr_recruit_data/scr_recruit_data.gml

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@ enum eTrials{
1919
#macro ARR_chaplain_training_tiers [0,0.8,0.9, 1,1.5,2,4]
2020
#macro ARR_techmarine_training_tiers [0,1,2,4, 6,10,14]
2121

22-
function find_recruit_success_chance(local_apothecary_points, system, planet) {
23-
var current_owner = system.p_owner[planet];
24-
var player_disposition = system.dispo[planet];
25-
var planet_type = system.p_type[planet];
22+
function find_recruit_success_chance(local_apothecary_points, system, planet, ui=0) {
23+
var p_data = new PlanetData(planet, system);
24+
var _recruit_world = p_data.get_features(P_features.Recruiting_World)[0];
2625

2726
var recruit_type = scr_trial_data(obj_controller.recruit_trial);
2827
var planet_type_recruit_chance = {
@@ -38,26 +37,47 @@ function find_recruit_success_chance(local_apothecary_points, system, planet) {
3837
"Lava": 15,
3938
};
4039
var recruit_chance = 0;
41-
if (local_apothecary_points == 0) {
42-
43-
} else if ((obj_controller.faction_status[current_owner] == "War" || obj_controller.faction_status[current_owner] == "Antagonism") && player_disposition < 0) {
44-
recruit_chance = 2000
45-
} else if ((obj_controller.faction_status[current_owner] != "War" && obj_controller.faction_status[current_owner] != "Antagonism") && player_disposition < 0) {
46-
recruit_chance = 1000
47-
} else if ((obj_controller.faction_status[current_owner] == "War" || obj_controller.faction_status[current_owner] == "Antagonism") && player_disposition <= 50) {
48-
recruit_chance = -(player_disposition*20)+2000
49-
} else {
50-
recruit_chance = -(player_disposition*5)+1000
40+
if (local_apothecary_points > 0) {
41+
if ((obj_controller.faction_status[p_data.current_owner] == "War" || obj_controller.faction_status[p_data.current_owner] == "Antagonism") && p_data.player_disposition < 0) {
42+
recruit_chance = 2000
43+
} else if ((obj_controller.faction_status[p_data.current_owner] != "War" && obj_controller.faction_status[p_data.current_owner] != "Antagonism") && p_data.player_disposition < 0) {
44+
recruit_chance = 1000
45+
} else if ((obj_controller.faction_status[p_data.current_owner] == "War" || obj_controller.faction_status[p_data.current_owner] == "Antagonism") && p_data.player_disposition <= 50) {
46+
recruit_chance = -(p_data.player_disposition*20)+2000
47+
} else {
48+
recruit_chance = -(p_data.player_disposition*5)+1000
49+
}
50+
51+
if (_recruit_world.recruit_type == 1) {
52+
recruit_chance = recruit_chance/2;
53+
if (recruit_chance < 300) {
54+
recruit_chance = 300;
55+
}
56+
if (ui == 0) {
57+
if (scr_has_adv("Ambushers")) {
58+
var droll = irandom(400)
59+
} else {
60+
var droll = irandom(100)
61+
}
62+
63+
if (droll == 0) {
64+
scr_alert(#FF9900, "DIPLOMATIC DISASTER", $"Apothecaries at {system.name} {planet} has been spotted doing suspicious activities!", system.x, system.y)
65+
scr_event_log(#FF9900, $"Apothecaries at {system.name} {planet} has been spotted doing suspicious activities!", system.name)
66+
system.dispo[planet]-=25;
67+
obj_controller.disposition[p_data.current_owner]-=5;
68+
}
69+
}
70+
}
5171
}
5272
var recruit_chance_total = 0;
53-
if (struct_exists(planet_type_recruit_chance, planet_type)) {
54-
recruit_chance_total = planet_type_recruit_chance[$ planet_type] + local_apothecary_points;
73+
if (struct_exists(planet_type_recruit_chance, p_data.planet_type)) {
74+
recruit_chance_total = planet_type_recruit_chance[$ p_data.planet_type] + local_apothecary_points;
5575
if (struct_exists(recruit_type, "recruit_count_modifier")) {
5676
var modded = false;
5777
var count_mod = recruit_type.recruit_count_modifier;
5878
if (struct_exists(count_mod, "planets")) {
59-
if (struct_exists(count_mod.planets, planet_type)) {
60-
recruit_chance_total *= count_mod.planets[$ planet_type];
79+
if (struct_exists(count_mod.planets, p_data.planet_type)) {
80+
recruit_chance_total *= count_mod.planets[$ p_data.planet_type];
6181
modded = true;
6282
}
6383
}
@@ -69,7 +89,7 @@ function find_recruit_success_chance(local_apothecary_points, system, planet) {
6989
if (recruit_chance != 0) {
7090
var _success_chance = recruit_chance_total / recruit_chance;
7191
} else {
72-
_success_chance = 0;
92+
var _success_chance = 0;
7393
}
7494
return _success_chance;
7595
}

0 commit comments

Comments
 (0)