Scriptname _00E_A1_ShadowtongueOilPoolSC extends ObjectReference  

;=====================================================================================
;              							EVENTS                  					 
;=====================================================================================

Auto State Waiting

	Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)		; Duplicate OnHIt and OnDestructionStageChanged Event to make sure that these events trigger InAir aswell.

		If (_00E_ExplosiveBarrel_ValidSources.HasForm(akSource)) || (akSource.HasKeyword(MagicDamageFire)) || ((_00E_ExplosiveBarrel_ValidSources.HasForm(akProjectile)))

			If akProjectile == _00E_A1_FireArrow_ProjectileL01

				If _00E_Synergy_OilFireArrow.GetValueInt() == 0
					_00E_Synergy_OilFireArrow.SetValueInt(1) 
					Levelsystem.ShowSynergyMessage()
				EndIf

			EndIf

			Self.DamageObject(100)
			GuiltActor = akAggressor

		EndIf

	EndEvent

	Event OnDestructionStageChanged(Int aiOldStage, Int aiCurrentStage) 

		If aiCurrentStage == 1
			Enflame(GuiltActor)
		EndIf

	EndEvent

EndState

State DoNothing

	Event OnUpdate()

		OilLight.Disable(True)

	EndEvent

EndState

;=====================================================================================
;              							FUNCTIONS                  					 
;=====================================================================================


Function Enflame(ObjectReference CauseActor)

	Self.setActorCause(causeActor as actor)
	Self.PlaceAtMe(_00E_A1_ShadowtongueOilPoolExp)
	OilLight = Self.PlaceAtMe(FireLightOilTrapHazard, 1)
	RegisterForSingleUpdate(25)
	goToState("DoNothing")
	
EndFunction

;=====================================================================================
;              							PROPERTIES                  					 
;=====================================================================================

_00E_QuestFunctions Property Levelsystem Auto

GlobalVariable Property _00E_Synergy_OilFireArrow Auto 

Projectile Property _00E_A1_FireArrow_ProjectileL01 Auto

ObjectReference GuiltActor
ObjectReference OilLight

Formlist Property _00E_ExplosiveBarrel_ValidSources Auto

Keyword Property MagicDamageFire Auto

Light Property FireLightOilTrapHazard Auto

Explosion Property _00E_A1_ShadowtongueOilPoolExp Auto