Skip to content

Commit

Permalink
Sync with UPU: fixes for stat critical checks, ref BGforgeNet/Fallout…
Browse files Browse the repository at this point in the history
  • Loading branch information
burner1024 committed Apr 20, 2024
1 parent df249be commit cb71552
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 50 deletions.
6 changes: 3 additions & 3 deletions scripts_src/headers/command.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions scripts_src/navarro/cimine.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
14 changes: 7 additions & 7 deletions scripts_src/raiders/iimine.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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));
Expand Down
16 changes: 8 additions & 8 deletions scripts_src/raiders/iipit.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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));
Expand Down
4 changes: 2 additions & 2 deletions scripts_src/sierra/wtlndmin.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions scripts_src/template/spear_trap.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
20 changes: 10 additions & 10 deletions scripts_src/template/sprtrp0.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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));
Expand All @@ -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
Expand Down
16 changes: 8 additions & 8 deletions scripts_src/template/wtpltrp.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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
Expand Down

0 comments on commit cb71552

Please sign in to comment.