/////////////////////////////////////////////////////////////////////
// ROCKPASS.S
/////////////////////////////////////////////////////////////////////

SETUP

	IF !gt_CLEAR_MINES && mj_FREED_FARMERS
		Add gt_CLEAR_MINES
	ENDIF

    IDoorLocked hrpass_1
    IDoorLocked hrpass_2

	IF mj_DEFEAT_GARGOS_2

		// *** STAGE 3 SETUP ***

		IF !gt_PLACED_THARD_HRPASS

			Add gt_PLACED_THARD_HRPASS

			KillC THARD_VAN_6
			KillC THARD_VAN_7
			KillC THARD_VAN_8

			KillC HR_BRIG_01
			KillC HR_BRIG_02
			KillC HR_BRIG_03
			KillC HR_BRIG_04
			KillC HR_BRIG_05
			KillC HR_BRIG_06
			KillC HR_BRIG_07
			KillC HR_BRIG_08
			KillC HR_BRIG_09
			KillC HR_BRIG_10
			KillC HR_BRIG_11

			KillC HR_FARMER_1
			KillC HR_FARMER_2
			KillC HR_FARMER_3
			KillC HR_FARMER_4
			KillC HR_FARMER_5

			IDoorOpen hrpass_1
			IDoorOpen hrpass_2

		ENDIF
	ELSE
		IF mj_FOUND_BLOODMASTER

			// *** STAGE 2 SETUP ***

			IF !gt_PLACED_THARD_VAN_6
				Add gt_PLACED_THARD_VAN_6
				PlaceC THARD_VAN_6 pVAN_6
				Wander THARD_VAN_6
				SwitchOnSightOfPlayer THARD_VAN_6 AttackDemo2
				PlaceC THARD_VAN_7 pVAN_7
				Wander THARD_VAN_7
				SwitchOnSightOfPlayer THARD_VAN_7 AttackDemo2
				PlaceC THARD_VAN_8 pVAN_8
				Wander THARD_VAN_8
				SwitchOnSightOfPlayer THARD_VAN_8 AttackDemo2

				KillC HR_BRIG_01
				KillC HR_BRIG_02
				KillC HR_BRIG_03
				KillC HR_BRIG_04
				KillC HR_BRIG_05
				KillC HR_BRIG_06
				KillC HR_BRIG_07
				KillC HR_BRIG_08
				KillC HR_BRIG_09
				KillC HR_BRIG_10
				KillC HR_BRIG_11

				KillC HR_FARMER_1
				KillC HR_FARMER_2
				KillC HR_FARMER_3
				KillC HR_FARMER_4
				KillC HR_FARMER_5
			ENDIF
		ELSE
			IF  mj_HEX_COMPASS

				// *** STAGE 1 SETUP ***

				IDoorOpen hrpass_1
				IDoorOpen hrpass_2

				IF !gd_PLACED_HR_PASS_BRIG
					Add gd_PLACED_HR_PASS_BRIG

					PlaceC HR_BRIG_01 pHR_BRIG_01
					AddControl  HR_BRIG_01  MoveC   pHR_BRIG_01
					AddControl  HR_BRIG_01  MoveC   pHR_BRIG_01B
					SequenceLoops   HR_BRIG_01
					SwitchOnSightOfPlayer   HR_BRIG_01   SetScriptFlagControl   gd_BRIG_01_FOUND_P
					AddFilter HR_BRIG_01 CompletesOnDamaged
					AddControl HR_BRIG_01 AttackDemo2

					PlaceC HR_BRIG_02 pHR_BRIG_02
					AddControl  HR_BRIG_02   Capture cM_GUARD_STAND1
					AddControl  HR_BRIG_02   Capture cM_GUARD_STAND2
					AddControl  HR_BRIG_02   Capture cM_GUARD_STAND3
					SequenceRandomlySelects   HR_BRIG_02
					SwitchOnSightOfPlayer   HR_BRIG_02   AttackDemo2

					PlaceC HR_BRIG_03 pHR_BRIG_03
					AddControl  HR_BRIG_03   Capture cM_GUARD_STAND1
					AddControl  HR_BRIG_03   Capture cM_GUARD_STAND2
					AddControl  HR_BRIG_03   Capture cM_GUARD_STAND3
					SequenceRandomlySelects   HR_BRIG_03
					SwitchOnSightOfPlayer   HR_BRIG_03   SetScriptFlagControl   gd_BRIG_03_FOUND_P
					AddFilter HR_BRIG_03 CompletesOnDamaged
					AddControl HR_BRIG_03 AttackDemo2

					PlaceC HR_BRIG_04 pHR_BRIG_04
					AddControl  HR_BRIG_04	Capture cM_TALK_THREATEN1
					AddControl  HR_BRIG_04	Capture cM_TALK_WARNING1
					AddControl  HR_BRIG_04	Capture cM_TALK_WARNING2
					SequenceRandomlySelects	HR_BRIG_04
					AddFilter	HR_BRIG_04	FilterToStart
					//AddFilter   HR_BRIG_04  KeepPositionD   pHR_BRIG_04
					//Lock        HR_BRIG_04

					SWITCH RAND-3
						CASE 0
							PlaceC HR_BRIG_05 pHR_BRIG_05A
						CASE 1
							PlaceC HR_BRIG_05 pHR_BRIG_05B
						CASE 2
							PlaceC HR_BRIG_05 pHR_BRIG_05C
					ENDSWITCH
					AddControl  HR_BRIG_05   Capture cM_GUARD_STAND1
					AddControl  HR_BRIG_05   Capture cM_GUARD_STAND2
					AddControl  HR_BRIG_05   Capture cM_GUARD_STAND3
					SequenceRandomlySelects   HR_BRIG_05
					SwitchOnSightOfPlayer   HR_BRIG_05   AttackDemo2

					PlaceC HR_BRIG_06 pHR_BRIG_06
					RestrictedWanderButAttackOnSight    HR_BRIG_06

					PlaceC HR_BRIG_07 pHR_BRIG_07
					AddControl  HR_BRIG_07   Capture cM_GUARD_STAND1
					AddControl  HR_BRIG_07   Capture cM_GUARD_STAND2
					AddControl  HR_BRIG_07   Capture cM_GUARD_STAND3
					SequenceRandomlySelects   HR_BRIG_07
					SwitchOnSightOfPlayer   HR_BRIG_07   AttackDemo2

					PlaceC HR_BRIG_08 pHR_BRIG_08
					AttackDemo2 HR_BRIG_08
					PlaceC HR_BRIG_09 pHR_BRIG_09
					AttackDemo2 HR_BRIG_09

					PlaceC HR_BRIG_10 pHR_BRIG_10
					RestrictedWanderButAttackOnSight    HR_BRIG_10

					PlaceC HR_BRIG_11 pHR_BRIG_11
					RestrictedWanderButAttackOnSight    HR_BRIG_11

					PlaceC HR_FARMER_1 pCAP_FARM_1
					PlaceC HR_FARMER_2 pCAP_FARM_2
					PlaceC HR_FARMER_3 pCAP_FARM_3
					PlaceC HR_FARMER_4 pCAP_FARM_4
					PlaceC HR_FARMER_5 pCAP_FARM_5

					Add gt_CUE_DEAD_HRP
					//Capture     HR_FARMER_1    cM_FALL_N_DIE_DIE_DIE1
					//Capture     HR_FARMER_2    cM_FALL_N_DIE_DIE_DIE2
					//Capture     HR_FARMER_3    cM_FALL_N_DIE_DIE_DIE2
					//Capture     HR_FARMER_4    cM_FALL_N_DIE_DIE_DIE1

					AddControl  HR_FARMER_5   Capture cM_TALK_CREEP_BEG1
					AddControl  HR_FARMER_5   Capture cM_TALK_CREEP_BEG2
					AddControl  HR_FARMER_5   Filter Timeout 2 LookAtTurnFollow HR_BRIG_04
					SequenceRandomlySelects   HR_FARMER_5
					Lock        HR_FARMER_5

				ENDIF
			ENDIF
		ENDIF
	ENDIF

	IF gt_PLACED_THARD_HRPASS
		Set	gd_WEATHER_TYPE	3

		//Set gd_WIND_TYPE	6
		Set gd_WIND_TYPE	3
	ELSE
		Set	gd_WEATHER_TYPE	0

		//Set gd_WIND_TYPE	6
		Set gd_WIND_TYPE	3
	ENDIF
