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'; const dmtype_bleed=class'NiceDamTypeStalkerBleed';
var private int maxBleedCount; var int maxBleedCount;
var private float fBleedPeriod; var private float fBleedPeriod;
var float bleedLevel; var int bleedLevel;
var MeanZombieCrawler stalker; var MeanZombieCrawler stalker;
@ -21,7 +21,7 @@ event Timer()
{ {
local pawn locpawn; local pawn locpawn;
local bool amAlive; local bool amAlive;
local float bleedDamage; local int bleedDamage;
locpawn = Pawn(Owner); locpawn = Pawn(Owner);
amAlive = locpawn != none && locpawn.Health > 0; amAlive = locpawn != none && locpawn.Health > 0;
@ -32,7 +32,7 @@ event Timer()
maxBleedCount--; maxBleedCount--;
bleedDamage = calcBleedDamage(bleedLevel, rand(7)); bleedDamage = calcBleedDamage();
if (bleedDamage < 1.0) if (bleedDamage < 1.0)
{ {
maxBleedCount = 0; maxBleedCount = 0;
@ -57,9 +57,9 @@ event Timer()
// Returns bleed damage, corresponding to given bleed level and damage scale. // Returns bleed damage, corresponding to given bleed level and damage scale.
// Rand(7) should be used as a scale. // Rand(7) should be used as a scale.
// Separate function created to allow for lowest/highest damage value computing. // 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) if (targetPawn.ShieldStrength > 100)
return result; return result;
else if (targetPawn.ShieldStrength < 0) else if (targetPawn.ShieldStrength <= 0)
effectStrenght = 1.0; effectStrenght = 1.0;
else else
effectStrenght = (100 - targetPawn.ShieldStrength) * 0.01; effectStrenght = (100 - targetPawn.ShieldStrength) * 0.01;
@ -202,9 +202,10 @@ function bool MeleeDamageTarget(int hitdamage, vector pushdir)
return result; return result;
} }
final private function MakeBleed(NiceHumanPawn poorpawn, float effectStrenght) final private function MakeBleed(NiceHumanPawn poorpawn, coerce int effectStrenght)
{ {
local Inventory I; local Inventory I;
local MeanBleedInventory bleedinv;
local bool bFoundPoison; local bool bFoundPoison;
if (poorpawn.Inventory != none) if (poorpawn.Inventory != none)
@ -213,18 +214,22 @@ final private function MakeBleed(NiceHumanPawn poorpawn, float effectStrenght)
{ {
if (MeanBleedInventory(I) != none) if (MeanBleedInventory(I) != none)
{ {
bleedinv = MeanBleedInventory(I);
bFoundPoison = true; bFoundPoison = true;
MeanBleedInventory(I).stalker = self; bleedinv.stalker = self;
MeanBleedInventory(I).bleedLevel = effectStrenght; bleedinv.bleedLevel = effectStrenght;
// reset bleed count
bleedinv.maxBleedCount = bleedinv.default.maxBleedCount;
} }
} }
} }
if (!bFoundPoison) if (!bFoundPoison)
{ {
I = Controller.Spawn(class<Inventory>(DynamicLoadObject(string(class'MeanBleedInventory'), class'Class'))); I = Controller.Spawn(class<Inventory>(DynamicLoadObject(string(class'MeanBleedInventory'), class'Class')));
MeanBleedInventory(I).stalker = self; bleedinv = MeanBleedInventory(I);
MeanBleedInventory(I).bleedLevel = effectStrenght; bleedinv.stalker = self;
I.GiveTo(poorpawn); bleedinv.bleedLevel = effectStrenght;
bleedinv.GiveTo(poorpawn);
} }
} }