class MeanBleedInventory extends Inventory;


const dmtype_bleed=class'NiceDamTypeStalkerBleed';
var int maxBleedCount;
var private float fBleedPeriod;

var int bleedLevel;
var MeanZombieStalker stalker;


event PostBeginPlay()
{
    super.PostBeginPlay();
    // start the timer
    SetTimer(fBleedPeriod, true);
}


event Timer()
{
    local pawn locpawn;
    local bool amAlive;
    local int bleedDamage;

    locpawn = Pawn(Owner);
    amAlive = locpawn != none && locpawn.Health > 0;

    bleedDamage = bleedLevel * 7;
    // if pawn owner is dead or bleed count is done - destroy
    if (!amAlive || maxBleedCount < 0 || bleedDamage < 1.0)
    {
        Destroy();
        return;
    }

    maxBleedCount--;

    if (stalker != none)
        locpawn.TakeDamage(bleedDamage, stalker, locpawn.Location, 
                   vect(0, 0, 0), dmtype_bleed);
    else
        locpawn.TakeDamage(bleedDamage, locpawn, locpawn.Location, 
                   vect(0, 0, 0), dmtype_bleed);

    if (locpawn.isA('KFPawn'))
    {
        KFPawn(locpawn).HealthToGive -= 2 * bleedLevel;
    }
}


// cleanup
function Destroyed()
{
    if (stalker != none)
        stalker = none;

    super.Destroyed();
}


defaultproperties
{
    maxBleedCount=7
    fBleedPeriod=1.500000
}