END

VIG TempSetup FALSE

    RunS CueWeather

END

/////////////////////////////////////////////////////////////////////

VIG KillFarmers gt_CUE_DEAD_HRP

	Remove gt_CUE_DEAD_HRP

	SamplesOff
	SetHP			HR_FARMER_1 1
	NormalDamageNA	HR_FARMER_1 12
	SetHP			HR_FARMER_2 1
	NormalDamageNA	HR_FARMER_2 14
	SetHP			HR_FARMER_3 1
	NormalDamageNA	HR_FARMER_3 16
	SetHP			HR_FARMER_4 1
	NormalDamageNA	HR_FARMER_4 18
	SamplesOn
	IF gd_PLACED_RC_MONSTERS
		Add gd_HR_BRIG_04
		SetHP			HR_FARMER_5 1
		NormalDamageNA	HR_FARMER_5 18
	ENDIF

END

/////////////////////////////////////////////////////////////////////

VIG HR_Brig_01_Attack    ONESEC && mj_HEX_COMPASS && !ISDEAD-HR_BRIG_01 && !gd_HR_BRIG_01 && gd_BRIG_01_FOUND_P
    Add         gd_HR_BRIG_01
    AttackDemo2 HR_BRIG_01
    IF          !ISDEAD-HR_BRIG_02 && DISTFROM-HR_BRIG_01-HR_BRIG_02-8
        AttackDemo2 HR_BRIG_02
    ENDIF
    IF          !ISDEAD-HR_BRIG_03 && DISTFROM-HR_BRIG_01-HR_BRIG_03-8
        AttackDemo2 HR_BRIG_03
    ENDIF
