Skip to content

Commit 5d119b4

Browse files
fix: Garrison fixes and minor changes (Adeptus-Dominus#475)
1 parent e8d41b9 commit 5d119b4

File tree

2 files changed

+70
-40
lines changed

2 files changed

+70
-40
lines changed

scripts/scr_PlanetData/scr_PlanetData.gml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@
44
#macro ARR_strength_descriptions ["none", "Minimal", "Sparse", "Moderate", "Numerous", "Very Numerous", "Overwhelming"];
55

66
function PlanetData(planet, system) constructor{
7+
//safeguards // TODO LOW DEBUG_LOGGING // Log when tripped somewhere
8+
//disposition
9+
if (system.dispo[planet] < 0 && system.dispo[planet] > -1000 && system.p_owner[planet] != eFACTION.Player ) { // Personal Rule code be doing some interesting things
10+
system.dispo[planet] = -100; // TODO LOW DISPOSITION_REVAMP // Consider revamping the disposition system
11+
} else if (system.dispo[planet] > 100) {
12+
system.dispo[planet] = 100;
13+
}
14+
//
15+
716
self.planet = planet;
817
self.system = system;
918
player_disposition = system.dispo[planet];

scripts/scr_garrison/scr_garrison.gml

Lines changed: 61 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,29 @@
1-
function disposition_description_chart(dispo){
2-
if (dispo<10){
3-
return "Very Hostile";
4-
} else if (dispo<30){
5-
return "Hostile";
6-
}else if (dispo<50){
7-
return "Uneasy";
8-
}else if (dispo<60){
9-
return "Neutral";
10-
}else if (dispo<70){
11-
return "Friendly";
12-
}else if (dispo<80){
13-
return "Very Friendly";
14-
}else if (dispo<90){
15-
return "Excellent";
16-
}else {
17-
return "Unquestionable";
18-
}
1+
function disposition_description_chart(dispo) {
2+
if (dispo < -100) {
3+
return "DEBUG: Numbers lower than -100 detected, this shouldn't happen!";
4+
} else if (dispo <= 0) {
5+
return "Extremely Hostile";
6+
} else if (dispo < 10) {
7+
return "Very Hostile";
8+
} else if (dispo < 30) {
9+
return "Hostile";
10+
} else if (dispo < 50) {
11+
return "Uneasy";
12+
} else if (dispo < 60) {
13+
return "Neutral";
14+
} else if (dispo < 70) {
15+
return "Friendly";
16+
} else if (dispo < 80) {
17+
return "Very Friendly";
18+
} else if (dispo < 90) {
19+
return "Excellent";
20+
} else if (dispo <= 100) {
21+
return "Unquestionable";
22+
} else {
23+
return "DEBUG: Numbers higher than 100, this shouldn't happen!";
24+
}
1925
}
2026

21-
2227
function GarrisonForce(planet_operatives, turn_end=false, type="garrison") constructor{
2328
garrison_squads=[];
2429
total_garrison = 0;
@@ -147,14 +152,15 @@ function GarrisonForce(planet_operatives, turn_end=false, type="garrison") const
147152
} else {report_string+="The garrison is comprised of a single squad,"}
148153

149154
report_string+= $" with a total man count of {total_garrison}.#"
150-
if (system.dispo[planet]>-1){
151-
var disposition = disposition_description_chart(system.dispo[planet]);
152-
report_string+=$"Our Relationship with the Rulers of the planet is {disposition}#";
153-
} else if(system.dispo[planet]<-1000 && system.p_owner[planet] = eFACTION.Player){
154-
report_string+=$"Rule of the planet is going well";
155-
} else {
156-
report_string+=$"There is no clear chain of command on the planet we suspect the existence of Xenos or Heretic Forces";
157-
}
155+
if (system.p_owner[planet] != eFACTION.Player) {
156+
var disposition = disposition_description_chart(system.dispo[planet]);
157+
report_string += $"Our Relationship with the Rulers of the planet is {disposition}#";
158+
} else if (system.dispo[planet] < -1000 && system.p_owner[planet] == eFACTION.Player) {
159+
report_string += $"Rule of the planet is going well";
160+
} else {
161+
report_string += $"DEBUG: planet owner check failed";
162+
//report_string+=$"There is no clear chain of command on the planet we suspect the existence of Xenos or Heretic Forces"; // TODO LOW GARRISON_XENO // Readd when this actually gets implented
163+
}
158164

159165
return report_string;
160166
}
@@ -180,19 +186,34 @@ function GarrisonForce(planet_operatives, turn_end=false, type="garrison") const
180186
}
181187
} else {
182188
var charisma_test = global.character_tester.standard_test(garrison_leader, "charisma", final_modifier);
183-
if (!charisma_test[0]){
184-
if (garrison_leader.has_trait("honorable")){
185-
dispo_change = "none";
186-
}else {
187-
if (planet_disposition<obj_controller.disposition[star.p_owner[planet]]){
188-
dispo_change = charisma_test[1]/10;
189-
} else {
190-
dispo_change=0;
191-
}
192-
}
193-
} else {
194-
dispo_change=charisma_test[1]/10;
195-
}
189+
if (!charisma_test[0]) {
190+
var _diplomatic_leader = false;
191+
if (is_struct(garrison_leader)) {
192+
_diplomatic_leader = garrison_leader.has_trait("honorable");
193+
} else {
194+
scr_alert("yellow", "DEBUG", $"DEBUG: Garrison Leader on {star.name} {planet} couldn't be found!", 0, 0);
195+
scr_event_log("yellow", $"DEBUG: Garrison Leader on {star.name} {planet} couldn't be found!");
196+
log_error($"DEBUG: Garrison Leader on {star.name} {planet} couldn't be found!");
197+
}
198+
199+
if (_diplomatic_leader) {
200+
dispo_change = "none";
201+
} else {
202+
if (planet_disposition > obj_controller.disposition[star.p_owner[planet]]) {
203+
dispo_change = charisma_test[1] / 10;
204+
if (planet_disposition + dispo_change >= -100) {
205+
dispo_change = planet_disposition + 100;
206+
}
207+
} else {
208+
dispo_change = 0;
209+
}
210+
}
211+
} else {
212+
dispo_change = charisma_test[1] / 10;
213+
if (planet_disposition + dispo_change >= 100) {
214+
dispo_change = abs(planet_disposition - 100);
215+
}
216+
}
196217
}
197218
} else {
198219
dispo_change = "none";

0 commit comments

Comments
 (0)