From 00517b514d576a7ab93668737a50cd386a6b6bf9 Mon Sep 17 00:00:00 2001 From: GenZmeY Date: Tue, 30 Jun 2020 10:43:48 +0300 Subject: [PATCH] fix: Rack 'em up combo add upper limit for combos and decrease combo points over time --- ServerExt/Classes/Ext_PerkRhythmPerkBase.uc | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/ServerExt/Classes/Ext_PerkRhythmPerkBase.uc b/ServerExt/Classes/Ext_PerkRhythmPerkBase.uc index 6d6c900..3b6f55b 100644 --- a/ServerExt/Classes/Ext_PerkRhythmPerkBase.uc +++ b/ServerExt/Classes/Ext_PerkRhythmPerkBase.uc @@ -2,6 +2,7 @@ Class Ext_PerkRhythmPerkBase extends Ext_PerkBase; var byte HeadShotComboCount,MaxRhythmCombo,MissComboCount; var float RhythmComboDmg; +var private const float HeadShotCountdownIntervall; simulated function ModifyDamageGiven( out int InDamage, optional Actor DamageCauser, optional KFPawn_Monster MyKFPM, optional KFPlayerController DamageInstigator, optional class DamageType, optional int HitZoneIdx ) { @@ -23,13 +24,28 @@ final function ResetRhythm() HeadShotMessage(0,true,1); } +function SubstractHeadShotCombo() +{ + if( HeadShotComboCount > 0 ) + { + --HeadShotComboCount; + HeadShotMessage( HeadShotComboCount, true, MaxRhythmCombo ); + } + else if( HeadShotComboCount <= 0 ) + { + ClearTimer( nameOf( SubstractHeadShotCombo ) ); + } +} + final function UpdateDmgScale( bool bUp ) { if( bUp ) { MissComboCount = 0; - HeadShotComboCount = Min(HeadShotComboCount+1,255); + if (HeadShotComboCount < MaxRhythmCombo) + HeadShotComboCount = Min(HeadShotComboCount+1,255); HeadShotMessage(HeadShotComboCount,false,MaxRhythmCombo); + SetTimer( HeadShotCountdownIntervall, true, nameOf( SubstractHeadShotCombo ) ); } else if( HeadShotComboCount>0 && ++MissComboCount==3 ) { @@ -40,6 +56,7 @@ final function UpdateDmgScale( bool bUp ) else return; RhythmComboDmg = FMin(HeadShotComboCount,MaxRhythmCombo)*0.075; } + function UpdatePerkHeadShots( ImpactInfo Impact, class DamageType, int NumHit ) { local int HitZoneIdx; @@ -110,4 +127,5 @@ reliable client function HeadShotMessage( byte HeadShotNum, bool bMissed, byte M defaultproperties { + HeadShotCountdownIntervall=2.f } \ No newline at end of file