#include <define.h>

//#define NAME                    SCRIPT_

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



procedure start;
#include <push.h>
procedure pickup_p_proc;
procedure use_skill_on_p_proc;

variable Test;


procedure start
begin
	if (script_action == use_skill_on_proc) then begin
		call use_skill_on_p_proc;
	end
	else begin
		if (script_action == pickup_proc) then begin
			call pickup_p_proc;
		end
	end
end

procedure pickup_p_proc
begin
	call use_skill_on_p_proc;
end

procedure use_skill_on_p_proc
begin
	if (global_var(GVAR_ENEMY_BROTHERHOOD) == 0) then begin
		Test := roll_vs_skill(dude_obj, 10, 0);
		if (action_being_used == 10) then begin
			if (not(is_success(Test))) then begin
				script_overrides;
				if (is_critical(Test)) then begin
					set_global_var(GVAR_ENEMY_BROTHERHOOD, 1);
					display_msg(message_str(SCRIPT_GENCHAT, 181));
				end
				else begin
					set_local_var(0, local_var(0) + 1);
					if (local_var(0) > 2) then begin
						set_global_var(GVAR_ENEMY_BROTHERHOOD, 1);
						display_msg(message_str(SCRIPT_GENCHAT, 181));
					end
					else begin
						display_msg(message_str(SCRIPT_GENCHAT, 180));
					end
				end
			end
		end
	end
end