Skip to content

Commit 4567adc

Browse files
feat: Make Bombard purging reduce corruption (Adeptus-Dominus#473)
1 parent 5fef24f commit 4567adc

File tree

1 file changed

+29
-18
lines changed

1 file changed

+29
-18
lines changed

scripts/scr_bomb_world/scr_bomb_world.gml

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ function scr_bomb_world(star_system, planet_number, bombard_target_faction, bomb
2323
pop_after=max(0,pop_before-kill);
2424
if (pop_after<=0) and (pop_before>0) then heres_after=0;
2525

26-
// We should also make the regular bombardment lower heresy, I'm gonna copy some bits of code from scr_purge_world
27-
// heres_before=max(star.p_heresy[planet]+star.p_heresy_secret[planet],star.p_influence[planet][eFACTION.Tau]);
28-
// sci1=0;sci2=0;
29-
// if (pop_before>0) then sci1=(pop_after/pop_before)*100;
30-
// if (sci1>0) then sci2=min((sci1*2),action_score*2);
31-
// heres_after=heres_before-sci2;
32-
26+
// Code bits copied from scr_purge_world
27+
if (star_system.p_population[planet_number] > 0) {
28+
heres_before = max(star_system.p_heresy[planet_number] + star_system.p_heresy_secret[planet_number], star_system.p_influence[planet_number][eFACTION.Tau]);
29+
sci1 = 0;
30+
sci1 = (pop_after / pop_before) * irandom_range(1, 3); // Make bombard corruption reduction random to encourage other forms of purging // TODO MEDIUM BOMBARD_CORRUPTION // Tweak numbers
31+
heres_after = heres_before - sci1;
32+
}
3333

3434
if (star_system.p_type[planet_number]!="Space Hulk"){
3535
var bombard_protection=1;
@@ -231,21 +231,32 @@ function scr_bomb_world(star_system, planet_number, bombard_target_faction, bomb
231231
if (kill>0) then kill=min(star_system.p_population[planet_number],kill);
232232

233233
txt3=""; // Life is the Emperor's currency. Spend it well
234-
if (pop_before > 0 && star_system.p_type[planet_number] != "Daemon") {
235-
var _displayed_population = star_system.p_large[planet_number] == 1 ? $"{pop_before} billion" : scr_display_number(floor(pop_before));
236-
var _displayed_killed = star_system.p_large[planet_number] == 1 ? $"{kill} billion" : scr_display_number(floor(kill));
237-
txt3 += $"##The world had {_displayed_population} Imperium subjects. {_displayed_killed} died over the duration of the bombardment.";
238-
}
239-
240-
241-
// DO EET
242-
if (pop_before>0){
243-
star_system.p_population[planet_number]=pop_before-kill;
244-
}
234+
if (pop_before > 0 && star_system.p_type[planet_number] != "Daemon") {
235+
var _displayed_population = star_system.p_large[planet_number] == 1 ? $"{pop_before} billion" : scr_display_number(floor(pop_before));
236+
var _displayed_killed = star_system.p_large[planet_number] == 1 ? $"{kill} billion" : scr_display_number(floor(kill));
237+
if (pop_after == 0) {
238+
heres_after = 0;
239+
}
240+
txt3 += $"##The world had {_displayed_population} Imperium subjects. {_displayed_killed} died over the duration of the bombardment,##Heresy has fallen down to {max(0, heres_after)}%.";
241+
}
245242

243+
// DO EET
244+
if (pop_before > 0) {
245+
star_system.p_population[planet_number] = pop_before - kill;
246+
star_system.p_heresy[planet_number] -= sci1;
247+
star_system.p_influence[planet_number][eFACTION.Tau] -= sci1; // TODO LOW PURGE_INFLUENCE // Make this affect all influences
248+
if (star_system.p_heresy[planet_number] < 0) {
249+
star_system.p_heresy[planet_number] = 0;
250+
}
251+
if (star_system.p_influence[planet_number][eFACTION.Tau] < 0) {
252+
star_system.p_influence[planet_number][eFACTION.Tau] = 0;
253+
}
254+
}
255+
246256
var pip=instance_create(0,0,obj_popup);
247257
pip.title="Bombard Results";
248258
pip.text=txt1+txt2+txt3;
259+
//pip.text=txt1+txt2+txt3+" "+string(sci1)+" "+string(heres_before)+" "+string(heres_after); // TODO LOW DEBUG_INFLUENCE // Put in debug code path and make it clearer
249260

250261

251262
if (pop_after==0 && pop_before>0){

0 commit comments

Comments
 (0)