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
137 changes: 68 additions & 69 deletions objects/obj_controller/Alarm_5.gml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// TODO script description: This is the turn management in general
// TODO refactor

Comment thread
EttyKitty marked this conversation as resolved.
try_and_report_loop("final end turn alarm 5", function() {
try {
var recruit_count = 0;
var random_marine, marine_position;
var eq1 = 1, eq2 = 1, eq3 = 1, t = 0, r = 0;
Expand All @@ -16,48 +16,46 @@ try_and_report_loop("final end turn alarm 5", function() {
var novice_type = "";
var unit;

try_and_report_loop("chaos_spread", function() {
var times = max(1, round(turn / 150));
if ((known[eFACTION.CHAOS] == 2) && (faction_defeated[eFACTION.CHAOS] == 0)) {
times += 1;
}
var xx3, yy3, plani, _star;
xx3 = irandom(room_width) + 1;
yy3 = irandom(room_height) + 1;
_star = instance_nearest(xx3, yy3, obj_star);
plani = floor(random(_star.planets)) + 1;

// ** Chaos influence / corruption **
if ((faction_gender[eFACTION.CHAOS] == 1) && (faction_defeated[eFACTION.CHAOS] == 0) && (turn >= chaos_turn)) {
repeat (times) {
if ((_star.p_type[plani] != "Dead") && (_star.planets > 0) && (turn >= 20)) {
var cathedral = 0;
if (planet_feature_bool(_star.p_feature[plani], eP_FEATURES.SORORITAS_CATHEDRAL) == 1) {
cathedral = choose(0, 1, 1);
}
var times = max(1, round(turn / 150));
if ((known[eFACTION.CHAOS] == 2) && (faction_defeated[eFACTION.CHAOS] == 0)) {
times += 1;
}
var xx3, yy3, plani, _star;
xx3 = irandom(room_width) + 1;
yy3 = irandom(room_height) + 1;
_star = instance_nearest(xx3, yy3, obj_star);
plani = floor(random(_star.planets)) + 1;
Comment thread
EttyKitty marked this conversation as resolved.

// ** Chaos influence / corruption **
if ((faction_gender[eFACTION.CHAOS] == 1) && (faction_defeated[eFACTION.CHAOS] == 0) && (turn >= chaos_turn)) {
repeat (times) {
if ((_star.p_type[plani] != "Dead") && (_star.planets > 0) && (turn >= 20)) {
var cathedral = 0;
Comment thread
EttyKitty marked this conversation as resolved.
if (planet_feature_bool(_star.p_feature[plani], eP_FEATURES.SORORITAS_CATHEDRAL) == 1) {
cathedral = choose(0, 1, 1);
}

if (cathedral == 0) {
if ((_star.p_heresy[plani] >= 0) && (_star.p_heresy[plani] < 10)) {
_star.p_heresy[plani] += choose(0, 0, 0, 0, 0, 0, 0, 0, 5);
} else if ((_star.p_heresy[plani] >= 10) && (_star.p_heresy[plani] < 20)) {
_star.p_heresy[plani] += choose(-2, -2, -2, 5, 10, 15);
} else if ((_star.p_heresy[plani] >= 20) && (_star.p_heresy[plani] < 40)) {
_star.p_heresy[plani] += choose(-2, -1, 0, 0, 0, 0, 0, 0, 5, 10);
} else if ((_star.p_heresy[plani] >= 40) && (_star.p_heresy[plani] < 60)) {
_star.p_heresy[plani] += choose(-2, -1, 0, 0, 0, 0, 0, 0, 5, 10, 15);
} else if ((_star.p_heresy[plani] >= 60) && (_star.p_heresy[plani] < 100)) {
_star.p_heresy[plani] += choose(-1, 0, 0, 0, 0, 5, 10, 15);
}
}
if (_star.p_heresy[plani] < 0) {
_star.p_heresy[plani] = 0;
if (cathedral == 0) {
if ((_star.p_heresy[plani] >= 0) && (_star.p_heresy[plani] < 10)) {
_star.p_heresy[plani] += choose(0, 0, 0, 0, 0, 0, 0, 0, 5);
} else if ((_star.p_heresy[plani] >= 10) && (_star.p_heresy[plani] < 20)) {
_star.p_heresy[plani] += choose(-2, -2, -2, 5, 10, 15);
} else if ((_star.p_heresy[plani] >= 20) && (_star.p_heresy[plani] < 40)) {
_star.p_heresy[plani] += choose(-2, -1, 0, 0, 0, 0, 0, 0, 5, 10);
} else if ((_star.p_heresy[plani] >= 40) && (_star.p_heresy[plani] < 60)) {
_star.p_heresy[plani] += choose(-2, -1, 0, 0, 0, 0, 0, 0, 5, 10, 15);
} else if ((_star.p_heresy[plani] >= 60) && (_star.p_heresy[plani] < 100)) {
_star.p_heresy[plani] += choose(-1, 0, 0, 0, 0, 5, 10, 15);
}
}
if (_star.p_heresy[plani] < 0) {
_star.p_heresy[plani] = 0;
}
}
}
}

instance_activate_object(obj_star);
});
instance_activate_object(obj_star);

// ** Build new Imperial Ships **
build_planet_defence_fleets();
Expand Down Expand Up @@ -129,11 +127,11 @@ try_and_report_loop("final end turn alarm 5", function() {
recruits = total_recruits;

/* TODO implement Lamenters get Black Rage and story
if (turn=240) and (global.chapter_name="Lamenters"){
obj_ini.strin2+="Black Rage";
scr_popup("Geneseed Mutation","Your Chapter has begun to have visions and nightmares of Sanguinius' fall. The less mentally disciplined of your battle-brothers no longer are able to sleep soundly, waking from sleep in a screaming, frothing rage. It appears the Black Rage has returned.","black_rage","");
}
*/
if (turn=240) and (global.chapter_name="Lamenters"){
obj_ini.strin2+="Black Rage";
scr_popup("Geneseed Mutation","Your Chapter has begun to have visions and nightmares of Sanguinius' fall. The less mentally disciplined of your battle-brothers no longer are able to sleep soundly, waking from sleep in a screaming, frothing rage. It appears the Black Rage has returned.","black_rage","");
}
*/
// ** Battlefield Loot **
if (scr_has_adv("Tech-Scavengers")) {
var lroll1, lroll2, loot = "";
Expand Down Expand Up @@ -334,45 +332,44 @@ if (turn=240) and (global.chapter_name="Lamenters"){
}
}

try_and_report_loop("Secret Chaos Warlord spawn", function() {
if ((turn == 5) && (faction_gender[eFACTION.CHAOS] == 1)) {
// show_message("Turn 100");
if ((turn == 5) && (faction_gender[eFACTION.CHAOS] == 1)) {
// show_message("Turn 100");

var _star_found = false;
var _choice_star = noone;
var _stars = scr_get_stars(true);
for (var i = 0; i < array_length(_stars); i++) {
if (is_dead_star(_stars[i])) {
continue;
}
with (_stars[i]) {
if (owner == eFACTION.IMPERIUM && planets) {
if (scr_orbiting_fleet(eFACTION.IMPERIUM) != "none") {
_star_found = true;
_choice_star = self.id;
break;
}
var _star_found = false;
var _choice_star = noone;
var _stars = scr_get_stars(true);
for (var i = 0; i < array_length(_stars); i++) {
if (is_dead_star(_stars[i])) {
continue;
}
with (_stars[i]) {
if (owner == eFACTION.IMPERIUM && planets) {
if (scr_orbiting_fleet(eFACTION.IMPERIUM) != "none") {
_star_found = true;
_choice_star = self.id;
break;
}
}
if (_star_found) {
break;
}
}
if (_star_found) {
var _planet = array_random_element(planets_without_type("Dead", _choice_star));
break;
}
}
if (_star_found) {
var _candidate_planets = planets_without_type("Dead", _choice_star);
if (array_length(_candidate_planets) > 0) {
var _planet = array_random_element(_candidate_planets);
_choice_star.warlord[_planet] = 1;
array_push(_choice_star.p_feature[_planet], new NewPlanetFeature(eP_FEATURES.WARLORD10));

var _heresy_inc = _choice_star.p_type[_planet] == "Hive" ? 25 : 10;

_choice_star.p_heresy[_planet] += _heresy_inc;

if (_choice_star.p_heresy[_planet] < 50) {
_choice_star.p_heresy_secret[_planet] = 10;
}
}
Comment thread
EttyKitty marked this conversation as resolved.
}
});
}

// * Blood debt end *
if ((blood_debt == 1) && (penitent == 1)) {
penitent_turn += 1;
Expand Down Expand Up @@ -431,7 +428,7 @@ if (turn=240) and (global.chapter_name="Lamenters"){
}
disposition[eFACTION.IMPERIUM] += 20;
disposition[eFACTION.MECHANICUS] += 15;
disposition[eFACTION.IMPERIUM] += 20;
disposition[eFACTION.INQUISITION] += 20;
disposition[eFACTION.ECCLESIARCHY] += 20;
var o = 0;
if (scr_has_adv("Reverent Guardians")) {
Expand Down Expand Up @@ -721,7 +718,9 @@ if (turn=240) and (global.chapter_name="Lamenters"){
set_new_player_fleet_course(complex_route);
}
}
});
} catch (_exception) {
handle_exception(_exception);
}

if (helpful_places != false) {
helpful_places = new HelpfulPlaces();
Expand Down
Loading