class MeanZombieHusk extends NiceZombieHusk;
#exec OBJ LOAD FILE=NicePackT.utx
var int consecutiveShots, totalShots, maxNormalShots;

function DoStun(optional Pawn instigatedBy, optional Vector hitLocation, optional Vector momentum, optional class<NiceWeaponDamageType> damageType, optional float headshotLevel, optional KFPlayerReplicationInfo KFPRI){
    super.DoStun(instigatedBy, hitLocation, momentum, damageType, headshotLevel, KFPRI);
    totalShots = maxNormalShots;
}

function RangedAttack(Actor A) {
    local int LastFireTime;
    if ( bShotAnim )
       return;
    if ( Physics == PHYS_Swimming ) {
       SetAnimAction('Claw');
       bShotAnim = true;
       LastFireTime = Level.TimeSeconds;
    }
    else if ( VSize(A.Location - Location) < MeleeRange + CollisionRadius + A.CollisionRadius ) {
       bShotAnim = true;
       LastFireTime = Level.TimeSeconds;
       SetAnimAction('Claw');
       //PlaySound(sound'Claw2s', SLOT_Interact); KFTODO: Replace this
       Controller.bPreparingMove = true;
       Acceleration = vect(0,0,0);
    }
    else if((KFDoorMover(A) != none ||
       (!Region.Zone.bDistanceFog && VSize(A.Location-Location) <= 65535) ||
       (Region.Zone.bDistanceFog && VSizeSquared(A.Location-Location) < (Square(Region.Zone.DistanceFogEnd) * 0.8)))  // Make him come out of the fog a bit
       && !bDecapitated && Physics != PHYS_Falling) {
       bShotAnim = true;

       SetAnimAction('ShootBurns');
       Controller.bPreparingMove = true;
       Acceleration = vect(0,0,0);

       //Increment the number of consecutive shtos taken and apply the cool down if needed
       totalShots ++;
       consecutiveShots ++;
       if(consecutiveShots < 3 && totalShots > maxNormalShots && VSize(a.location - location) <= 900)
           NextFireProjectileTime = Level.TimeSeconds;
       else{
           NextFireProjectileTime = Level.TimeSeconds + ProjectileFireInterval + (FRand() * 2.0);
           consecutiveShots = 0;
       }
    }
}
defaultproperties
{
    maxNormalShots=3
    AmmunitionClass=class'MeanZombieHuskAmmo'
    remainingStuns=1
    MenuName="Mean Husk"
    ControllerClass=class'MeanZombieHuskController'
    Skins(0)=Texture'NicePackT.MonsterMeanHusk.burns_tatters'
    Skins(1)=Shader'NicePackT.MonsterMeanHusk.burns_shdr'
}
