IF
	Global("CuChoinneachLeaves","GLOBAL",2)
THEN
	RESPONSE #100
		DestroySelf()
		Continue()
END

IF
	!Exists("CuChoinneach")
THEN
	RESPONSE #100
		DestroySelf()
		Continue()
END

IF
	Dead("CuChoinneach")
	!Exists(NearestEnemyOf(Myself))
THEN
	RESPONSE #100
		ForceSpell(Myself,INNATE_INVISIBILITY)
		Wait(5)
		DestroySelf()
		Continue()
END

IF
	!InParty("CuChoinneach")
	Allegiance("CuChoinneach",ENEMY)
THEN
	RESPONSE #100
		Enemy()
		EquipMostDamagingMelee()
		AttackReevaluate(LastTargetedBy("CuChoinneach"),30)
		Continue()
END

IF
	Detect([ENEMY])
	StateCheck([ENEMY],STATE_INVISIBLE)
	HaveSpell(PURGE_INVISIBILITY)
THEN
	RESPONSE #100
		Spell(Myself,PURGE_INVISIBILITY)
		Continue()
END

IF
	See([ENEMY])
	NumCreatureGT([ENEMY],5)
	HaveSpell(INNATE_ENTANGLE)
THEN
	RESPONSE #20
		Spell(NearestEnemyOf(Myself),INNATE_ENTANGLE)
		Continue()
END

IF
	HitBy([ANYONE],POISON)
THEN
	RESPONSE #100
		Shout(1)
		Continue()
END

IF
	HPPercentLT(Myself,35)
	HaveSpell(INNATE_CURE_LIGHT_WOUNDS)
THEN
	RESPONSE #100
		Spell(Myself,INNATE_CURE_LIGHT_WOUNDS)
		Continue()
END

IF
	Delay(2)
	HPPercentLT(Myself,35)
THEN
	RESPONSE #95
		Shout(2)
		Continue()
	RESPONSE #5
		VerbalConstant(Myself,HURT)
		Shout(2)
		Continue()
		Continue()
END

IF
	Heard([PC],2)
	HaveSpell(INNATE_CURE_LIGHT_WOUNDS)
THEN
	RESPONSE #100
		Spell(LastHeardBy(Myself),INNATE_CURE_LIGHT_WOUNDS)
		Continue()
END

IF
	AttackedBy([ANYONE],DEFAULT)
	InParty(LastAttackerOf(Myself))
	StateCheck(LastAttackerOf(Myself),STATE_CHARMED)
THEN
	RESPONSE #100
		RunAwayFrom(LastAttackerOf(Myself),75)
		Continue()
END

IF
	AttackedBy([ANYONE],DEFAULT)
	InParty(LastAttackerOf(Myself))
	!StateCheck(LastAttackerOf(Myself),STATE_CHARMED)
THEN
	RESPONSE #100
		Shout(3)
		EquipMostDamagingMelee()
		AttackReevaluate(LastAttackerOf(Myself),30)
		Continue()
END

IF
	AttackedBy([ENEMY],DEFAULT)
	Range(LastAttackerOf(Myself),5)
	!StateCheck(LastAttackerOf(Myself),STATE_PANIC)
THEN
	RESPONSE #100
		Shout(3)
		EquipMostDamagingMelee()
		AttackReevaluate(LastAttackerOf(Myself),30)
		Continue()
END

IF
	Heard([PC],3)
	See(LastAttackerOf(LastHeardBy(Myself)))
	!InParty(LastAttackerOf(LastHeardBy(Myself)))
	Range(LastAttackerOf(LastHeardBy(Myself)),5)
	!StateCheck(LastAttackerOf(LastHeardBy(Myself)),STATE_PANIC)
THEN
	RESPONSE #100
		EquipMostDamagingMelee()
		AttackReevaluate(LastAttackerOf(LastHeardBy(Myself)),30)
		Continue()
END

IF
	See([ENEMY])
	!InParty([ENEMY])
	Range([ENEMY],5)
	!StateCheck([ENEMY],STATE_PANIC)
THEN
	RESPONSE #100
		Shout(4)
		EquipMostDamagingMelee()
		AttackReevaluate([ENEMY],30)
		Continue()
END

IF
	Heard([PC],4)
	See(LastTargetedBy(LastHeardBy(Myself)))
	!InParty(LastTargetedBy(LastHeardBy(Myself)))
	Range(LastTargetedBy(LastHeardBy(Myself)),5)
	!StateCheck(LastTargetedBy(LastHeardBy(Myself)),STATE_PANIC)
THEN
	RESPONSE #100
		EquipMostDamagingMelee()
		AttackReevaluate(LastTargetedBy(LastHeardBy(Myself)),30)
		Continue()
END

IF
	!See([ENEMY])
	Help([PC])
	!Range(LastHelp(Myself),5)
THEN
	RESPONSE #100
		MoveToObject(LastHelp(Myself))
		Continue()
END

IF
	HPPercentLT("CuChoinneach",50)
	Exists(LastAttackerOf("CuChoinneach"))
THEN
	RESPONSE #100
		AttackReevaluate(LastAttackerOf("CuChoinneach"),10)
		Continue()
END

IF
	Exists("CuChoinneach")
	Global("ShadowWolf","GLOBAL",2)
	Global("ShadowWolfClaw","GLOBAL",0)
THEN
	RESPONSE #100
		ForceSpell(Myself,THE_SHADOW_WOLF)
		SetGlobal("ShadowWolfClaw","GLOBAL",1)
		SetGlobal("GrowlEvil","GLOBAL",0)
		Continue()
END

IF
	Exists("CuChoinneach")
	!Exists(NearestEnemyOf(Myself))
THEN
	RESPONSE #100
		Formation("CuChoinneach",[2.2])
		Continue()
END

IF
	!Exists(NearestEnemyOf(Myself))
	!Range("CuChoinneach",10)
	Delay(10)
THEN
	RESPONSE #100
		DestroySelf()
		SetGlobal("ShadowWolfClaw","GLOBAL",0)
		SetGlobal("ShadowWolf","GLOBAL",1)
		Continue()
END

IF
	Die()
THEN
	RESPONSE #100
		ReallyForceSpell(Myself,INNATE_INVISIBILITY)
		Wait(5)
		DestroySelf()
		SetGlobalTimer("ShadowWolfDie","GLOBAL",ONE_DAY)
		Continue()
END


