reset bleedticks

This commit is contained in:
Shtoyan 2022-01-23 17:03:23 +04:00
parent 9b03198d32
commit 5aa528995d
2 changed files with 18 additions and 13 deletions

View File

@ -2,10 +2,10 @@ class MeanBleedInventory extends Inventory;
const dmtype_bleed=class'NiceDamTypeStalkerBleed';
var private int maxBleedCount;
var int maxBleedCount;
var private float fBleedPeriod;
var float bleedLevel;
var int bleedLevel;
var MeanZombieCrawler stalker;
@ -21,7 +21,7 @@ event Timer()
{
local pawn locpawn;
local bool amAlive;
local float bleedDamage;
local int bleedDamage;
locpawn = Pawn(Owner);
amAlive = locpawn != none && locpawn.Health > 0;
@ -32,7 +32,7 @@ event Timer()
maxBleedCount--;
bleedDamage = calcBleedDamage(bleedLevel, rand(7));
bleedDamage = calcBleedDamage();
if (bleedDamage < 1.0)
{
maxBleedCount = 0;
@ -57,9 +57,9 @@ event Timer()
// Returns bleed damage, corresponding to given bleed level and damage scale.
// Rand(7) should be used as a scale.
// Separate function created to allow for lowest/highest damage value computing.
final private function int calcBleedDamage(float level, int scale)
final private function int calcBleedDamage()
{
return level * (3 + scale);
return bleedLevel * 7;
}

View File

@ -192,7 +192,7 @@ function bool MeleeDamageTarget(int hitdamage, vector pushdir)
{
if (targetPawn.ShieldStrength > 100)
return result;
else if (targetPawn.ShieldStrength < 0)
else if (targetPawn.ShieldStrength <= 0)
effectStrenght = 1.0;
else
effectStrenght = (100 - targetPawn.ShieldStrength) * 0.01;
@ -202,9 +202,10 @@ function bool MeleeDamageTarget(int hitdamage, vector pushdir)
return result;
}
final private function MakeBleed(NiceHumanPawn poorpawn, float effectStrenght)
final private function MakeBleed(NiceHumanPawn poorpawn, coerce int effectStrenght)
{
local Inventory I;
local MeanBleedInventory bleedinv;
local bool bFoundPoison;
if (poorpawn.Inventory != none)
@ -213,18 +214,22 @@ final private function MakeBleed(NiceHumanPawn poorpawn, float effectStrenght)
{
if (MeanBleedInventory(I) != none)
{
bleedinv = MeanBleedInventory(I);
bFoundPoison = true;
MeanBleedInventory(I).stalker = self;
MeanBleedInventory(I).bleedLevel = effectStrenght;
bleedinv.stalker = self;
bleedinv.bleedLevel = effectStrenght;
// reset bleed count
bleedinv.maxBleedCount = bleedinv.default.maxBleedCount;
}
}
}
if (!bFoundPoison)
{
I = Controller.Spawn(class<Inventory>(DynamicLoadObject(string(class'MeanBleedInventory'), class'Class')));
MeanBleedInventory(I).stalker = self;
MeanBleedInventory(I).bleedLevel = effectStrenght;
I.GiveTo(poorpawn);
bleedinv = MeanBleedInventory(I);
bleedinv.stalker = self;
bleedinv.bleedLevel = effectStrenght;
bleedinv.GiveTo(poorpawn);
}
}