END

/////////////////////////////////////////////////////////////////////

VIG HR_Brig_03_Attack    ONESEC && mj_HEX_COMPASS && !ISDEAD-HR_BRIG_03 && !gd_HR_BRIG_03 && (INAREA-P-hr_near_brig_03 || gd_BRIG_03_FOUND_P)
    Add         gd_HR_BRIG_03
    AttackDemo2 HR_BRIG_03
    IF          !ISDEAD-HR_BRIG_01 && DISTFROM-HR_BRIG_03-HR_BRIG_01-8
        AttackDemo2 HR_BRIG_01
    ENDIF
END

/////////////////////////////////////////////////////////////////////

VIG HR_Brig_04_Nasty    ONESEC && mj_HEX_COMPASS && !gd_HR_BRIG_04 && (DAMAGED-HR_BRIG_04 || INAREA-P-hr_near_brig_04 || DISTFROM-P-HR_BRIG_04-12)

	Add         gd_HR_BRIG_04

	IF ISDEAD-HR_BRIG_04 

	    SetHP			HR_FARMER_5	1
		NormalDamageNA HR_FARMER_5 5

	ELSE

		widescreen TRUE

		FreezeC HR_BRIG_01
		FreezeC HR_BRIG_02
		FreezeC HR_BRIG_03
		FreezeC HR_BRIG_05
		FreezeC HR_BRIG_06
		FreezeC HR_BRIG_07
		FreezeC HR_BRIG_08
		FreezeC HR_BRIG_09
		FreezeC HR_BRIG_10
		FreezeC HR_BRIG_11

		Campan      HR_FARMER_5
		Unlock      HR_BRIG_04
		Unlock      HR_FARMER_5
		StopC       P
		LookAtTurnFollow HR_FARMER_5 HR_BRIG_04
		StopC       HR_BRIG_04

		Wait 1000
		Capture     HR_FARMER_5 cM_TALK_CREEP_BEG1
		Wait        500
		Capture     HR_BRIG_04  cM_TALK_THREATEN1

		UUComplete  HR_BRIG_04
		UUComplete  HR_FARMER_5

		MeleeAttack HR_BRIG_04

		SetHP			HR_FARMER_5	1

		WHILE !ISDEAD-HR_FARMER_5
			IF ISDEAD-HR_BRIG_04 
				NormalDamageNA HR_FARMER_5 5
			ENDIF
			Wait 250
		ENDWHILE

		LookAtTurn  HR_BRIG_04  P
		UUComplete  HR_BRIG_04
		Capture     HR_BRIG_04  cM_COME_HERE
		UUComplete  HR_BRIG_04
		GiveSightOfPlayerTo HR_BRIG_04
		AttackDemo2 HR_BRIG_04

		Camcut      P

		UnfreezeC HR_BRIG_01
		UnfreezeC HR_BRIG_02
		UnfreezeC HR_BRIG_03
		UnfreezeC HR_BRIG_05
		UnfreezeC HR_BRIG_06
		UnfreezeC HR_BRIG_07
		UnfreezeC HR_BRIG_08
		UnfreezeC HR_BRIG_09
		UnfreezeC HR_BRIG_10
		UnfreezeC HR_BRIG_11

		widescreen FALSE

	ENDIF

END

/////////////////////////////////////////////////////////////////////

VIG RandomShouting FALSE 
//TENSEC && mj_DEFEAT_GARGOS_2

	SWITCH RAND-10
		CASE 1
			Say ds0008 DWARREVL.BIN
		CASE 2
			Say ds0009 DWARREVL.BIN
		CASE 3
			Say ds0011 DWARREVL.BIN
		CASE 4
			Say ds0012 DWARREVL.BIN
		CASE 5
			Say ds0013 DWARREVL.BIN
		CASE 6
		CASE 7
		CASE 8
		CASE 9
		CASE 10
	ENDSWITCH

END

/////////////////////////////////////////////////////////////////////
