KF2-Server-Extension/ServerExt/Classes/Ext_PerkRhythmPerkBase.uc

109 lines
3.0 KiB
Ucode
Raw Normal View History

2017-10-20 02:00:49 +00:00
Class Ext_PerkRhythmPerkBase extends Ext_PerkBase;
var byte HeadShotComboCount,MaxRhythmCombo;
2017-10-20 02:00:49 +00:00
var float RhythmComboDmg;
var private const float HeadShotCountdownIntervall;
2017-10-20 02:00:49 +00:00
2020-11-28 20:04:55 +00:00
simulated function ModifyDamageGiven(out int InDamage, optional Actor DamageCauser, optional KFPawn_Monster MyKFPM, optional KFPlayerController DamageInstigator, optional class<KFDamageType> DamageType, optional int HitZoneIdx)
2017-10-20 02:00:49 +00:00
{
Super.ModifyDamageGiven(InDamage,DamageCauser,MyKFPM,DamageInstigator,DamageType,HitZoneIdx);
2020-11-28 20:12:58 +00:00
if (RhythmComboDmg>0 && BasePerk==None || (DamageType!=None && DamageType.Default.ModifierPerkList.Find(BasePerk)>=0) || IsWeaponOnPerk(KFWeapon(DamageCauser)))
2017-10-20 02:00:49 +00:00
InDamage *= (1.f+RhythmComboDmg);
}
2020-11-28 20:04:55 +00:00
final function SetMaxRhythm(byte MaxCombo)
2017-10-20 02:00:49 +00:00
{
MaxRhythmCombo = MaxCombo;
}
2020-11-28 21:54:57 +00:00
2017-10-20 02:00:49 +00:00
final function ResetRhythm()
{
MaxRhythmCombo = 0;
HeadShotComboCount = 0;
RhythmComboDmg = 0;
HeadShotMessage(0,true,1);
}
function SubstractHeadShotCombo()
{
2020-11-28 20:12:58 +00:00
if (HeadShotComboCount > 0)
UpdateDmgScale(false);
else
2020-11-28 20:04:55 +00:00
ClearTimer(nameOf(SubstractHeadShotCombo));
}
2020-11-28 20:04:55 +00:00
final function UpdateDmgScale(bool bUp)
2017-10-20 02:00:49 +00:00
{
2020-11-28 20:12:58 +00:00
if (bUp)
2017-10-20 02:00:49 +00:00
{
HeadShotComboCount = Min(HeadShotComboCount+1,MaxRhythmCombo);
2017-10-20 02:00:49 +00:00
HeadShotMessage(HeadShotComboCount,false,MaxRhythmCombo);
2020-11-28 20:04:55 +00:00
SetTimer(HeadShotCountdownIntervall, true, nameOf(SubstractHeadShotCombo));
2017-10-20 02:00:49 +00:00
}
2020-11-28 20:12:58 +00:00
else if (HeadShotComboCount>0)
2017-10-20 02:00:49 +00:00
{
--HeadShotComboCount;
HeadShotMessage(HeadShotComboCount,true,MaxRhythmCombo);
}
else return;
RhythmComboDmg = HeadShotComboCount*0.075;
2017-10-20 02:00:49 +00:00
}
2020-11-28 20:04:55 +00:00
function UpdatePerkHeadShots(ImpactInfo Impact, class<DamageType> DamageType, int NumHit)
2017-10-20 02:00:49 +00:00
{
local int HitZoneIdx;
2017-10-20 02:00:49 +00:00
local KFPawn_Monster KFPM;
2020-11-28 20:12:58 +00:00
if (MaxRhythmCombo<=0)
2017-10-20 02:00:49 +00:00
return;
KFPM = KFPawn_Monster(Impact.HitActor);
2020-11-28 20:12:58 +00:00
if (KFPM==none || KFPM.GetTeamNum()==0)
2017-10-20 02:00:49 +00:00
return;
HitZoneIdx = KFPM.HitZones.Find('ZoneName', Impact.HitInfo.BoneName);
2020-11-28 20:12:58 +00:00
if (HitZoneIdx == HZI_Head && KFPM.IsAliveAndWell())
2017-10-20 02:00:49 +00:00
{
2020-11-28 20:12:58 +00:00
if (class<KFDamageType>(DamageType)!=None && (class<KFDamageType>(DamageType).Default.ModifierPerkList.Find(BasePerk)>=0))
2017-10-20 02:00:49 +00:00
UpdateDmgScale(true);
}
}
2020-11-28 21:54:57 +00:00
2020-11-28 20:04:55 +00:00
reliable client function HeadShotMessage(byte HeadShotNum, bool bMissed, byte MaxHits)
2017-10-20 02:00:49 +00:00
{
local AkEvent TempAkEvent;
local KFPlayerController PC;
PC = KFPlayerController(PlayerOwner);
2020-11-28 20:12:58 +00:00
if (PC==none || PC.MyGFxHUD==none)
2017-10-20 02:00:49 +00:00
{
return;
}
PC.MyGFxHUD.RhythmCounterWidget.SetInt("count", HeadShotNum);
PC.MyGFxHUD.RhythmCounterWidget.SetBonusPercentage(float(HeadShotNum) / float(MaxHits));
2020-11-28 20:12:58 +00:00
if (HeadshotNum==0)
2017-10-20 02:00:49 +00:00
TempAkEvent = AkEvent'WW_UI_PlayerCharacter.Play_R_Method_Reset';
2020-11-28 20:12:58 +00:00
else if (HeadShotNum<MaxHits)
2017-10-20 02:00:49 +00:00
{
2020-11-28 20:12:58 +00:00
if (!bMissed)
2017-10-20 02:00:49 +00:00
{
//PC.ClientSpawnCameraLensEffect(class'KFCameraLensEmit_RackemHeadShot');
TempAkEvent = AkEvent'WW_UI_PlayerCharacter.Play_R_Method_Hit';
}
}
2020-11-28 20:12:58 +00:00
else if (!bMissed)
2017-10-20 02:00:49 +00:00
{
//PC.ClientSpawnCameraLensEffect(class'KFCameraLensEmit_RackemHeadShotPing');
TempAkEvent = AkEvent'WW_UI_PlayerCharacter.Play_R_Method_Top';
HeadshotNum = 6;
}
2020-11-28 20:12:58 +00:00
if (TempAkEvent != none)
2020-11-28 20:04:55 +00:00
PC.PlayRMEffect(TempAkEvent, 'R_Method', HeadshotNum);
2017-10-20 02:00:49 +00:00
}
defaultproperties
{
HeadShotCountdownIntervall=2.f
2017-10-20 02:00:49 +00:00
}