{$I HKS_SaveCData.script}

{.$DEFINE FEED}
{.$DEFINE RES_HOUSES}
{.$DEFINE PATROL}
{.$DEFINE DIFFICULTY}
{.$DEFINE REBUILD}
{.$DEFINE ANIMATION}
{$DEFINE HERO}

{$I HKS_Functions.script}

procedure OnUnitWounded(aUnit, aAttacker : Integer);
var UU : KD_UnitStats;
	IsAttacker : Boolean;
begin
	If not SetUnit(aUnit, UU) then 
		If not SetUnit(aAttacker, UU) then 
			Exit
		else
			IsAttacker := true;
		
	If UU.Owner <> PLAYER then 
		Exit;
	If IsAttacker then 
	begin
		If aAttacker <> aHeros[0].ID then 
			If PointNearPoint(UU.aPos, aHeros[0].Pos, 5) then 
				If GChance(50) then 			
					A.UnitHPChange(aUnit, -1);
		Exit;
	end;
	If aUnit <> aHeros[0].ID then 
		If PointNearPoint(UU.aPos, aHeros[0].Pos, 5) then 
			If GChance(50) then 
				A.UnitHPChange(aUnit, 1);
				
		
end;
Procedure OnTick;
begin
	OnTickHero;
	If GT = 10 then 
		A.CinematicPanTo(PLAYER, 23, 14, 100);
		
		
	If GT = 130 then 
		A.CinematicEnd(PLAYER);
end;

procedure OnMissionStart;
begin
	AddOvMessage(1, 10);
        AddOvMessage(2, 70);
        AddOvMessage(3, 100);
        AddOvMessage(4, 160);
        AddOvMessage(5, 210);
	A.CinematicStart(PLAYER);

	AddHero(S.GroupAt(89,42));
	SetHeroStats(11, 43, 214, 8, 4, 0, hcNicholas);
end;