From 0f7c285f7b4bc407450dd3ef8e95f4bc8be3084c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D1=81=D1=82=D0=B5=D1=80=20=D0=A7=D0=B8=D1=84?= <43174917+MCPO-Spartan-117@users.noreply.github.com> Date: Tue, 11 Mar 2025 20:22:47 -0400 Subject: [PATCH] feat: Merge Purge and Attack Bombard --- objects/obj_drop_select/Alarm_1.gml | 1 - objects/obj_drop_select/Alarm_2.gml | 62 --- objects/obj_drop_select/Alarm_3.gml | 71 --- objects/obj_drop_select/Alarm_4.gml | 60 --- objects/obj_drop_select/Alarm_5.gml | 0 objects/obj_drop_select/Alarm_6.gml | 0 objects/obj_drop_select/Create_0.gml | 330 +++++++------- objects/obj_drop_select/Draw_64.gml | 2 +- objects/obj_drop_select/KeyPress_68.gml | 0 objects/obj_drop_select/Step_0.gml | 0 objects/obj_drop_select/obj_drop_select.yy | 10 +- objects/obj_star_select/Draw_64.gml | 40 +- .../scr_drop_select_function.gml | 220 ++++----- scripts/scr_purge_world/scr_purge_world.gml | 420 +++++++++++++++--- scripts/scr_roster/scr_roster.gml | 9 +- 15 files changed, 672 insertions(+), 553 deletions(-) delete mode 100644 objects/obj_drop_select/Alarm_1.gml delete mode 100644 objects/obj_drop_select/Alarm_2.gml delete mode 100644 objects/obj_drop_select/Alarm_3.gml delete mode 100644 objects/obj_drop_select/Alarm_4.gml delete mode 100644 objects/obj_drop_select/Alarm_5.gml delete mode 100644 objects/obj_drop_select/Alarm_6.gml delete mode 100644 objects/obj_drop_select/KeyPress_68.gml delete mode 100644 objects/obj_drop_select/Step_0.gml diff --git a/objects/obj_drop_select/Alarm_1.gml b/objects/obj_drop_select/Alarm_1.gml deleted file mode 100644 index 8b13789179..0000000000 --- a/objects/obj_drop_select/Alarm_1.gml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/objects/obj_drop_select/Alarm_2.gml b/objects/obj_drop_select/Alarm_2.gml deleted file mode 100644 index f58e7404dc..0000000000 --- a/objects/obj_drop_select/Alarm_2.gml +++ /dev/null @@ -1,62 +0,0 @@ - -var i;i=-1; -repeat(31){ - i+=1; - ship[i]=""; - ship_all[i]=0; - ship_use[i]=0; - ship_max[i]=0; - ship_ide[i]=-1; -} - -max_ships=0; -if (sh_target!=-50){ - max_ships=sh_target.capital_number+sh_target.frigate_number+sh_target.escort_number; -} - - -if (ship_max[500]!=0) then max_ships+=1; - -ship_all[500]=0; -ship_use[500]=0; -if (l_size>0) then l_size=l_size*-1; - - - -if (sh_target!=-50){ - var tump = 0; - var i = 0; - for (var q = 0; q < sh_target.capital_number; q++){ - if (sh_target.capital[q]!="") and (obj_ini.ship_carrying[sh_target.capital_num[q]]>0){ - ship[i]=sh_target.capital[i]; - ship_use[i]=0; - tump=sh_target.capital_num[i]; - ship_max[i]=obj_ini.ship_carrying[tump]; - ship_ide[i]=tump; - ship_size[i]=3; - i+=1; - } - } - for (var q = 0; q < sh_target.frigate_number; q++) { - if (sh_target.frigate[q]!="") and (obj_ini.ship_carrying[sh_target.frigate_num[q]]>0){ - ship[i]=sh_target.frigate[q]; - ship_use[i]=0; - tump=sh_target.frigate_num[q]; - ship_max[i]=obj_ini.ship_carrying[tump]; - ship_ide[i]=tump; - ship_size[i]=2; - i+=1; - } - } - for (var q = 0; q < sh_target.escort_number; q++) { - if (sh_target.escort[q]!="") and (obj_ini.ship_carrying[sh_target.escort_num[q]]>0){ - ship[i]=sh_target.escort[q]; - ship_use[i]=0; - tump=sh_target.escort_num[q]; - ship_max[i]=obj_ini.ship_carrying[tump]; - ship_ide[i]=tump; - ship_size[i]=1; - i+=1; - } - } -} diff --git a/objects/obj_drop_select/Alarm_3.gml b/objects/obj_drop_select/Alarm_3.gml deleted file mode 100644 index 7b04af3c23..0000000000 --- a/objects/obj_drop_select/Alarm_3.gml +++ /dev/null @@ -1,71 +0,0 @@ -var i;i=-1; -repeat(61){ - i+=1; - ship[i]=""; - ship_all[i]=0; - ship_use[i]=0; - ship_max[i]=0; - ship_ide[i]=-1; -} - -max_ships=0; - - -if (sh_target!=-50){ - max_ships=sh_target.capital_number+sh_target.frigate_number+sh_target.escort_number; - - - var tump;tump=0; - - var i, q, b;i=0;q=0;b=0; - repeat(sh_target.capital_number){ - b+=1; - if (sh_target.capital[b]!=""){ - i+=1; - ship[i]=sh_target.capital[i]; - - ship_use[i]=0; - tump=sh_target.capital_num[i]; - ship_max[i]=obj_ini.ship_carrying[tump]; - ship_ide[i]=tump; - ship_size[i]=3; - - purge_a+=3; - purge_b+=ship_max[i];purge_c+=ship_max[i]; - } - } - q=0; - repeat(sh_target.frigate_number){ - q+=1; - if (sh_target.frigate[q]!=""){ - i+=1; - ship[i]=sh_target.frigate[q]; - - ship_use[i]=0; - tump=sh_target.frigate_num[q]; - ship_max[i]=obj_ini.ship_carrying[tump]; - ship_ide[i]=tump; - ship_size[i]=2; - - purge_a+=1; - purge_b+=ship_max[i];purge_c+=ship_max[i]; - } - } - q=0; - repeat(sh_target.escort_number){ - q+=1; - if (sh_target.escort[q]!="") and (obj_ini.ship_carrying[sh_target.escort_num[q]]>0){ - i+=1; - ship[i]=sh_target.escort[q]; - - ship_use[i]=0; - tump=sh_target.escort_num[q]; - ship_max[i]=obj_ini.ship_carrying[tump]; - ship_ide[i]=tump; - ship_size[i]=1; - - purge_b+=ship_max[i];purge_c+=ship_max[i]; - } - } -} - diff --git a/objects/obj_drop_select/Alarm_4.gml b/objects/obj_drop_select/Alarm_4.gml deleted file mode 100644 index 9236122bdd..0000000000 --- a/objects/obj_drop_select/Alarm_4.gml +++ /dev/null @@ -1,60 +0,0 @@ - - -// This confirms the number of ships available for bombarding - -var i;i=-1; -repeat(61){ - i+=1; - ship[i]=""; - ship_all[i]=0; - ship_use[i]=0; - ship_max[i]=0; - ship_ide[i]=-1; -} - -max_ships=0; - - -if (sh_target!=-50){ - max_ships=sh_target.capital_number+sh_target.frigate_number+sh_target.escort_number; - - - var tump;tump=0; - - var i, q, b;i=0;q=0;b=0; - repeat(sh_target.capital_number){ - b+=1; - if (sh_target.capital[b]!=""){ - i+=1; - ship[i]=sh_target.capital[i]; - - ship_use[i]=0; - tump=sh_target.capital_num[i]; - ship_max[i]=obj_ini.ship_carrying[tump]; - ship_ide[i]=tump; - ship_size[i]=3; - - purge_a+=3; - purge_b+=ship_max[i]; - purge_c+=ship_max[i]; - } - } - q=0; - repeat(sh_target.frigate_number){ - q+=1; - if (sh_target.frigate[q]!=""){ - i+=1; - ship[i]=sh_target.frigate[q]; - - ship_use[i]=0; - tump=sh_target.frigate_num[q]; - ship_max[i]=obj_ini.ship_carrying[tump]; - ship_ide[i]=tump; - ship_size[i]=2; - - purge_a+=1; - purge_b+=ship_max[i];purge_c+=ship_max[i]; - } - } -} - diff --git a/objects/obj_drop_select/Alarm_5.gml b/objects/obj_drop_select/Alarm_5.gml deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/objects/obj_drop_select/Alarm_6.gml b/objects/obj_drop_select/Alarm_6.gml deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/objects/obj_drop_select/Create_0.gml b/objects/obj_drop_select/Create_0.gml index 5d2276ecd9..0b026a7b0b 100644 --- a/objects/obj_drop_select/Create_0.gml +++ b/objects/obj_drop_select/Create_0.gml @@ -1,20 +1,20 @@ -mouse_left=1; +mouse_left = 1; if !(variable_instance_exists(self, "attack")){ attack = 0; } -once_only=0; - -raid_tact=1; -raid_vet=1; -raid_assa=1; -raid_deva=1; -raid_scou=1; -raid_term=1; -raid_spec=1; -raid_wounded=obj_controller.select_wounded; -refresh_raid=0; -remove_local=1; +once_only = 0; + +raid_tact = 1; +raid_vet = 1; +raid_assa = 1; +raid_deva = 1; +raid_scou = 1; +raid_term = 1; +raid_spec = 1; +raid_wounded = obj_controller.select_wounded; +refresh_raid = 0; +remove_local = 1; // @@ -23,69 +23,69 @@ draw = drop_select_draw; main_slate.inside_method = draw; roster_slate = new DataSlate(); local_content_slate = new DataSlate(); -var i=-1; -formation_current=-1; -via = array_create(100, 0); +var i = -1; +formation_current = -1; +via = array_create(100, 0); formation_possible = []; force_present = array_create(51, 0); -r_master=0; -r_honor=0; -r_capts=0; -r_mahreens=0; -r_veterans=0; -r_terminators=0; -r_dreads=0; -r_chaplains=0; -r_champions=0; -r_psykers=0; -r_apothecaries=0; -r_techmarines=0; +r_master = 0; +r_honor = 0; +r_capts = 0; +r_mahreens = 0; +r_veterans = 0; +r_terminators = 0; +r_dreads = 0; +r_chaplains = 0; +r_champions = 0; +r_psykers = 0; +r_apothecaries = 0; +r_techmarines = 0; // Attack -r_bikes=0; +r_bikes = 0; if (action_if_number(obj_saveload, 0, 0)){ - ship_names=""; - max_ships=0; - ships_selected=0; + ship_names = ""; + max_ships = 0; + ships_selected = 0; - purge_method=0; - purge_score=0; - purge_a=0; - purge_b=0; - purge_c=0; - purge_d=0; - tooltip=""; - tooltip2=""; - all_sel=0; + purge_method = 0; + purge_score = 0; + purge_a = 0; + purge_b = 0; + purge_c = 0; + purge_d = 0; + tooltip = ""; + tooltip2 = ""; + all_sel = 0; - var i=-1; + var i = -1; var _ship_index = array_length(obj_ini.ship); - ship=array_create(_ship_index, ""); - ship_size=array_create(_ship_index, 0); - ship_all=array_create(_ship_index, 0); - ship_use=array_create(_ship_index, 0); - ship_max=array_create(_ship_index, 0); - ship_ide=array_create(_ship_index, -1); + ship = array_create(_ship_index, ""); + ship_size = array_create(_ship_index, 0); + ship_all = array_create(_ship_index, 0); + ship_use = array_create(_ship_index, 0); + ship_max = array_create(_ship_index, 0); + ship_ide = array_create(_ship_index, -1); - i=500; - ship[i]="Local"; - ship_size[i]=0; - ship_all[i]=0; - ship_use[i]=0; - ship_max[i]=0; - ship_ide[i]=-42; + i = 500; + ship[i] = "Local"; + ship_size[i] = 0; + ship_all[i] = 0; + ship_use[i] = 0; + ship_max[i] = 0; + ship_ide[i] = -42; - menu=0; + menu = 0; roster = new Roster(); - if (instance_exists(p_target)){ + if (instance_exists(p_target)) { roster.roster_location = p_target.name; } @@ -96,52 +96,52 @@ if (action_if_number(obj_saveload, 0, 0)){ // These should be set to a negative value; that is, effectively, how much when it is selected (i.e. *-1) - attacking=0; - sisters=0; - eldar=0; - ork=0; - tau=0; - traitors=0; - tyranids=0; - csm=0; - necrons=0; - demons=0; + attacking = 0; + sisters = 0; + eldar = 0; + ork = 0; + tau = 0; + traitors = 0; + tyranids = 0; + csm = 0; + necrons = 0; + demons = 0; // Formation check - var i=0,is=0,arright=false; + var i = 0, is = 0, arright = false; var _formations = obj_controller.bat_formation; var _formation_types = obj_controller.bat_formation_type; - for (var i=0;i0) then max_ships+=1; - - var bes=0,bes_score=0; - if (sisters>0) and (obj_controller.faction_status[eFACTION.Ecclesiarchy]="War"){bes=5;bes_score=sisters;} - if (eldar>bes_score){bes=6;bes_score=eldar;} - if (ork>bes_score){bes=7;bes_score=ork;} - if (tau>bes_score){bes=8;bes_score=tau;} - if (tyranids>bes_score){bes=9;bes_score=tyranids;} - if (traitors>bes_score){bes=10;bes_score=traitors;} - if (csm>bes_score){bes=11;bes_score=csm;} - if (necrons>bes_score){bes=13;bes_score=necrons;} - if (demons>0){bes=12;bes_score=demons;} - if (bes_score>0) then attacking=bes; - - var spesh=false; - if (planet_feature_bool(p_target.p_feature[planet_number],P_features.Warlord10)==1) and (obj_controller.faction_defeated[10]=0) and (obj_controller.faction_gender[10]=1) and (obj_controller.known[eFACTION.Chaos]>0) and (obj_controller.turn>=obj_controller.chaos_turn) then spesh=true; - +sisters = p_target.p_sisters[planet_number]; +eldar = p_target.p_eldar[planet_number]; +ork = p_target.p_orks[planet_number]; +tau = p_target.p_tau[planet_number]; +tyranids = p_target.p_tyranids[planet_number]; +csm = p_target.p_chaos[planet_number]; +traitors = p_target.p_traitors[planet_number]; +necrons = p_target.p_necrons[planet_number]; +demons = p_target.p_demons[planet_number]; + +if (p_target.p_player[planet_number] > 0) { max_ships += 1; } + +if (purge == 0) { + var spesh = false; + if (planet_feature_bool(p_target.p_feature[planet_number], P_features.Warlord10) == 1) && (obj_controller.faction_defeated[10] == 0) && (obj_controller.faction_gender[10] == 1) && (obj_controller.known[eFACTION.Chaos] > 0) && (obj_controller.turn >= obj_controller.chaos_turn) { spesh=true; } + + var bes = 0, bes_score = 0; + if (sisters > 0) && (obj_controller.faction_status[eFACTION.Ecclesiarchy] = "War"){bes = 5; bes_score = sisters;} + if (eldar > bes_score){bes = 6; bes_score = eldar;} + if (ork > bes_score){bes = 7; bes_score = ork;} + if (tau > bes_score){bes = 8; bes_score = tau;} + if (tyranids > bes_score){bes = 9; bes_score = tyranids;} + if (traitors > bes_score){bes = 10; bes_score = traitors;} + if (csm > bes_score){bes = 11; bes_score = csm;} + if (necrons > bes_score){bes = 13; bes_score = necrons;} + if (demons > 0){bes = 12; bes_score = demons;} + if (bes_score > 0) { attacking = bes; } if (has_problem_planet(planet_number, "tyranid_org", p_target)){ - tyranids=2; - attacking=9; + tyranids = 2; + attacking = 9; } - var forces,t_attack;forces=0;t_attack=0; - if (sisters>0){forces+=1;force_present[forces]=5;} - if (eldar>0){forces+=1;force_present[forces]=6;} - if (ork>0){forces+=1;force_present[forces]=7;} - if (tau>0){forces+=1;force_present[forces]=8;} - if (tyranids>0){ - forces+=1; - force_present[forces]=9; + var forces, t_attack; forces = 0; t_attack = 0; + if (sisters > 0){forces += 1; force_present[forces] = 5;} + if (eldar > 0){forces += 1; force_present[forces] = 6;} + if (ork > 0){forces += 1; force_present[forces] = 7;} + if (tau > 0){forces += 1; force_present[forces] = 8;} + if (tyranids > 0){ + forces += 1; + force_present[forces] = 9; + } + if (traitors > 0) || ((traitors == 0) && (spesh == true)){ + forces += 1; + force_present[forces] = 10; } - if (traitors>0) or ((traitors=0) and (spesh=true)){ - forces+=1; - force_present[forces]=10; + if (csm > 0){ + forces += 1; + force_present[forces] = 11; } - if (csm>0){ - forces+=1; - force_present[forces]=11; + if (demons > 0){ + forces += 1; + force_present[forces] = 12; } - if (demons>0){ - forces+=1; - force_present[forces]=12; + if (necrons > 0) { + forces += 1; + force_present[forces] = 13; } - if (necrons>0){ - forces+=1; - force_present[forces]=13; - } } else { - var _viable_ground_forces = roster.marines_total(); - bombard_purge = new PurgeButton(4, 631,231,DropType.PurgeBombard); - bombard_purge.active = roster.purge_bombard_score() ? 1:0; - bombard_purge.description = "The final sanction for worlds where there is no other economic means for rooting out heresy corruption or the xenos, Your chapters reputation amoung the planets populace may will be damaged, any residing governor (providing they are fit to rule and survive) will be displeased, collaterals will be huge but it's effects will surely be great"; + if (p_data.guardsmen > 0) { + imp = p_data.guard_score_calc(); + } + var _pdf_count = p_data.pdf; + if (_pdf_count >= 50000000) { + pdf = 6; + } else if (_pdf_count >= 15000000) { + pdf = 5; + } else if (_pdf_count >= 6000000) { + pdf = 4; + } else if (_pdf_count >= 1000000) { + pdf = 3; + } else if (_pdf_count >= 100000) { + pdf = 2; + } else if (_pdf_count >= 2000) { + pdf = 1; + } - fire_purge = new PurgeButton(5,631,304,DropType.PurgeFire); - fire_purge.active = _viable_ground_forces; - fire_purge.description = "Large swathes of the worst affected areas will be put to the torch the heretics and xenos will be found, the planets populace will not thanks you but most governors will be content to allow the work they were to weak to do to be done"; + target = 2; + if (eldar > csm) && (eldar > traitors) && (eldar > ork) && (eldar > tau) && (eldar > tyranids) && (eldar > necrons) { target = 6; } + if (ork > csm) && (ork > traitors) && (ork > eldar) && (ork > tau) && (ork > tyranids) && (ork > necrons) { target = 7; } + if (tau > csm) && (tau > traitors) && (tau > eldar) && (tau > ork) && (tau > tyranids) && (tau > necrons) { target = 8; } + if (tyranids > csm) && (tyranids > traitors) && (tyranids > ork) && (tyranids > tau) && (tyranids > eldar) && (tyranids > necrons) { target = 9; } + if (csm > ork) && (csm >= traitors) && (csm > eldar) && (csm > tau) && (csm > tyranids) && (csm > necrons) { target = 10; } + if (traitors > ork) && (traitors >= csm) && (traitors > eldar) && (traitors > tau) && (traitors > tyranids) && (traitors > necrons) { target = 10; } + if (necrons > ork) && (necrons >= csm) && (necrons > eldar) && (necrons > tau) && (necrons > tyranids) && (necrons > traitors) { target = 13; } + if (p_target.p_owner[obj_controller.selecting_planet] == 8) { + if (pdf > csm) && (pdf > traitors) && (pdf > eldar) && (pdf > ork) && (pdf > tyranids) && (pdf > tau) && (pdf > necrons) { target = 2.5; } + } + if (p_target.craftworld == 1) { target = 6; } +} - selective_purge = new PurgeButton(6,631,377,DropType.PurgeSelective); - selective_purge.active = _viable_ground_forces; - selective_purge.description = "The nodes of corruption will be saught out and killed, often in such cases the rot resides in the higher reaches of society such methids are perfect for these instances, cut the head off the snake and the rest will wither, the populations of the oppressed planets are generaly pleased even if the nobles and governors chaffe at the censorship or if neccassary execution"; +var _fleet_bombard_score = calculate_fleet_bombard_score(sh_target.fleet_ships); +var _viable_ground_forces = calculate_fleet_content_size(sh_target.fleet_ships); +bombard_purge = new PurgeButton(4, 631,231,DropType.PurgeBombard); +bombard_purge.active = _fleet_bombard_score ? 1:0; +bombard_purge.description = "The final sanction for worlds where there is no other economic means for rooting out heresy corruption or the xenos, Your chapters reputation amoung the planets populace may will be damaged, any residing governor (providing they are fit to rule and survive) will be displeased, collaterals will be huge but it's effects will surely be great"; - assasinate_purge = new PurgeButton(7,631,450,DropType.PurgeAssassinate); - assasinate_purge.active = _viable_ground_forces; - assasinate_purge.description = "Often the simplest solution is a single bolt shell or the swift knife the heart. Kill the Leader."; +fire_purge = new PurgeButton(5,631,304,DropType.PurgeFire); +fire_purge.active = _viable_ground_forces; +fire_purge.description = "Large swathes of the worst affected areas will be put to the torch the heretics and xenos will be found, the planets populace will not thanks you but most governors will be content to allow the work they were to weak to do to be done"; - purge_options = [bombard_purge, fire_purge, selective_purge, assasinate_purge]; -} +selective_purge = new PurgeButton(6,631,377,DropType.PurgeSelective); +selective_purge.active = _viable_ground_forces; +selective_purge.description = "The nodes of corruption will be saught out and killed, often in such cases the rot resides in the higher reaches of society such methids are perfect for these instances, cut the head off the snake and the rest will wither, the populations of the oppressed planets are generaly pleased even if the nobles and governors chaffe at the censorship or if neccassary execution"; + +assasinate_purge = new PurgeButton(7,631,450,DropType.PurgeAssassinate); +assasinate_purge.active = _viable_ground_forces; +assasinate_purge.description = "Often the simplest solution is a single bolt shell or the swift knife the heart. Kill the Leader."; +purge_options = [bombard_purge, fire_purge, selective_purge, assasinate_purge]; diff --git a/objects/obj_drop_select/Draw_64.gml b/objects/obj_drop_select/Draw_64.gml index 1e946516b6..dec9e36f1d 100644 --- a/objects/obj_drop_select/Draw_64.gml +++ b/objects/obj_drop_select/Draw_64.gml @@ -61,7 +61,7 @@ try { draw_set_halign(fa_center); if (purge == DropType.RaidAttack) { local_content_slate.draw(_x_center - local_content_slate.width, _y_center, (300 / 860), (520 / 850)); - } else if (purge == 1) { + } else if (purge == DropType.PurgeSelect) { local_content_slate.draw((camera_width / 2) - (local_content_slate.width / 2), _y_center, (300 / 860), (520 / 850)); } else { if (local_content_slate.XX > _x_center - local_content_slate.width) { diff --git a/objects/obj_drop_select/KeyPress_68.gml b/objects/obj_drop_select/KeyPress_68.gml deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/objects/obj_drop_select/Step_0.gml b/objects/obj_drop_select/Step_0.gml deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/objects/obj_drop_select/obj_drop_select.yy b/objects/obj_drop_select/obj_drop_select.yy index 0bfdfdf18d..d10ec11981 100644 --- a/objects/obj_drop_select/obj_drop_select.yy +++ b/objects/obj_drop_select/obj_drop_select.yy @@ -4,16 +4,8 @@ "name": "obj_drop_select", "eventList": [ {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,}, - {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":6,"eventType":2,"isDnD":false,}, - {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":5,"eventType":2,"isDnD":false,}, - {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":4,"eventType":2,"isDnD":false,}, - {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":3,"eventType":2,"isDnD":false,}, - {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":2,"eventType":2,"isDnD":false,}, - {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":1,"eventType":2,"isDnD":false,}, - {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":0,"eventType":3,"isDnD":false,}, {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":56,"eventType":6,"isDnD":false,}, {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":50,"eventType":6,"isDnD":false,}, - {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":68,"eventType":9,"isDnD":false,}, {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,}, ], "managed": true, @@ -41,4 +33,4 @@ "spriteId": null, "spriteMaskId": null, "visible": true, -} \ No newline at end of file +} diff --git a/objects/obj_star_select/Draw_64.gml b/objects/obj_star_select/Draw_64.gml index e7be9c3e5d..dc4242d147 100644 --- a/objects/obj_star_select/Draw_64.gml +++ b/objects/obj_star_select/Draw_64.gml @@ -166,33 +166,18 @@ if (obj_controller.selecting_planet!=0){ } // Buttons that are available if (!buttons_selected){ - if (obj_controller.faction_status[eFACTION.Imperium] != "War" && p_data.current_owner > 5) || (obj_controller.faction_status[eFACTION.Imperium] == "War" && p_data.at_war(0, 1, 1) && p_data.player_disposition <= 50) { - var is_enemy=true; - } else { - var is_enemy=false; - } - if (p_data.planet>0){ if (target.present_fleet[1]=0)/* and (target.p_type[obj_controller.selecting_planet]!="Dead")*/{ if (p_data.player_forces>0){ - if (is_enemy){ - button1="Attack"; - button2="Purge"; - } + button1="Attack"; + button2="Purge"; } } if (target.present_fleet[1]>0)/* and (target.p_type[obj_controller.selecting_planet]!="Dead")*/{ - if (is_enemy) { - button1="Attack"; - button2="Raid"; - button3="Bombard"; - } - else { - button1="Attack"; - button2="Raid"; - button3="Purge"; - } - + button1="Attack"; + button2="Raid"; + button3="Purge"; + if (torpedo>0){ var pfleet=instance_nearest(x,y,obj_p_fleet); if (instance_exists(pfleet)) and (point_distance(pfleet.x,pfleet.y,target.x,target.y)<=40) and (pfleet.action=""){ @@ -235,7 +220,7 @@ if (obj_controller.selecting_planet!=0){ if (target.space_hulk){ if (target.present_fleet[1]>0){ button1="Raid"; - button2="Bombard"; + button2="Purge"; button3=""; button4=""; } @@ -421,22 +406,13 @@ if (obj_controller.selecting_planet!=0){ if (_allow_attack){ instance_create_layer(x, y, layer_get_all()[0], obj_drop_select,{ p_target:target, + p_data : p_data, purge:1, planet_number : obj_controller.selecting_planet, sh_target : _targ, }); } - }else if (current_button=="Bombard"){ - instance_create(x,y,obj_bomb_select); - if (instance_exists(obj_bomb_select)){ - obj_bomb_select.p_target=target; - obj_bomb_select.sh_target=instance_nearest(x,y,obj_p_fleet); - obj_bomb_select.p_data = p_data; - if (instance_nearest(x,y,obj_p_fleet).acted>0) then with(obj_bomb_select){ - instance_destroy(); - } - } }else if (current_button=="+Recruiting"){ if (obj_controller.recruiting_worlds_bought > 0 && p_data.current_owner <= 5 && !p_data.at_war()) { if (!p_data.has_feature(P_features.Recruiting_World)) { diff --git a/scripts/scr_drop_select_function/scr_drop_select_function.gml b/scripts/scr_drop_select_function/scr_drop_select_function.gml index bc2dca571e..d1f08f3f2c 100644 --- a/scripts/scr_drop_select_function/scr_drop_select_function.gml +++ b/scripts/scr_drop_select_function/scr_drop_select_function.gml @@ -8,8 +8,8 @@ enum DropType { } function drop_select_draw(){ - with (obj_drop_select){ - if (purge != DropType.PurgeSelect) { + with (obj_drop_select){ + if (purge != DropType.PurgeSelect) { w = 660; h = 520; // Center of the screen @@ -89,7 +89,91 @@ function drop_select_draw(){ if (_local_button.clicked()) { roster.update_roster(); } - } + } else { + if (purge == DropType.PurgeBombard) { + if (p_target.sprite_index != spr_star_hulk) { + // TODO a centralised point to be able to fetch display names from factions identifying number + draw_set_color(c_gray); + var t_name = ""; + switch (target) { + case eFACTION.Imperium: + t_name = "Imperial Forces"; + break; + case 2.5: + if (p_target.p_owner[obj_controller.selecting_planet] == 8) { + t_name = "Gue'la Forces"; + } else { + t_name = "PDF"; + } + break; + case eFACTION.Mechanicus: + t_name = "Mechanicus"; + break; + case eFACTION.Ecclesiarchy: + t_name = "Ecclesiarchy"; + break; + case eFACTION.Eldar: + t_name = "Eldar"; + break; + case eFACTION.Ork: + t_name = "Orks"; + break; + case eFACTION.Tau: + t_name = "Tau"; + break; + case eFACTION.Tyranids: + t_name = "Tyranids"; + break; + case eFACTION.Chaos: + t_name = "Chaos"; + break; + case eFACTION.Necrons: + t_name = "Necrons"; + break; + default: + t_name = ""; + break; + } + + var str=0,str_string=""; + // TODO a centralised point to be able to fetch display names from factions identifying number + str = floor(p_data.planet_forces[target]); + if (target == 2.5){ + str = determine_pdf_defence(p_data.pdf,,p_data.fortification_level)[0]; + } + var _s_strings = ARR_strength_descriptions + if (str 0){ + array_push(_possible_targets, i); + } + } + if (p_data.pdf > 0) { + array_push(_possible_targets, 2.5); + } + // Switch target to the next in the array + if (array_length(_possible_targets) > 0) { + var _current_index = array_get_index(_possible_targets, target); + _current_index = _current_index < (array_length(_possible_targets) - 1) ? _current_index + 1: 0 ; + target = _possible_targets[_current_index]; + } + + } + var strength_string = $"Strength: {str}"; + draw_text_bold(x8 + 325, y8 + 50, strength_string); + var bombard_strength = roster.purge_bombard_score(); + draw_text_bold(x8 + 325, y8 + 75, $"Bombard Strength: {bombard_strength}"); + } + } + } y8 += 21; var _all_active = true; @@ -361,15 +445,18 @@ function drop_select_draw(){ draw_rectangle(954, 556, 1043, 579, 0); draw_set_alpha(1); var _purge_score=0; - if (purge == 2) { - _purge_score = roster.purge_bombard_score(); - } + if (purge == DropType.PurgeBombard) { + _purge_score = bombard_strength; + } else { + target = undefined; + str = undefined; + } if (purge >= 3) { _purge_score = array_length(roster.selected_units); } - scr_purge_world(p_target, planet_number, purge , _purge_score); + scr_purge_world(p_target, planet_number, purge, _purge_score, target, str); } } } @@ -447,102 +534,29 @@ function drop_select_draw(){ } function collect_local_units(){ - // - // I think this script is used to count local forces. l_ meaning local. - // - ship_use[500]=0; - ship_max[500]=l_size; - purge_d=ship_max[500]; - - if (purge==1) - { - - - - - if (sh_target!=-50){ - - max_ships=sh_target.capital_number+sh_target.frigate_number+sh_target.escort_number; - - - if (sh_target.acted>=1) then instance_destroy(); - - var tump;tump=0; - - var i, q, b;i=-1;q=-1;b=-1; - repeat(sh_target.capital_number){ - b+=1; - if (sh_target.capital[b]!=""){ - i+=1; - ship[i]=sh_target.capital[i]; - - ship_use[i]=0; - tump=sh_target.capital_num[i]; - ship_max[i]=obj_ini.ship_carrying[tump]; - ship_ide[i]=tump; - - ship_size[i]=3; - - purge_a+=3; - purge_b+=ship_max[i];purge_c+=ship_max[i];purge_d+=ship_max[i]; - } - } - q=-1; - repeat(sh_target.frigate_number){ - q+=1; - if (sh_target.frigate[q]!=""){ - i+=1; - ship[i]=sh_target.frigate[q]; - - ship_use[i]=0; - tump=sh_target.frigate_num[q]; - ship_max[i]=obj_ini.ship_carrying[tump]; - ship_ide[i]=tump; - - ship_size[i]=2; - - purge_a+=1; - purge_b+=ship_max[i]; - purge_c+=ship_max[i]; - purge_d+=ship_max[i]; - } - } - q=-1; - repeat(sh_target.escort_number){ - q+=1; - if (sh_target.escort[q]!="") and (obj_ini.ship_carrying[sh_target.escort_num[q]]>0){ - i+=1; - ship[i]=sh_target.escort[q]; - - ship_use[i]=0; - tump=sh_target.escort_num[q]; - ship_max[i]=obj_ini.ship_carrying[tump]; - ship_ide[i]=tump; - - ship_size[i]=1; - - purge_b+=ship_max[i]; - purge_c+=ship_max[i]; - purge_d+=ship_max[i]; - } - } - - } - - if (p_target.p_player[planet_number]>0) then max_ships+=1; - var pp=planet_number; - purge_d = p_target.p_type[pp]!="Dead"; - - if (has_problem_planet(pp,"succession",p_target)) then purge_d=0 - - if (p_target.dispo[pp]<-2000) then purge_d=0; - - if (planet_feature_bool(p_target.p_feature[pp],P_features.Monastery)==1) and (obj_controller.homeworld_rule!=1) then purge_d=0; - - if (p_target.p_type[pp]="Dead") then purge_d=0; - - - } + if (purge==1) { + if (sh_target!=-50){ + if (sh_target.acted >= 1) { + instance_destroy(); + } + + purge_a = fleet_bombard_score; + purge_b = viable_ground_forces; + purge_c = viable_ground_forces; + purge_d = viable_ground_forces; + } + + if (p_target.p_player[planet_number]>0) { + max_ships+=1; + } + + var pp=planet_number; + purge_d = p_target.p_type[pp] != "Dead"; + + if (p_target.p_type[pp] == "Dead") || (has_problem_planet(pp,"succession",p_target)) || (p_target.dispo[pp] < -2000) || (planet_feature_bool(p_target.p_feature[pp],P_features.Monastery) == 1 && obj_controller.homeworld_rule != 1) { + purge_d=0 + } + } } diff --git a/scripts/scr_purge_world/scr_purge_world.gml b/scripts/scr_purge_world/scr_purge_world.gml index 0ae105856e..ca48469b51 100644 --- a/scripts/scr_purge_world/scr_purge_world.gml +++ b/scripts/scr_purge_world/scr_purge_world.gml @@ -1,4 +1,4 @@ -function scr_purge_world(star, planet, action_type, action_score) { +function scr_purge_world(star, planet, action_type, action_score, bombard_target_faction = undefined, target_strength = undefined) { var pop_before,pop_after,sci1,sci2,txt1,txt2, max_kill, overkill, heres_before, heres_after, kill; var isquest,thequest,questnum;isquest=0;thequest="";questnum=0;pop_after=0;txt1="";txt2="";overkill=0; @@ -54,63 +54,371 @@ function scr_purge_world(star, planet, action_type, action_score) { // TODO - while I don't expect Surface to Orbit weapons retaliating against player's purge bombardment, it might still be worthwhile to consider possible situations - if (action_type=DropType.PurgeBombard){// Bombardment - txt1=choose("Your cruiser and larger ship", "The heavens rumble and thunder as your ship"); - if (ships_selected>1) then txt1+="s"; - txt1+=choose(" position themselves over the target in close orbit, and unleash", " unload"); - if (ships_selected=1) then txt1+="s"; - txt1+= $" annihilation upon {planet_numeral_name(planet, star)}. Even from space the explosions can be seen, {choose("tearing ground", "hammering", "battering", "thundering")} across the planet's surface."; - - if (star.p_large[planet]=0) then max_kill=action_score*15000000; - if (star.p_large[planet]=1) then max_kill=action_score*0.015;// Population if large - - pop_before=star.p_population[planet]; - - heres_before=max(star.p_heresy[planet]+star.p_heresy_secret[planet],star.p_influence[planet][eFACTION.Tau]);// Starting heresy - - // Minimum kills - if (pop_before>0) then overkill=max(pop_before*0.1,((heres_before/200)*pop_before)); - if (pop_before=0) then overkill=0; - - kill=min(max_kill,overkill,pop_before);// How many people ARE going to be killed - - pop_after=pop_before-kill; - sci1=0;sci2=0; - - if (pop_before>0) then sci1=(pop_after/pop_before)*100;// Relative % of people murderized - if (sci1>0) then sci2=min((sci1*2),action_score*2);// How much hurresy to get rid of - heres_after=heres_before-sci2; - if (pop_before>0) and (pop_after=0) then heres_after=0; - - if (star.p_large[planet]=0) then pop_after=round(pop_after); - if (pop_after<=0) and (pop_before>0) then heres_after=0; - - var _displayed_population = star.p_large[planet] == 1 ? $"{pop_before} billion" : scr_display_number(floor(pop_before)); - var _displayed_killed = star.p_large[planet] == 1 ? $"{kill} billion" : scr_display_number(floor(kill)); - txt1 += $"##The world had {_displayed_population} Imperium subjects. {_displayed_killed} were purged over the duration of the bombardment.##Heresy has fallen down to {max(0, heres_after)}%."; - - if (pop_after=0){ - if (star.p_owner[planet]=2) and (obj_controller.faction_status[2]!="War"){ - if (star.p_type[planet]="Temperate") or (star.p_type[planet]="Hive") or (star.p_type[planet]="Desert"){ - obj_controller.audiences+=1;obj_controller.audien[obj_controller.audiences]=2; - obj_controller.audien_topic[obj_controller.audiences]="bombard_angry"; - } - if (star.p_type[planet]="Temperate") then obj_controller.disposition[2]-=5; - if (star.p_type[planet]="Desert") then obj_controller.disposition[2]-=3; - if (star.p_type[planet]="Hive") then obj_controller.disposition[2]-=10; - } - } - if (star.p_owner[planet]=3) and (obj_controller.faction_status[3]!="War"){ - obj_controller.audiences+=1; - obj_controller.audien[obj_controller.audiences]=3; - obj_controller.audien_topic[obj_controller.audiences]="bombard_angry"; - if (star.p_type[planet]="Forge") then obj_controller.disposition[3]-=15; - if (star.p_type[planet]="Ice") then obj_controller.disposition[3]-=7; - } + if (action_type=DropType.PurgeBombard) { // Bombardment + txt1 = ""; + txt2 = ""; + txt3 = ""; - - } + txt1 = choose("Your cruiser and larger ship", "The heavens rumble and thunder as your ship"); + if (ships_selected > 1) { txt1 += "s" }; + txt1 += choose(" position themselves over the target in close orbit, and unleash", " unload"); + if (ships_selected == 1) { txt1 += "s" }; + txt1 += $" annihilation upon {planet_numeral_name(planet, star)}. Even from space the explosions can be seen, {choose("tearing ground", "hammering", "battering", "thundering")} across the planet's surface."; + + if (star.p_type[planet] != "Space Hulk") { + if (star.p_large[planet] == false) { + max_kill = action_score*15000000; + } else { + max_kill = action_score*0.015; // Population if large + } + + pop_before = star.p_population[planet]; + + heres_before = max(star.p_heresy[planet] + star.p_heresy_secret[planet], star.p_influence[planet][eFACTION.Tau]);// Starting heresy + + // Minimum kills + if (pop_before > 0) { + overkill = max(pop_before * 0.1, ((heres_before / 200) * pop_before)); + } else { + overkill=0; + } + + kill = min(max_kill, overkill, pop_before);// How many people ARE going to be killed + + pop_after = pop_before-kill; + var sci1 = 0; + var sci2 = 0; + + if (pop_before > 0) { + sci1 = (pop_after / pop_before) * 100; // Relative % of people murderized + if (sci1 > 0) { + sci2 = min((sci1 * 2), action_score * 2); // How much hurresy to get rid of + } + } + + if (star.p_large[planet] == false) { + pop_after = round(pop_after); + } + + heres_after = heres_before - sci2; + if (pop_before > 0 && pop_after <= 0) { + heres_after = 0; + } + + var _displayed_population = star.p_large[planet] == 1 ? $"{pop_before} billion" : scr_display_number(floor(pop_before)); + var _displayed_killed = star.p_large[planet] == 1 ? $"{kill} billion" : scr_display_number(floor(kill)); + txt1 += $"##The world had {_displayed_population} Imperium subjects. {_displayed_killed} were purged over the duration of the bombardment.##Heresy has fallen down to {max(0, heres_after)}%."; + + if (pop_after == 0 && pop_before > 0) { + if (star.p_owner[planet] == eFACTION.Imperium) && (obj_controller.faction_status[eFACTION.Imperium] != "War") { + if (star.p_type[planet] == "Temperate") || (star.p_type[planet] == "Hive") || (star.p_type[planet] == "Desert") { + obj_controller.audiences++; + obj_controller.audien[obj_controller.audiences] = 2; + obj_controller.audien_topic[obj_controller.audiences] = "bombard_angry"; + } + + switch (star.p_type[planet]) { + case "Temperate": + obj_controller.disposition[eFACTION.Imperium] -= 5; + break; + case "Desert": + obj_controller.disposition[eFACTION.Imperium] -= 3; + break; + case "Hive": + obj_controller.disposition[eFACTION.Imperium] -= 10; + break; + } + } else if (star.p_owner[planet] == eFACTION.Mechanicus) && (obj_controller.faction_status[eFACTION.Mechanicus] != "War") { + obj_controller.audiences++; + obj_controller.audien[obj_controller.audiences] = 3; + obj_controller.audien_topic[obj_controller.audiences] = "bombard_angry"; + switch (star.p_type[planet]) { + case "Forge": + obj_controller.disposition[eFACTION.Mechanicus] -= 15; + break; + case "Ice": // the fuck do the mechanicus want with a ice planet? + obj_controller.disposition[eFACTION.Mechanicus] -= 7; + break; + } + } + } + if (bombard_target_faction == eFACTION.Tau) && (obj_controller.faction_status[eFACTION.Tau] != "War") { + obj_controller.audiences += 1; + obj_controller.audien[obj_controller.audiences] = eFACTION.Tau; + obj_controller.audien_topic[obj_controller.audiences] = choose("declare_war", "bombard_angry"); + obj_controller.disposition[eFACTION.Tau] -= 15; + } + + if (pop_after == 0) { + if (planet_feature_bool(star.p_feature[planet], P_features.Gene_Stealer_Cult)) { + delete_features(star.p_feature[planet], P_features.Gene_Stealer_Cult); + adjust_influence(eFACTION.Tyranids, -100, planet, star); + pip.text += " The xeno taint of the tyranids that was infesting the population has been completely eradicated with the planets cleansing"; + } else { + pip.text += " Any xeno taint that was infesting the population has been completely eradicated with the planets cleansing"; + } + } + + if (bombard_target_faction != undefined) { + var bombard_protection = 1; + switch (bombard_target_faction) { + // case eFACTION.Player: + // txt2="##The Space Marine forces are difficult to bombard; "; + // bombard_protection=3; + // break; + case eFACTION.Imperium: + txt2 = "##The Imperial forces are suitably fortified; "; + bombard_protection = 2; + break; // I'm not sure about IG, maybe they should be left at 2, or, maybe they should be at 1, like the PDF + case 2.5: + if (star.p_owner[planet] <= 5){ + txt2 = "##The PDF forces are poorly fortified; "; + bombard_protection = 1; + } else if (star.p_owner[planet] > 5){ + txt2 = "##The renegade forces are poorly fortified; "; + bombard_protection = 1; + } + break; // I think PDF and renegades down there should be kind of poorly prepared for this + case eFACTION.Mechanicus: + txt2 = "##The Mechanicus forces are well fortified; "; + bombard_protection = 3; // If we get to Admech, I think they should be pretty capable with the hi-tech goodies they have + break; + // case eFACTION.Inquisition: + // txt2="##The Inquisition forces are difficult to bombard; "; + // bombard_protection=3; + // break; + case eFACTION.Ecclesiarchy: + txt2 = "##The Ecclesiarchy forces are concentrated within their Cathedral; "; + bombard_protection = 1; + break; // Maybe we should make it 0? Though, Cathedral does have a roof at least + case eFACTION.Eldar: + txt2="##The Eldar forces are challenging to pin down; "; + bombard_protection = 4; // Hi-tech faction + break; + case eFACTION.Ork: + txt2 = "##The Ork forces, for brutal savages, are well dug in; "; // TODO spice up descriptions with variable levels of protection + bombard_protection = 2; // TODO Make protection variable depending on leaders present + break; + case eFACTION.Tau: + txt2 = "##The Tau forces are well fortified; "; + bombard_protection = 3; // Hi-tech, but not as high as Eldar or Necrons + break; + case eFACTION.Tyranids: + txt2 = "##The Tyranid Swarm is a large target; "; + bombard_protection = 0; // TODO add considerations when it is a cult, and when it is bioforms out in the open + break; + case eFACTION.Chaos: + if (star.p_type[planet] = "Daemon") { + bombard_protection = 3; // Kind of irrelevant if the bombardment will be nulled later either way + txt2 = "##Reality warps and twists within the planet; "; + } else { + txt2 = "##The Chaos forces are suitably fortified; "; + bombard_protection = 2; + } + break; + case eFACTION.Necrons: + txt2="##The Necron forces are incredibly difficult to bombard; "; + bombard_protection = 4; // They are a hi-tech faction, so bombing them should be difficult + break; + } + + reduced_bombard_score = action_score / 3; + strength_reduction = 0; + + var i = reduced_bombard_score; + roll = 0; + + if (bombard_protection == 0) { // No protection, Nids out in the open use this + i=i*4; + } else if (bombard_protection == 1) { // Poor protection, PDF/Renegades and Ecclesiarchy use it, + i = i * 0.9; + } else if (bombard_protection == 2) { // Competent protection - IG, standard chaos forces and Orks + i = i * 0.75; + } else if (bombard_protection == 3) { // Hi-tech, Admech, Tau and Daemons kind of + i = i * 0.5; + } else if (bombard_protection == 4) { // Figured I add a level 4 to this, Ultra hi-tech, Necrons and Eldar + i = i * 0.34; + } + + for(var r=0;r<100;r++) { + if (i < 1) { + break; + } + i--; + strength_reduction++; + } + + if (i < 1) && (i >= 0.5) { + i=i * 100; + roll = irandom(100); + if (roll <= i) { + strength_reduction+=1; + } + } + + strength_reduction = round(strength_reduction); + txt2 += "they suffer"; + + if (bombard_target_faction == 10) && (star.p_type[planet] == "Daemon") { + strength_reduction=0; + } + + var rel = 0; + if (strength_reduction != 0) && (target_strength != 0) { + rel = ((target_strength - strength_reduction) / target_strength) * 100; + } else if (strength_reduction == 0){ + txt2 += " no losses from the bombardment."; + } + // Okay, I can see this needs tweaks, just, how can I make it that it checks for 3 conditions, instead of just 2? + // Would this work: + // if (rel>0 && rel<=20 && (target_strength-strength_reduction)>0){ + // txt2+=" minor losses from the bombardment, decreasing "+string(strength_reduction)+" stages."; + // ? + if ((target_strength - strength_reduction) <= 0){ + txt2+=" total annihilation from the bombardment and are wiped clean from the planet."; + } else { + var _losses_text = ""; + if (rel > 0 && rel <= 20) { + _losses_text = "minor losses"; + } else if (rel > 20 && rel <= 40) { + _losses_text = "moderate losses"; + } else if (rel > 40 && rel <= 60) { + _losses_text = "heavy losses"; + } else if (rel > 60 && (target_strength - strength_reduction) > 0) { + _losses_text = "devastating losses"; + } else { + _losses_text = "some losses"; + } + txt2 += $" {_losses_text} from the bombardment, having presence decreased by {strength_reduction}."; + } + + // 135; ? + if (bombard_target_faction >= 6){ + obj_controller.penitent_turn = 0; + obj_controller.penitent_turnly = 0; + } + + if (strength_reduction > 0) { + // Faction 2.5 being renegades, interesting + if (bombard_target_faction == 2.5) && (star.p_owner[planet] == eFACTION.Tau){ + var wib = "", wob = 0; + + txt2="##The renegade forces are poorly fortified; "; + + wob = action_score * 5000000 + choose(irandom(100000), irandom(100000) * -1); + + if (wob > star.p_pdf[planet]) { + wob = star.p_pdf[planet]; + } + + rel = (star.p_pdf[planet] / wob) * 100; + star.p_pdf[planet] -= wob; + + if (rel > 0) && (rel <= 20) { + txt2+=" they suffer minor losses from the bombardment, "+string(scr_display_number(wob))+" purged."; + } else if (rel > 20) && (rel <= 40) { + txt2+=" they suffer moderate losses from the bombardment, "+string(scr_display_number(wob))+" purged."; + } else if (rel > 40) && (rel <= 60) { + txt2+=" they suffer heavy losses from the bombardment, "+string(scr_display_number(wob))+" purged."; + } else if (rel > 60) && (star.p_pdf[planet] > 0) { + txt2+=" they suffer devastating losses from the bombardment, "+string(scr_display_number(wob))+" purged."; + } else if (wob > 0) && (star.p_pdf[planet] == 0) { + txt2+=" they suffer total annihilation from the bombardment && are wiped clean from the planet."; + } + } + + switch(bombard_target_faction) { + // case 1: + // star.p_marines[planet]-=strength_reduction; + // break; + // case 2: + // star.p_ig[planet]-=strength_reduction; + // break; + // case 3: + // star.p_mechanicus[planet]-=strength_reduction; + // break; + // case 4: + // star.p_inquisition[planet]-=strength_reduction; + // break; + case eFACTION.Ecclesiarchy: + star.p_sisters[planet] -= strength_reduction; + break; + case eFACTION.Eldar: + star.p_eldar[planet] -= strength_reduction; + break; + case eFACTION.Ork: + star.p_orks[planet] -= strength_reduction; + break; + case eFACTION.Tau: + star.p_tau[planet] -= strength_reduction; + break; + case eFACTION.Tyranids: + star.p_tyranids[planet] -= strength_reduction; + break; + case eFACTION.Chaos: + star.p_traitors[planet] -= strength_reduction; + break; + // case 11: + // star.p_csm[planet]-=strength_reduction; + // break; + // case 12: + // star.p_demons[planet]-=strength_reduction; + // break; + case eFACTION.Necrons: + star.p_necrons[planet] -= strength_reduction; + break; + } + } + } + } else { + var bombard_protection = 1; + txt1 = "Torpedoes and Bombardment Cannons rain hell upon the space hulk"; + + reduced_bombard_score = action_score / 1.25; // fraction of bombardment score, TODO maybe we should make SHs more vulnerable to bombardment? They are out in space, and can be targeted with other weapons + strength_reduction = 0; + txt3 = ""; + + var rel = 0; + + if (reduced_bombard_score != 0) { + rel = ((star.p_fortified[planet] - reduced_bombard_score) / star.p_fortified[planet]) * 100; + } + + if (strength_reduction == 0) { + txt2 = "it suffers minimal damage from the bombardment."; + } else if (rel > 0) && (rel <= 20) { + txt2 = "it suffers minor damage from the bombardment, its integrity reduced by {100-rel}%"; + } else if (rel > 20) && (rel <= 40) { + txt2 = "it suffers moderate damage from the bombardment, its integrity reduced by {100-rel}%"; + } else if (rel > 40) && (rel <= 60) { + txt2 = "it suffers heavy damage from the bombardment, its integrity reduced by {100-rel}%"; + } else if (rel > 60) && ((star.p_fortified[planet] - reduced_bombard_score) > 0) { + txt2 = "it suffers extensive damage from the bombardment, its integrity reduced by {100-rel}%"; + } else if ((star.p_fortified[planet] - reduced_bombard_score) <= 0) { + txt2 = "it crumbles apart from the onslaught. It is no more."; // Potential TODO Consider adding salvage from the bombed wreckage + } + + // DO EET + if (reduced_bombard_score > 0) { + star.p_fortified[planet] -= reduced_bombard_score; + } + + if (star.p_fortified[planet] <= 0){ + with(star) { instance_destroy(); } + instance_activate_object(obj_star_select); + with(obj_star_select) { instance_destroy(); } + obj_controller.sel_system_x = 0; + obj_controller.sel_system_y = 0; + obj_controller.popup = 0; + obj_controller.cooldown = 8; + } + } + var pip; + pip=instance_create(0, 0, obj_popup); + pip.title = "Bombard Results"; + pip.text = txt1 + txt2 + txt3; + } if (action_type=DropType.PurgeFire){// Burn baby burn var i=0; diff --git a/scripts/scr_roster/scr_roster.gml b/scripts/scr_roster/scr_roster.gml index bc6963ab28..4ebb21811d 100644 --- a/scripts/scr_roster/scr_roster.gml +++ b/scripts/scr_roster/scr_roster.gml @@ -414,14 +414,7 @@ function Roster() constructor{ for (var i=0;i