#include <define.h>

//#define NAME                    SCRIPT_

#include <command.h>
//#include <ModReact.h>



procedure start;
#include <push.h>
procedure point_run;

variable point;


procedure start
begin
	if ((script_action == look_at_proc) or (script_action == description_proc)) then begin
		script_overrides;
		display_msg(message_str(0, 100));
	end
	else begin
		if (script_action == use_proc) then begin
			call point_run;
		end
		else begin
			if (script_action == talk_proc) then begin
				script_overrides;
				call point_run;
			end
		end
	end
end

procedure point_run
begin
	variable LVar0 := 0;
	variable LVar1 := 0;
	variable LVar2 := 0;
	variable LVar3 := 0;
	variable LVar4 := 0;
	variable LVar5 := 0;
	LVar5 := random(1, 20) - random(5, 15);
	LVar4 := roll_vs_skill(dude_obj, 16, LVar5);
	LVar0 := random(1, 6) + random(1, 6);
	if (is_critical(LVar4)) then begin
		if (is_success(LVar4)) then begin
			display_msg(message_str(0, 101));
		end
		else begin
			display_msg(message_str(0, 102));
		end
	end
	else begin
		if ((LVar0 == 7) or (LVar0 == 11)) then begin
			display_msg(message_str(0, 103) + LVar0 + message_str(0, 104));
		end
		else begin
			if ((LVar0 == 2) or (LVar0 == 3) or (LVar0 == 12)) then begin
				display_msg(message_str(0, 105) + LVar0 + message_str(0, 106));
			end
			else begin
				while(not(LVar3)) do begin
					if (LVar2) then begin
						if ((LVar0 == 7) or (LVar0 == 11)) then begin
							LVar3 := 1;
							display_msg(message_str(0, 107) + LVar0 + message_str(0, 108));
						end
						else begin
							if (LVar0 == LVar1) then begin
								LVar3 := 1;
								display_msg(message_str(0, 109));
							end
							else begin
								LVar0 := random(1, 6) + random(1, 6);
							end
						end
					end
					else begin
						LVar2 := 1;
						LVar1 := LVar0;
						display_msg(message_str(0, 110) + LVar0 + message_str(0, 111));
					end
				end
			end
		end
	end
end