From a0b032da08d8fb620f092d5e7a2a5f5e43742a10 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Tue, 28 Jan 2025 18:26:03 +0000 Subject: [PATCH 1/4] allow loyalty to increase overtime --- objects/obj_controller/Alarm_5.gml | 16 +++++- scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml | 33 ++---------- scripts/scr_event_log/scr_event_log.gml | 12 ++++- .../scr_fleet_functions.gml | 4 +- scripts/scr_loyalty/scr_loyalty.gml | 52 ++++++++++--------- .../scr_mission_functions.gml | 29 +++++++++++ 6 files changed, 90 insertions(+), 56 deletions(-) diff --git a/objects/obj_controller/Alarm_5.gml b/objects/obj_controller/Alarm_5.gml index 943666936a..8456fdb220 100644 --- a/objects/obj_controller/Alarm_5.gml +++ b/objects/obj_controller/Alarm_5.gml @@ -1269,5 +1269,19 @@ with (obj_p_fleet){ set_new_player_fleet_course(complex_route); } } - +for (var i=0;i0){ + obj_controller.loyal_time[i]--; + if (is_array(obj_controller.loyal_num[i])){ + var loyal_nums = obj_controller.loyal_num[i]; + if (loyal_nums[1]++>=loyal_nums[0]){ + obj_controller.loyalty+=loyal_nums[2]; + } + obj_controller.loyal_num[i]=[loyal_nums[0],0, loyal_nums[2]]; + } + if (obj_controller.loyal_time[i] == 0){ + obj_controller.loyal_num = 0; + } + } +} }); \ No newline at end of file diff --git a/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml b/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml index a0fc693213..7c5c882ec7 100644 --- a/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml +++ b/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml @@ -99,6 +99,7 @@ function scr_enemy_ai_d() { if (result="imperial") then scr_event_log("",alert_text); remove_planet_problem(i, "succession"); } + if (has_problem_planet_and_time(i, "recon", 0)>-1){ var alert_text="Inquisition Mission Failed: Investigate "; alert_text+=string(name)+" "+scr_roman(i)+"."; @@ -108,34 +109,10 @@ function scr_enemy_ai_d() { remove_planet_problem(i, "recon"); } - if (has_problem_planet_and_time(i, "great_crusade", 0)>-1){ - var flet,cont,dir;cont=0; - flet=instance_nearest(x,y,obj_p_fleet); - - if (flet.action="") then cont=1; - if (cont=1) and (point_distance(x,y,flet.x,flet.y)<40) then cont=2; - - if (cont=2){ - flet.action="crusade1"; - dir=point_direction(room_width/2,room_height/2,x,y); - flet.action_x=x+lengthdir_x(2000,dir); - flet.action_y=y+lengthdir_y(2000,dir); - // flet.action_eta=floor(random(8))+12; - flet.action_eta=floor(random(8))+2; - flet.alarm[4]=1; - scr_alert("green","crusade","Fleet embarks upon Crusade.",x,y); - scr_event_log("","Fleet embarks upon Crusade."); - } - if (cont=1) or (cont=0){ - // hit loyalty here - obj_controller.disposition[2]-=5; - obj_controller.disposition[4]-=10; - scr_alert("red","crusade","No ships designated for Crusade.",x,y); - scr_loyalty("Refusing to Crusade","+"); - scr_event_log("red","No ships designated for Crusade."); - if (obj_controller.penitent=1) then obj_controller.penitent_current=0; - } - remove_planet_problem(i, "great_crusade"); + var _great_crusade = has_problem_planet_and_time(i, "great_crusade", 0); + + if (_great_crusade>-1){ + init_crusade_mission(i, _great_crusade); } var raider_planet_slot = has_problem_planet_with_time(i,"mech_raider"); diff --git a/scripts/scr_event_log/scr_event_log.gml b/scripts/scr_event_log/scr_event_log.gml index 925b72e425..96a5713c80 100644 --- a/scripts/scr_event_log/scr_event_log.gml +++ b/scripts/scr_event_log/scr_event_log.gml @@ -1,7 +1,7 @@ function scr_event_log(event_colour, event_text, target = "none") { if (instance_exists(obj_event_log)){ - var yf;yf=""; + var yf=""; if (obj_controller.year_fraction<10) then yf="00"+string(obj_controller.year_fraction); if (obj_controller.year_fraction>=10) and (obj_controller.year_fraction<100) then yf="0"+string(obj_controller.year_fraction); if (obj_controller.year_fraction>=100) then yf=string(obj_controller.year_fraction); @@ -17,3 +17,13 @@ function scr_event_log(event_colour, event_text, target = "none") { } } + +function alert_and_event(event_colour, event_text, target=-1){ + if (instance_exists(target)){ + scr_event_log(event_colour, event_text, target.name); + scr_alert(event_colour, event_text, target.x, target.y); + } else { + scr_event_log(event_colour, event_text); + scr_alert(event_colour, event_text); + } +} diff --git a/scripts/scr_fleet_functions/scr_fleet_functions.gml b/scripts/scr_fleet_functions/scr_fleet_functions.gml index 3e522d0130..df42ee4dbf 100644 --- a/scripts/scr_fleet_functions/scr_fleet_functions.gml +++ b/scripts/scr_fleet_functions/scr_fleet_functions.gml @@ -170,8 +170,8 @@ function set_fleet_movement(fastest_route = true){ sys=instance_nearest(action_x,action_y,obj_star); mine=instance_nearest(x,y,obj_star); - - var eta = calculate_fleet_eta(x,y,action_x,action_y,action_spd,instance_exists(sys),is_orbiting(),warp_able); + var _travel_to_star = point_distance(sys.x, sys.y, action_x,action_y < 20); + var eta = (x,y,action_x,action_y,action_spd,is_orbiting(),_travel_to_star,warp_able); action_eta = eta; if (action_eta<=0) or (owner != eFACTION.Inquisition){ action_eta=eta; diff --git a/scripts/scr_loyalty/scr_loyalty.gml b/scripts/scr_loyalty/scr_loyalty.gml index c16c6d34b6..a7ef7d9c82 100644 --- a/scripts/scr_loyalty/scr_loyalty.gml +++ b/scripts/scr_loyalty/scr_loyalty.gml @@ -1,57 +1,57 @@ -function scr_loyalty(argument0, argument1) { - // argument0 = name - // argument1 = todo +function scr_loyalty(loaylty_effect, loyalty_value) { + // loaylty_effect = name + // loyalty_value = todo // This adds the crime to the chapter history - if (argument1="+"){ + if (loyalty_value="+"){ var i, noplus;i=0;noplus=0; repeat(30){ i+=1;noplus=0; - if (obj_controller.loyal[i]=argument0){// Increases detection chance by a variable amount + if (obj_controller.loyal[i]=loaylty_effect){// Increases detection chance by a variable amount var amount;amount=0; if (obj_controller.loyal_num[i]<1) then amount=0.03; - if (argument0="Xeno Associate"){ + if (loaylty_effect="Xeno Associate"){ if (obj_controller.loyal_num[i]=0) then amount=0.09; if (obj_controller.loyal_num[i]!=0) then amount=0; } - if (argument0="Lack of Apothecary") or (argument0="Upset Machine Spirits") or (argument0="Undevout"){ + if (loaylty_effect="Lack of Apothecary") or (loaylty_effect="Upset Machine Spirits") or (loaylty_effect="Undevout"){ if (obj_controller.loyal_num[i]=0) then amount=0.075; if (obj_controller.loyal_num[i]!=0) then amount=0; } - if (argument0="Xeno Trade") then amount=0.05; - if (argument0="Irreverance for His Servants") then amount=0.005; + if (loaylty_effect="Xeno Trade") then amount=0.05; + if (loaylty_effect="Irreverance for His Servants") then amount=0.005; - // if (argument0="Heretic Contact") then amount=0.01; - if (argument0="Heretic Contact") then amount=0.099; + // if (loaylty_effect="Heretic Contact") then amount=0.01; + if (loaylty_effect="Heretic Contact") then amount=0.099; - if (argument0="Non-Codex Size"){ + if (loaylty_effect="Non-Codex Size"){ if (obj_controller.loyal_num[i]=0) then amount=0.06; if (obj_controller.loyal_num[i]!=0) then amount=0; } - if (argument0="Mutant Gene-Seed"){ + if (loaylty_effect="Mutant Gene-Seed"){ if (obj_controller.loyal_num[i]=0) then amount=0.01; if (obj_controller.loyal_num[i]!=0) then amount=0; } - if (argument0="Heretical Homeworld"){ + if (loaylty_effect="Heretical Homeworld"){ if (obj_controller.loyal_num[i]=0) then amount=0.07; if (obj_controller.loyal_num[i]!=0) then amount=0; } - if (argument0="Inquisitor Killer"){ + if (loaylty_effect="Inquisitor Killer"){ if (obj_controller.loyal_num[i]=0) then amount=0.005; if (obj_controller.loyal_num[i]!=0) then amount=0; } - if (argument0="Avoiding Inspections"){ + if (loaylty_effect="Avoiding Inspections"){ obj_controller.loyalty-=5; obj_controller.loyalty_hidden-=5; obj_controller.loyal_num[i]+=5; @@ -59,7 +59,7 @@ function scr_loyalty(argument0, argument1) { amount=0;noplus=1;exit; } - if (argument0="Lost Standard"){ + if (loaylty_effect="Lost Standard"){ obj_controller.loyalty-=2; obj_controller.loyalty_hidden-=2; obj_controller.loyal_num[i]+=5; @@ -69,23 +69,27 @@ function scr_loyalty(argument0, argument1) { exit; } - if (argument0="Refusing to Crusade"){ + if (loaylty_effect="Refusing to Crusade"){ obj_controller.loyalty-=20; obj_controller.loyalty_hidden-=20; - obj_controller.loyal_num[i]+=20; - obj_controller.loyal_time[i]=9999; - amount=0;noplus=1;exit; + obj_controller.loyal_num[i]=[20,0, 1]; + obj_controller.loyal_time[i]=400; + amount=0; + noplus=1; + exit; } - if (argument0="Crossing the Inquisition"){ + if (loaylty_effect="Crossing the Inquisition"){ obj_controller.loyalty-=40; obj_controller.loyalty_hidden-=40; obj_controller.loyal_num[i]+=40; obj_controller.loyal_time[i]=9999; - amount=0;noplus=1;exit; + amount=0; + noplus=1; + exit; } - if (argument0="Use of Sorcery"){ + if (loaylty_effect="Use of Sorcery"){ if (string_count("|SC|",obj_controller.useful_info)=0){ obj_controller.loyalty-=30; obj_controller.loyalty_hidden-=30; diff --git a/scripts/scr_mission_functions/scr_mission_functions.gml b/scripts/scr_mission_functions/scr_mission_functions.gml index 5a6eb473d7..54c76d3657 100644 --- a/scripts/scr_mission_functions/scr_mission_functions.gml +++ b/scripts/scr_mission_functions/scr_mission_functions.gml @@ -84,6 +84,35 @@ function scr_new_governor_mission(planet){ } } +function init_crusade_mission(targ_planet, problem_index){ + var cont,dir;cont=0; + var flet=instance_nearest(x,y,obj_p_fleet); + + if (flet.action="") then cont=1; + if (cont=1) and (point_distance(x,y,flet.x,flet.y)<40) then cont=2; + + if (cont=2){ + flet.action=""; + dir=point_direction(room_width/2,room_height/2,x,y); + flet.action_x=x+lengthdir_x(2000,dir); + flet.action_y=y+lengthdir_y(2000,dir); + // flet.action_eta=floor(random(8))+12; + with (flet){ + set_fleet_movement(false); + action="crusade1"; + } + alert_and_event("green","Fleet embarks upon Crusade.", self.id); + } + if (cont=1) or (cont=0){ + // hit loyalty here + obj_controller.disposition[2]-=5; + obj_controller.disposition[4]-=10; + alert_and_event("red","No ships designated for Crusade.", self.id); + scr_loyalty("Refusing to Crusade","+"); + if (obj_controller.penitent=1) then obj_controller.penitent_current=0; + } + remove_planet_problem(i, "great_crusade"); +} function init_garrison_mission(planet, star, mission_slot){ var problems_data = star.p_problem_other_data[planet] From 83b9fd4902a08868fbbd6e6ad930c8c12d04dd99 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Wed, 29 Jan 2025 01:15:41 +0000 Subject: [PATCH 2/4] rework loyalty --- objects/obj_controller/Alarm_5.gml | 4 +- objects/obj_p_fleet/Alarm_1.gml | 7 +-- .../scr_fleet_functions.gml | 8 +-- scripts/scr_loyalty/scr_loyalty.gml | 51 ++++++++++++++++--- .../scr_mission_functions.gml | 2 +- .../scr_player_fleet_functions.gml | 13 +++++ scripts/scr_ui_popup/scr_ui_popup.gml | 22 +------- 7 files changed, 71 insertions(+), 36 deletions(-) diff --git a/objects/obj_controller/Alarm_5.gml b/objects/obj_controller/Alarm_5.gml index 8456fdb220..14a34e7a4e 100644 --- a/objects/obj_controller/Alarm_5.gml +++ b/objects/obj_controller/Alarm_5.gml @@ -1276,8 +1276,10 @@ for (var i=0;i=loyal_nums[0]){ obj_controller.loyalty+=loyal_nums[2]; + obj_controller.loyal_num[i]=[loyal_nums[0],0, loyal_nums[2]]; + } else { + obj_controller.loyal_num[i]=loyal_nums; } - obj_controller.loyal_num[i]=[loyal_nums[0],0, loyal_nums[2]]; } if (obj_controller.loyal_time[i] == 0){ obj_controller.loyal_num = 0; diff --git a/objects/obj_p_fleet/Alarm_1.gml b/objects/obj_p_fleet/Alarm_1.gml index a3e972f9d4..37314438ab 100644 --- a/objects/obj_p_fleet/Alarm_1.gml +++ b/objects/obj_p_fleet/Alarm_1.gml @@ -24,7 +24,6 @@ try_and_report_loop("player alarm 1",function(){ else if (action="move") or (action="crusade1") or (action="crusade2") or (action="crusade3"){ - var i; set_fleet_location("Warp"); @@ -64,8 +63,10 @@ try_and_report_loop("player alarm 1",function(){ var ret=instance_nearest(x,y,obj_star); action_x=ret.x; action_y=ret.y; - action="crusade3";action_eta=floor(point_distance(x,y,ret.x,ret.y)/128)+1; - alarm[4]=1;instance_activate_object(obj_star); + action="crusade3"; + action_eta=floor(point_distance(x,y,ret.x,ret.y)/128)+1; + alarm[4]=1; + instance_activate_object(obj_star); } if (action_eta=0) and (action="crusade3"){ // Popup here diff --git a/scripts/scr_fleet_functions/scr_fleet_functions.gml b/scripts/scr_fleet_functions/scr_fleet_functions.gml index df42ee4dbf..3f1b7f2a34 100644 --- a/scripts/scr_fleet_functions/scr_fleet_functions.gml +++ b/scripts/scr_fleet_functions/scr_fleet_functions.gml @@ -143,6 +143,7 @@ function set_fleet_movement(fastest_route = true){ action = ""; + static minimum_eta = 1; if (action==""){ turns_static = 0; var sys, mine, fleet; @@ -171,14 +172,16 @@ function set_fleet_movement(fastest_route = true){ mine=instance_nearest(x,y,obj_star); var _travel_to_star = point_distance(sys.x, sys.y, action_x,action_y < 20); - var eta = (x,y,action_x,action_y,action_spd,is_orbiting(),_travel_to_star,warp_able); + var eta = calculate_fleet_eta(x,y,action_x,action_y,action_spd,is_orbiting(),_travel_to_star,warp_able); action_eta = eta; if (action_eta<=0) or (owner != eFACTION.Inquisition){ action_eta=eta; if (owner = eFACTION.Inquisition) and (action_eta<2) and (string_count("_her",trade_goods)=0) then action_eta=2; } - if (owner != eFACTION.Eldar && mine.storm) then action_eta+=10000; + if (owner != eFACTION.Eldar && mine.storm){ + action_eta+=10000; + } // action_x=sys.x; // action_y=sys.y; @@ -186,7 +189,6 @@ function set_fleet_movement(fastest_route = true){ action="move"; if (minimum_eta>action_eta) and (minimum_eta>0) then action_eta=minimum_eta; - minimum_eta=0; } } } diff --git a/scripts/scr_loyalty/scr_loyalty.gml b/scripts/scr_loyalty/scr_loyalty.gml index a7ef7d9c82..d8cf25bfdf 100644 --- a/scripts/scr_loyalty/scr_loyalty.gml +++ b/scripts/scr_loyalty/scr_loyalty.gml @@ -1,3 +1,31 @@ +global.loyalty_effects = { + "Xeno Associate" : { + + } +} + + +function loyalty_tooltip_string(){ + var tx=0,ty=0,tool1="",tool2="",plu=""; + + var lines=0; + for(var d=0; d<=20; d++){ + if (is_array(loyal_num[d])){ + + } + else if (loyal_num[d]>1) and (lines=0){ + tool1+=string(loyal[d])+": -"+string(loyal_num[d])+"#"; + tool2+=string(loyal[d])+": #"; + lines++; + } + } + + if (tool1="") then tool1="Loyalty"; + + if (tool1!=""){ + tooltip_draw(tool1); + } +} function scr_loyalty(loaylty_effect, loyalty_value) { // loaylty_effect = name // loyalty_value = todo @@ -5,13 +33,13 @@ function scr_loyalty(loaylty_effect, loyalty_value) { // This adds the crime to the chapter history if (loyalty_value="+"){ - var i, noplus;i=0;noplus=0; + var i=0, noplus=0; - repeat(30){ - i+=1;noplus=0; + for (var i=0;i=2) and (obj_controller.penitent=0){repeat(2){obj_controller.useful_info+="|SC|";}scr_audience(4,"loyalty_zero",0,"",0,0);} - if (one>=2) and (obj_controller.penitent=1){repeat(2){obj_controller.useful_info+="|SC|";}obj_controller.alarm[8]=1;} + if (one>=2) and (obj_controller.penitent=0){ + repeat(2){ + obj_controller.useful_info+="|SC|"; + } + scr_audience(4,"loyalty_zero",0,"",0,0); + } + if (one>=2) and (obj_controller.penitent=1){ + repeat(2){ + obj_controller.useful_info+="|SC|"; + } + obj_controller.alarm[8]=1;} exit;exit; } diff --git a/scripts/scr_mission_functions/scr_mission_functions.gml b/scripts/scr_mission_functions/scr_mission_functions.gml index 54c76d3657..fb9800bc65 100644 --- a/scripts/scr_mission_functions/scr_mission_functions.gml +++ b/scripts/scr_mission_functions/scr_mission_functions.gml @@ -111,7 +111,7 @@ function init_crusade_mission(targ_planet, problem_index){ scr_loyalty("Refusing to Crusade","+"); if (obj_controller.penitent=1) then obj_controller.penitent_current=0; } - remove_planet_problem(i, "great_crusade"); + remove_planet_problem(targ_planet, "great_crusade"); } function init_garrison_mission(planet, star, mission_slot){ diff --git a/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml b/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml index 9776792e36..c0f0c2e721 100644 --- a/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml +++ b/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml @@ -498,6 +498,19 @@ function set_fleet_location(location){ obj_ini.ship_location[temp] = location; } } + for (var co=0;co1) and (lines=0){ - tool1+=string(loyal[d])+": -"+string(loyal_num[d])+"#"; - tool2+=string(loyal[d])+": #"; - lines++; - } - if (loyal_num[d]>1) and (lines>0){ - tool1+=string(loyal[d])+": -"+string(loyal_num[d])+"#"; - tool2+=string(loyal[d])+": #"; - lines++; - } - } - - if (tool1="") then tool1="Loyalty"; - - if (tool1!=""){ - tooltip_draw(tool1); - } + loyalty_tooltip_string(); } // Stored Gene-Seed tooltip From 48840741c4e839da38016aed6508c19a5e7df499 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Thu, 30 Jan 2025 02:24:37 +0000 Subject: [PATCH 3/4] flesh out loyalty --- scripts/scr_loyalty/scr_loyalty.gml | 74 ++++++++++++++++++++++++++--- 1 file changed, 67 insertions(+), 7 deletions(-) diff --git a/scripts/scr_loyalty/scr_loyalty.gml b/scripts/scr_loyalty/scr_loyalty.gml index d8cf25bfdf..b519958366 100644 --- a/scripts/scr_loyalty/scr_loyalty.gml +++ b/scripts/scr_loyalty/scr_loyalty.gml @@ -1,10 +1,63 @@ global.loyalty_effects = { "Xeno Associate" : { + hit : 0.09, + }, + "Lack of Apothecary" :{ + hit : 0.075, + }, + "Upset Machine Spirits":{ + hit : 0.075, + }, + "Undevout":{ + hit : 0.075, + }, + "Xeno Trade":{ + hit : 0.05, + }, + "Non-Codex Size":{ + hit : 0.06, + }, + "Irreverance for His Servants":{ + hit : 0.005, + }, + "Mutant Gene-Seed":{ + hit : 0.01, + }, + "Heretical Homeworld":{ + hit : 0.07, + }, + "Avoiding Inspections":{ + hit : 5, + time : 200, + incremental : true, + }, + "Lost Standard" : { + hit : 5, + time : 99999, + incremental : false, + }, + "Refusing to Crusade":{ + hit : 20, + time : 600, + incremental : false, + }, + "Crossing the Inquisition":{ + hit : 40, + time : 99999, + }, + "of Sorcery":{ + hit : 40, + time : 99999, + }, +} +function loyalty_penalty(loyalty_reason){ + var _reasons = global.loyalty_effects; + if (struct_exists(loyalty_effects, loyalty_reason)){ + var _penalty_data = loyalty_effects[$ loyalty_reason]; + if (struct_exists()) } } - - function loyalty_tooltip_string(){ var tx=0,ty=0,tool1="",tool2="",plu=""; @@ -124,15 +177,20 @@ function scr_loyalty(loaylty_effect, loyalty_value) { obj_controller.loyal_num[i]+=30; obj_controller.loyal_time[i]=9999; } - amount=0;noplus=1;var one;one=0; + amount=0;noplus=1;var one=0; obj_controller.useful_info+="|SC|"; if (obj_controller.disposition[4]>=50) and (one=0) and (string_count("|SC|",obj_controller.useful_info)=1){obj_controller.disposition[4]=20;one=1;} if (obj_controller.disposition[4]<50) and (string_count("|SC|",obj_controller.useful_info)=1) and (obj_controller.disposition[4]>10) and (one=0){obj_controller.disposition[4]=0;one=2;} - if (string_count("|SC|",obj_controller.useful_info)>1){obj_controller.disposition[4]=0;one=2;} + if (string_count("|SC|",obj_controller.useful_info)>1){ + obj_controller.disposition[4]=0; + one=2; + } if (obj_controller.loyalty<=0) and (one<2) then one=2; - if (one=1) then with(obj_controller){scr_audience(4,"sorcery1",0,"",0,0);} + if (one=1) then with(obj_controller){ + scr_audience(4,"sorcery1",0,"",0,0); + } if (one>=2) and (obj_controller.penitent=0){ repeat(2){ obj_controller.useful_info+="|SC|"; @@ -143,9 +201,11 @@ function scr_loyalty(loaylty_effect, loyalty_value) { repeat(2){ obj_controller.useful_info+="|SC|"; } - obj_controller.alarm[8]=1;} + obj_controller.alarm[8]=1; + } - exit;exit; + exit; + exit; } if (noplus=0) then obj_controller.loyal_num[i]+=amount; From d07068861dd880dc4c70606c473fdbc0fb150a16 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Thu, 30 Jan 2025 22:02:09 +0000 Subject: [PATCH 4/4] design degrade system --- objects/obj_controller/Alarm_5.gml | 20 +++-------------- scripts/scr_loyalty/scr_loyalty.gml | 35 +++++++++++++++++++++++++++-- 2 files changed, 36 insertions(+), 19 deletions(-) diff --git a/objects/obj_controller/Alarm_5.gml b/objects/obj_controller/Alarm_5.gml index 14a34e7a4e..71cac4630b 100644 --- a/objects/obj_controller/Alarm_5.gml +++ b/objects/obj_controller/Alarm_5.gml @@ -1269,21 +1269,7 @@ with (obj_p_fleet){ set_new_player_fleet_course(complex_route); } } -for (var i=0;i0){ - obj_controller.loyal_time[i]--; - if (is_array(obj_controller.loyal_num[i])){ - var loyal_nums = obj_controller.loyal_num[i]; - if (loyal_nums[1]++>=loyal_nums[0]){ - obj_controller.loyalty+=loyal_nums[2]; - obj_controller.loyal_num[i]=[loyal_nums[0],0, loyal_nums[2]]; - } else { - obj_controller.loyal_num[i]=loyal_nums; - } - } - if (obj_controller.loyal_time[i] == 0){ - obj_controller.loyal_num = 0; - } - } -} + +loyaty_countdowns(); + }); \ No newline at end of file diff --git a/scripts/scr_loyalty/scr_loyalty.gml b/scripts/scr_loyalty/scr_loyalty.gml index b519958366..64c5e048f8 100644 --- a/scripts/scr_loyalty/scr_loyalty.gml +++ b/scripts/scr_loyalty/scr_loyalty.gml @@ -45,7 +45,7 @@ global.loyalty_effects = { hit : 40, time : 99999, }, - "of Sorcery":{ + "Use of Sorcery":{ hit : 40, time : 99999, }, @@ -53,9 +53,40 @@ global.loyalty_effects = { function loyalty_penalty(loyalty_reason){ var _reasons = global.loyalty_effects; + var _existing = array_get_index(obj_controller.loyal); if (struct_exists(loyalty_effects, loyalty_reason)){ var _penalty_data = loyalty_effects[$ loyalty_reason]; - if (struct_exists()) + if (struct_exists(_penalty_data, "hit")){ + if (_existing == -1){ + with (obj_controller){ + array_push(loyal,loyalty_reason); + array_push(loyal_num,_penalty_data.hit ); + + } + } else { + loyal_num[_existing] += _penalty_data.hit; + } + } + } +} + +function loyalty_countdowns(){ + for (var i=0;i0){ + obj_controller.loyal_time[i]--; + if (is_array(obj_controller.loyal_num[i])){ + var loyal_nums = obj_controller.loyal_num[i]; + if (loyal_nums[1]++>=loyal_nums[0]){ + obj_controller.loyalty+=loyal_nums[2]; + obj_controller.loyal_num[i]=[loyal_nums[0],0, loyal_nums[2]]; + } else { + obj_controller.loyal_num[i]=loyal_nums; + } + } + if (obj_controller.loyal_time[i] == 0){ + obj_controller.loyal_num = 0; + } + } } } function loyalty_tooltip_string(){