fix: Rack 'em up combo

add upper limit for combos and decrease combo points over time
This commit is contained in:
GenZmeY 2020-06-30 10:43:48 +03:00
parent 4413b9aa0b
commit 00517b514d

View File

@ -2,6 +2,7 @@ Class Ext_PerkRhythmPerkBase extends Ext_PerkBase;
var byte HeadShotComboCount,MaxRhythmCombo,MissComboCount; var byte HeadShotComboCount,MaxRhythmCombo,MissComboCount;
var float RhythmComboDmg; 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<KFDamageType> DamageType, optional int HitZoneIdx ) simulated function ModifyDamageGiven( out int InDamage, optional Actor DamageCauser, optional KFPawn_Monster MyKFPM, optional KFPlayerController DamageInstigator, optional class<KFDamageType> DamageType, optional int HitZoneIdx )
{ {
@ -23,13 +24,28 @@ final function ResetRhythm()
HeadShotMessage(0,true,1); 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 ) final function UpdateDmgScale( bool bUp )
{ {
if( bUp ) if( bUp )
{ {
MissComboCount = 0; MissComboCount = 0;
HeadShotComboCount = Min(HeadShotComboCount+1,255); if (HeadShotComboCount < MaxRhythmCombo)
HeadShotComboCount = Min(HeadShotComboCount+1,255);
HeadShotMessage(HeadShotComboCount,false,MaxRhythmCombo); HeadShotMessage(HeadShotComboCount,false,MaxRhythmCombo);
SetTimer( HeadShotCountdownIntervall, true, nameOf( SubstractHeadShotCombo ) );
} }
else if( HeadShotComboCount>0 && ++MissComboCount==3 ) else if( HeadShotComboCount>0 && ++MissComboCount==3 )
{ {
@ -40,6 +56,7 @@ final function UpdateDmgScale( bool bUp )
else return; else return;
RhythmComboDmg = FMin(HeadShotComboCount,MaxRhythmCombo)*0.075; RhythmComboDmg = FMin(HeadShotComboCount,MaxRhythmCombo)*0.075;
} }
function UpdatePerkHeadShots( ImpactInfo Impact, class<DamageType> DamageType, int NumHit ) function UpdatePerkHeadShots( ImpactInfo Impact, class<DamageType> DamageType, int NumHit )
{ {
local int HitZoneIdx; local int HitZoneIdx;
@ -110,4 +127,5 @@ reliable client function HeadShotMessage( byte HeadShotNum, bool bMissed, byte M
defaultproperties defaultproperties
{ {
HeadShotCountdownIntervall=2.f
} }