From cb7155298676266d4a024cac4103c8a83a621075 Mon Sep 17 00:00:00 2001 From: Magus Date: Sat, 20 Apr 2024 13:05:11 +0700 Subject: [PATCH] Sync with UPU: fixes for stat critical checks, ref https://github.com/BGforgeNet/Fallout2_Unofficial_Patch/issues/112 --- scripts_src/headers/command.h | 6 +++--- scripts_src/navarro/cimine.ssl | 12 ++++++------ scripts_src/raiders/iimine.ssl | 14 +++++++------- scripts_src/raiders/iipit.ssl | 16 ++++++++-------- scripts_src/sierra/wtlndmin.ssl | 4 ++-- scripts_src/template/spear_trap.ssl | 12 ++++++------ scripts_src/template/sprtrp0.ssl | 20 ++++++++++---------- scripts_src/template/wtpltrp.ssl | 16 ++++++++-------- 8 files changed, 50 insertions(+), 50 deletions(-) diff --git a/scripts_src/headers/command.h b/scripts_src/headers/command.h index 203588bc7e..6c6e4d8493 100644 --- a/scripts_src/headers/command.h +++ b/scripts_src/headers/command.h @@ -488,10 +488,10 @@ variable step_tile; * @ret {int} */ procedure roll_vs_stat(variable who, variable stat, variable mod) begin - variable rnd = random(1,100); - variable stat_check = do_check(who, stat, mod); + variable rnd = random(1, 100); + variable success = is_success(do_check(who, stat, mod)); // success - if stat_check then begin + if success then begin // critical if (rnd + (get_critter_stat(who, STAT_lu) - 5)) > 95 then return ROLL_CRITICAL_SUCCESS; else return ROLL_SUCCESS; diff --git a/scripts_src/navarro/cimine.ssl b/scripts_src/navarro/cimine.ssl index 3a7fb56923..dd3ff20461 100644 --- a/scripts_src/navarro/cimine.ssl +++ b/scripts_src/navarro/cimine.ssl @@ -236,14 +236,14 @@ procedure description_p_proc begin script_overrides; - if (local_var(LVAR_Got_Perception_Roll) == 0) then begin - set_local_var(LVAR_Got_Perception_Roll,1); - Perception_Roll:=do_check(dude_obj,STAT_pe,PERCEPTION_BONUS); - set_local_var(LVAR_Extended_Look,Perception_Roll); + if local_var(LVAR_Got_Perception_Roll) == 0 then begin + set_local_var(LVAR_Got_Perception_Roll, 1); + Perception_Roll = roll_vs_stat(dude_obj, STAT_pe, PERCEPTION_BONUS); + set_local_var(LVAR_Extended_Look, Perception_Roll); end - if (is_critical(local_var(LVAR_Extended_Look))) then begin - if (is_success(local_var(LVAR_Extended_Look))) then + if is_critical(local_var(LVAR_Extended_Look)) then begin + if is_success(local_var(LVAR_Extended_Look)) then display_msg(mstr(100)); else display_msg(mstr(106)); diff --git a/scripts_src/raiders/iimine.ssl b/scripts_src/raiders/iimine.ssl index 71d29f8366..33c2b4a81b 100644 --- a/scripts_src/raiders/iimine.ssl +++ b/scripts_src/raiders/iimine.ssl @@ -99,13 +99,13 @@ procedure spatial_p_proc begin Detection_Roll = roll_vs_stat(source_obj, STAT_pe, Range_Mod); - if (is_success(Detection_Roll)) then begin + if is_success(Detection_Roll) then begin set_local_var(LVAR_Trap_Found,1); reg_anim_clear(source_obj); Trap:=create_object_sid(ART_TRAP_VISIBLE,self_tile,self_elevation,CUR_SCRIPT); - if (is_critical(Detection_Roll)) then begin + if is_critical(Detection_Roll) then begin if (source_obj == dude_obj) then display_msg(mstr(100)); else if ((proto_data(obj_pid(source_obj),cr_body_type) == CR_BODY_BIPED) and (obj_can_see_obj(source_obj,dude_obj))) then @@ -239,13 +239,13 @@ procedure description_p_proc begin script_overrides; if (local_var(LVAR_Got_Perception_Roll) == 0) then begin - set_local_var(LVAR_Got_Perception_Roll,1); - Perception_Roll:=do_check(dude_obj,STAT_pe,PERCEPTION_BONUS); - set_local_var(LVAR_Extended_Look,Perception_Roll); + set_local_var(LVAR_Got_Perception_Roll, 1); + Perception_Roll = roll_vs_stat(dude_obj, STAT_pe, PERCEPTION_BONUS); + set_local_var(LVAR_Extended_Look, Perception_Roll); end - if (is_critical(local_var(LVAR_Extended_Look))) then begin - if (is_success(local_var(LVAR_Extended_Look))) then + if is_critical(local_var(LVAR_Extended_Look)) then begin + if is_success(local_var(LVAR_Extended_Look)) then display_msg(mstr(100)); else display_msg(mstr(106)); diff --git a/scripts_src/raiders/iipit.ssl b/scripts_src/raiders/iipit.ssl index d41091204b..654bb998b8 100644 --- a/scripts_src/raiders/iipit.ssl +++ b/scripts_src/raiders/iipit.ssl @@ -74,13 +74,13 @@ procedure spatial_p_proc begin Detection_Roll = roll_vs_stat(source_obj, STAT_pe, Range_Mod); - if (is_success(Detection_Roll)) then begin + if is_success(Detection_Roll) then begin set_local_var(LVAR_Trap_Found,1); reg_anim_clear(source_obj); Trap:=create_object_sid(ART_TRAP_VISIBLE,self_tile,self_elevation,CUR_SCRIPT); - if (is_critical(Detection_Roll)) then begin + if is_critical(Detection_Roll) then begin if (source_obj == dude_obj) then display_msg(mstr(101)); else if ((proto_data(obj_pid(source_obj),cr_body_type) == CR_BODY_BIPED) and (obj_can_see_obj(source_obj,dude_obj))) then @@ -110,7 +110,7 @@ procedure spatial_p_proc begin end Trap:=create_object(ART_TRAP_VISIBLE,self_tile,self_elevation); - display_msg( message_str( SCRIPT_IIPIT, 100 ) ); + display_msg( message_str( SCRIPT_IIPIT, 100 ) ); critter_dmg(source_obj,random(MIN_DMG,MAX_DMG),(DMG_normal_dam BWOR DMG_BYPASS_ARMOR BWOR DMG_NOANIMATE)); set_local_var(LVAR_Trap_Found,1); // Dump player in pits @@ -131,13 +131,13 @@ procedure description_p_proc begin script_overrides; if (local_var(LVAR_Got_Perception_Roll) == 0) then begin - set_local_var(LVAR_Got_Perception_Roll,1); - Perception_Roll:=do_check(dude_obj,STAT_pe,PERCEPTION_BONUS); - set_local_var(LVAR_Extended_Look,Perception_Roll); + set_local_var(LVAR_Got_Perception_Roll, 1); + Perception_Roll = roll_vs_stat(dude_obj, STAT_pe, PERCEPTION_BONUS); + set_local_var(LVAR_Extended_Look, Perception_Roll); end - if (is_critical(local_var(LVAR_Extended_Look))) then begin - if (is_success(local_var(LVAR_Extended_Look))) then + if is_critical(local_var(LVAR_Extended_Look)) then begin + if is_success(local_var(LVAR_Extended_Look)) then display_msg(mstr(101)); else display_msg(mstr(101)); diff --git a/scripts_src/sierra/wtlndmin.ssl b/scripts_src/sierra/wtlndmin.ssl index 6ba7c45c6e..c44fe20abf 100644 --- a/scripts_src/sierra/wtlndmin.ssl +++ b/scripts_src/sierra/wtlndmin.ssl @@ -223,13 +223,13 @@ procedure Trap_Detection begin Detection_Roll = roll_vs_stat(source_obj, STAT_pe, Range_Mod); - if (is_success(Detection_Roll)) then begin + if is_success(Detection_Roll) then begin set_local_var(LVAR_Trap_Found,1); reg_anim_clear(source_obj); Trap:=create_object_sid(ART_TRAP_VISIBLE,self_tile,self_elevation,CUR_SCRIPT); - if (is_critical(Detection_Roll)) then begin + if is_critical(Detection_Roll) then begin if (source_obj == dude_obj) then display_msg(mstr(100)); else if ((proto_data(obj_pid(source_obj),cr_body_type) == CR_BODY_BIPED) and (obj_can_see_obj(source_obj,dude_obj))) then diff --git a/scripts_src/template/spear_trap.ssl b/scripts_src/template/spear_trap.ssl index 87dad26df2..376e30f0cf 100644 --- a/scripts_src/template/spear_trap.ssl +++ b/scripts_src/template/spear_trap.ssl @@ -203,9 +203,9 @@ procedure description_p_proc begin script_overrides; if (local_var(LVAR_Got_Perception_Roll) == 0) then begin - set_local_var(LVAR_Got_Perception_Roll,1); - Perception_Roll:=do_check(dude_obj,STAT_pe,PERCEPTION_BONUS); - set_local_var(LVAR_Extended_Look,Perception_Roll); + set_local_var(LVAR_Got_Perception_Roll, 1); + Perception_Roll = roll_vs_stat(dude_obj, STAT_pe, PERCEPTION_BONUS); + set_local_var(LVAR_Extended_Look, Perception_Roll); end if (is_critical(local_var(LVAR_Extended_Look))) then begin @@ -231,11 +231,11 @@ procedure timed_event_p_proc begin end procedure Check_Hit begin - variable Agility_Roll; + variable Agility_Check; - Agility_Roll:=do_check(source_obj,STAT_ag,AGILITY_BONUS); + Agility_Check = do_check(source_obj, STAT_ag, AGILITY_BONUS); - if (is_success(Agility_Roll)) then begin + if is_success(Agility_Check) then begin if (source_obj == dude_obj) then display_msg(mstr(104)); else diff --git a/scripts_src/template/sprtrp0.ssl b/scripts_src/template/sprtrp0.ssl index 4e2a10bb10..222849bc84 100644 --- a/scripts_src/template/sprtrp0.ssl +++ b/scripts_src/template/sprtrp0.ssl @@ -96,13 +96,13 @@ procedure spatial_p_proc begin Detection_Roll = roll_vs_stat(source_obj, STAT_pe, Range_Mod); - if (is_success(Detection_Roll)) then begin + if is_success(Detection_Roll) then begin set_local_var(LVAR_Trap_Found,1); reg_anim_clear(source_obj); Trap:=create_object_sid(ART_TRAP_VISIBLE,self_tile,self_elevation,CUR_SCRIPT); - if (is_critical(Detection_Roll)) then begin + if is_critical(Detection_Roll) then begin if (source_obj == dude_obj) then display_msg(mstr(100)); else if ((proto_data(obj_pid(source_obj),cr_body_type) == CR_BODY_BIPED) and (obj_can_see_obj(source_obj,dude_obj))) then @@ -218,13 +218,13 @@ procedure description_p_proc begin script_overrides; if (local_var(LVAR_Got_Perception_Roll) == 0) then begin - set_local_var(LVAR_Got_Perception_Roll,1); - Perception_Roll:=do_check(dude_obj,STAT_pe,PERCEPTION_BONUS); - set_local_var(LVAR_Extended_Look,Perception_Roll); + set_local_var(LVAR_Got_Perception_Roll, 1); + Perception_Roll = roll_vs_stat(dude_obj, STAT_pe, PERCEPTION_BONUS); + set_local_var(LVAR_Extended_Look, Perception_Roll); end - if (is_critical(local_var(LVAR_Extended_Look))) then begin - if (is_success(local_var(LVAR_Extended_Look))) then + if is_critical(local_var(LVAR_Extended_Look)) then begin + if is_success(local_var(LVAR_Extended_Look)) then display_msg(mstr(100)); else display_msg(mstr(106)); @@ -246,11 +246,11 @@ procedure timed_event_p_proc begin end procedure Check_Hit begin - variable Agility_Roll; + variable Agility_Check; - Agility_Roll:=do_check(source_obj,STAT_ag,AGILITY_BONUS); + Agility_Check= do_check(source_obj, STAT_ag, AGILITY_BONUS); - if (is_success(Agility_Roll)) then begin + if is_success(Agility_Check) then begin if (source_obj == dude_obj) then display_msg(mstr(104)); else diff --git a/scripts_src/template/wtpltrp.ssl b/scripts_src/template/wtpltrp.ssl index 7f3e53fa16..74defe5350 100644 --- a/scripts_src/template/wtpltrp.ssl +++ b/scripts_src/template/wtpltrp.ssl @@ -212,13 +212,13 @@ procedure description_p_proc begin script_overrides; if (local_var(LVAR_Got_Perception_Roll) == 0) then begin - set_local_var(LVAR_Got_Perception_Roll,1); - Perception_Roll:=do_check(dude_obj,STAT_pe,PERCEPTION_BONUS); - set_local_var(LVAR_Extended_Look,Perception_Roll); + set_local_var(LVAR_Got_Perception_Roll, 1); + Perception_Roll = roll_vs_stat(dude_obj, STAT_pe, PERCEPTION_BONUS); + set_local_var(LVAR_Extended_Look, Perception_Roll); end - if (is_critical(local_var(LVAR_Extended_Look))) then begin - if (is_success(local_var(LVAR_Extended_Look))) then + if is_critical(local_var(LVAR_Extended_Look)) then begin + if is_success(local_var(LVAR_Extended_Look)) then display_msg(mstr(100)); else display_msg(mstr(106)); @@ -240,11 +240,11 @@ procedure timed_event_p_proc begin end procedure Check_Hit begin - variable Agility_Roll; + variable Agility_Check; - Agility_Roll:=do_check(source_obj,STAT_ag,AGILITY_BONUS); + Agility_Check = do_check(source_obj, STAT_ag, AGILITY_BONUS); - if (is_success(Agility_Roll)) then begin + if is_success(Agility_Check) then begin if (source_obj == dude_obj) then display_msg(mstr(104)); else