diff --git a/sources/NiceReplicationInfo.uc b/sources/NiceReplicationInfo.uc index 01295a2..2da7241 100644 --- a/sources/NiceReplicationInfo.uc +++ b/sources/NiceReplicationInfo.uc @@ -102,31 +102,39 @@ simulated function ServerExplode local Vector dirToVictim; local Vector hitLocation; local float scale1, scale2; + local NiceMonster niceVictim; if(Role < ROLE_Authority) return; foreach VisibleActors(class'Actor', victim, explRadius, explLocation){ - if(victim == none || victim == self) continue; - if(victim.role < ROLE_Authority) continue; - if(ExtendedZCollision(victim) != none) continue; - if(Trigger(victim) != none) continue; - dirToVictim = Normal(victim.location - explLocation); - hitLocation = victim.location - 0.5 * - (victim.collisionHeight + victim.collisionRadius) * dirToVictim; - CalculateDamageScales( scale1, scale2, - victim, explLocation, explRadius, explExp); - // Deal main damage - if(scale1 > 0){ - ServerDealDamage( victim, explDamage * scale1, instigator, - hitLocation, scale1 * momentum * dirToVictim, - explDmgType); - } - // Deal secondary damage - if(allowDoubleExplosion && victim != none && scale2 > 0){ - ServerDealDamage( victim, explDamage * scale2, instigator, - hitLocation, scale2 * momentum * dirToVictim, - explDmgType); - } - if(NiceMonster(victim) != none && NiceMonster(victim).health <= 0) - numKilled ++; + if(victim == none || victim == self) continue; + if(victim.role < ROLE_Authority) continue; + if(ExtendedZCollision(victim) != none) continue; + if(Trigger(victim) != none) continue; + dirToVictim = Normal(victim.location - explLocation); + hitLocation = victim.location - 0.5 * + (victim.collisionHeight + victim.collisionRadius) * dirToVictim; + CalculateDamageScales( scale1, scale2, + victim, explLocation, explRadius, explExp); + // Deal main damage + if(scale1 > 0){ + ServerDealDamage( victim, explDamage * scale1, instigator, + hitLocation, scale1 * momentum * dirToVictim, + explDmgType); + } + // Deal secondary damage + if(allowDoubleExplosion && victim != none && scale2 > 0){ + ServerDealDamage( victim, explDamage * scale2, instigator, + hitLocation, scale2 * momentum * dirToVictim, + explDmgType); + } + niceVictim = NiceMonster(victim); + if(NiceMonster(victim) != none) { + if (NiceMonster(victim).health <= 0) { + numKilled += 1; + } + else { + niceVictim.concussionCountdown = 10.0; + } + } } if(numKilled >= 4) KFGameType(level.game).DramaticEvent(0.05); @@ -272,9 +280,6 @@ simulated function HandleNiceDamageMechanicsAndSkills hasSkill(nicePlayer, class'NiceSkillCommandoTranquilizer'); hasZEDFrenzy = class'NiceVeterancyTypes'.static. hasSkill(nicePlayer, class'NiceSkillMedicZEDFrenzy'); - // Medic's suppression - if(hasTranquilizer) - niceZed.mind = FMin(niceZed.mind, 0.5); // Medic's frenzy if(hasZEDFrenzy && nicePlayer.IsZedTimeActive()){ niceZed.madnessCountDown = diff --git a/sources/Perks/Demolitions/NiceDamTypeDemoExplosion.uc b/sources/Perks/Demolitions/NiceDamTypeDemoExplosion.uc index a640688..78ab779 100644 --- a/sources/Perks/Demolitions/NiceDamTypeDemoExplosion.uc +++ b/sources/Perks/Demolitions/NiceDamTypeDemoExplosion.uc @@ -8,6 +8,7 @@ static function GetHitEffects(out class HitEffects[4], int VictimHealt } defaultproperties { + stoppingPower=0.5 stunMultiplier=0.600000 bIsExplosive=True DeathString="%o filled %k's body with shrapnel." diff --git a/sources/Weapons/BaseWeaponClasses/NiceWeaponDamageType.uc b/sources/Weapons/BaseWeaponClasses/NiceWeaponDamageType.uc index 62fc867..835503b 100644 --- a/sources/Weapons/BaseWeaponClasses/NiceWeaponDamageType.uc +++ b/sources/Weapons/BaseWeaponClasses/NiceWeaponDamageType.uc @@ -27,6 +27,7 @@ var const int MediumZedMinHealth; // If zed's base Health >= this var float PenDmgReduction; // Penetration damage reduction after hitting small zed var float penDecapReduction; // Penetration decapitaion effectiveness reduction after hitting small zed var float penIncapReduction; // Penetration incapacitation (flinch or stun) effectiveness reduction after hitting small zed +var float stoppingPower; // How much stopping power the gun has - % amount zeds will be made to slow down when shot var bool bIsProjectile; // If original damage type's version was derived from 'KFProjectileWeaponDamageType', then set this to true // Scales exp gain according to given HardcoreLevel static function float getScale(int HL){ @@ -88,6 +89,7 @@ defaultproperties BigZedPenDmgReduction=0.500000 BigZedMinHealth=1000 MediumZedPenDmgReduction=0.750000 + stoppingPower=0.0 MediumZedMinHealth=500 PenDmgReduction=0.700000 PawnDamageEmitter=None diff --git a/sources/Weapons/Playable/SMG/Kriss/NiceDamTypeKrissM.uc b/sources/Weapons/Playable/SMG/Kriss/NiceDamTypeKrissM.uc index ca8b1c2..48b3dad 100644 --- a/sources/Weapons/Playable/SMG/Kriss/NiceDamTypeKrissM.uc +++ b/sources/Weapons/Playable/SMG/Kriss/NiceDamTypeKrissM.uc @@ -2,6 +2,7 @@ class NiceDamTypeKrissM extends NiceDamageTypeVetDemolitions abstract; defaultproperties { + stoppingPower=0.25 HeadShotDamageMult=1.500000 WeaponClass=class'NiceKrissMMedicGun' } diff --git a/sources/Weapons/Playable/SMG/M7A3/NiceDamTypeM7A3M.uc b/sources/Weapons/Playable/SMG/M7A3/NiceDamTypeM7A3M.uc index 96d8965..9c584ce 100644 --- a/sources/Weapons/Playable/SMG/M7A3/NiceDamTypeM7A3M.uc +++ b/sources/Weapons/Playable/SMG/M7A3/NiceDamTypeM7A3M.uc @@ -2,6 +2,7 @@ class NiceDamTypeM7A3M extends NiceDamageTypeVetDemolitions abstract; defaultproperties { + stoppingPower=0.15 HeadShotDamageMult=2.000000 WeaponClass=class'NiceM7A3MMedicGun' } diff --git a/sources/Weapons/Playable/SMG/MP5M/NiceDamTypeMP5M.uc b/sources/Weapons/Playable/SMG/MP5M/NiceDamTypeMP5M.uc index ee30a1f..89f2bcb 100644 --- a/sources/Weapons/Playable/SMG/MP5M/NiceDamTypeMP5M.uc +++ b/sources/Weapons/Playable/SMG/MP5M/NiceDamTypeMP5M.uc @@ -2,6 +2,7 @@ class NiceDamTypeMP5M extends NiceDamageTypeVetDemolitions abstract; defaultproperties { + stoppingPower=0.15 HeadShotDamageMult=2.000000 WeaponClass=class'NiceMP5MMedicGun' } diff --git a/sources/Weapons/Playable/SMG/MP7M/NiceDamTypeMP7M.uc b/sources/Weapons/Playable/SMG/MP7M/NiceDamTypeMP7M.uc index 71c97c6..a6274cc 100644 --- a/sources/Weapons/Playable/SMG/MP7M/NiceDamTypeMP7M.uc +++ b/sources/Weapons/Playable/SMG/MP7M/NiceDamTypeMP7M.uc @@ -5,5 +5,6 @@ defaultproperties bPenetrationHSOnly=True MaxPenetrations=1 HeadShotDamageMult=2.250000 + stoppingPower=0.15 WeaponClass=class'NiceMP7MMedicGun' } diff --git a/sources/Zeds/Mean/MeanZombieFleshPound.uc b/sources/Zeds/Mean/MeanZombieFleshPound.uc index 3bb82a0..b7ac20b 100644 --- a/sources/Zeds/Mean/MeanZombieFleshPound.uc +++ b/sources/Zeds/Mean/MeanZombieFleshPound.uc @@ -27,23 +27,20 @@ Ignores StartChargingFP; bFrustrated = false; if(Controller != none) NiceZombieFleshPoundController(Controller).RageFrustrationTimer = 0; - if( Health>0 && !bZapped ) - { - SetGroundSpeed(GetOriginalGroundSpeed()); - } if( Level.NetMode!=NM_DedicatedServer ) ClientChargingAnims(); NetUpdateTime = Level.TimeSeconds - 1; } + simulated function UpdateGroundSpeed() { + super(NiceMonster).UpdateGroundSpeed(); + if (!bShotAnim) { + groundSpeed *= 2.3; + } + } function Tick( float Delta ) { - if( !bShotAnim ) - { - SetGroundSpeed(OriginalGroundSpeed * 2.3);//2.0; - } - // Keep the flesh pound moving toward its target when attacking if( Role == ROLE_Authority && bShotAnim) { diff --git a/sources/Zeds/Nice/NiceZombieBoss.uc b/sources/Zeds/Nice/NiceZombieBoss.uc index 8384766..2c53c56 100644 --- a/sources/Zeds/Nice/NiceZombieBoss.uc +++ b/sources/Zeds/Nice/NiceZombieBoss.uc @@ -915,9 +915,16 @@ state Charging // How many charge attacks we can do randomly 1-3 NumChargeAttacks = Rand(2) + 1; } + simulated function UpdateGroundSpeed() { + super.UpdateGroundSpeed(); + if (bShotAnim) { + groundSpeed *= 1.25; + } else { + groundSpeed *= 2.5; + } + } function EndState() { - SetGroundSpeed(GetOriginalGroundSpeed()); bChargingPlayer = False; ChargeDamage = 0; if( Level.NetMode!=NM_DedicatedServer ) @@ -942,7 +949,6 @@ state Charging if( Level.NetMode!=NM_DedicatedServer ) PostNetReceive(); } - SetGroundSpeed(OriginalGroundSpeed * 1.25); if( LookTarget!=none ) { Acceleration = AccelRate * Normal(LookTarget.Location - Location); @@ -956,16 +962,6 @@ state Charging if( Level.NetMode!=NM_DedicatedServer ) PostNetReceive(); } - - // Zapping slows him down, but doesn't stop him - if( bZapped ) - { - SetGroundSpeed(OriginalGroundSpeed * 1.5); - } - else - { - SetGroundSpeed(OriginalGroundSpeed * 2.5); - } } Global.Tick(Delta); @@ -1071,7 +1067,6 @@ State Escaping extends Charging // Got hurt and running away... if( Level.NetMode!=NM_DedicatedServer ) PostNetReceive(); } - SetGroundSpeed(GetOriginalGroundSpeed()); } else { @@ -1081,23 +1076,20 @@ State Escaping extends Charging // Got hurt and running away... if( Level.NetMode!=NM_DedicatedServer ) PostNetReceive(); } - - // Zapping slows him down, but doesn't stop him - if( bZapped ) - { - SetGroundSpeed(OriginalGroundSpeed * 1.5); - } - else - { - SetGroundSpeed(OriginalGroundSpeed * 2.5); - } } Global.Tick(Delta); } + simulated function UpdateGroundSpeed() { + super.UpdateGroundSpeed(); + if (bShotAnim) { + groundSpeed *= 1.25; + } else { + groundSpeed *= 2.5; + } + } function EndState() { - SetGroundSpeed(GetOriginalGroundSpeed()); bChargingPlayer = False; if( Level.NetMode!=NM_DedicatedServer ) PostNetReceive(); diff --git a/sources/Zeds/Nice/NiceZombieBossBase.uc b/sources/Zeds/Nice/NiceZombieBossBase.uc index aa6cade..cd05c38 100644 --- a/sources/Zeds/Nice/NiceZombieBossBase.uc +++ b/sources/Zeds/Nice/NiceZombieBossBase.uc @@ -98,6 +98,9 @@ defaultproperties HealthMax=8000.000000 Health=8000 HeadScale=1.300000 + stoppingRecoveryRate=0.1 + maxStoppingEffect=0.2 + minStoppingThreshold=0.6 MenuName="Nice Patriarch" MovementAnims(0)="WalkF" MovementAnims(1)="WalkF" diff --git a/sources/Zeds/Nice/NiceZombieBrute.uc b/sources/Zeds/Nice/NiceZombieBrute.uc index 8e6c7f1..26860fc 100644 --- a/sources/Zeds/Nice/NiceZombieBrute.uc +++ b/sources/Zeds/Nice/NiceZombieBrute.uc @@ -182,18 +182,6 @@ function TakeDamageClient(int Damage, Pawn InstigatedBy, Vector HitLocation, Vec if (bDecapitated) Died(InstigatedBy.Controller, damageType, HitLocation); } -function TakeFireDamage(int Damage, Pawn Instigator) -{ - Super.TakeFireDamage(Damage, Instigator); - // Adjust movement speed if not charging - if (!bChargingPlayer) - { - if (bBurnified) - GroundSpeed = GetOriginalGroundSpeed() * BurnGroundSpeedMul; - else - GroundSpeed = GetOriginalGroundSpeed(); - } -} function ClawDamageTarget() { local KFHumanPawn HumanTarget; @@ -311,19 +299,16 @@ Ignores StartCharging; NetUpdateTime = Level.TimeSeconds - 1; } + simulated function UpdateGroundSpeed() { + super.UpdateGroundSpeed(); + groundSpeed = groundSpeed + ((groundSpeed * 0.75 / maxRageCounter * (rageCounter + 1) * rageSpeedTween)); + } function EndState() { bChargingPlayer = false; NiceZombieBruteController(Controller).RageFrustrationTimer = 0; - if (Health > 0) - { - GroundSpeed = GetOriginalGroundSpeed(); - if (bBurnified) - GroundSpeed *= BurnGroundSpeedMul; - } - if( Level.NetMode!=NM_DedicatedServer ) ClientChargingAnims(); @@ -331,12 +316,8 @@ Ignores StartCharging; } function Tick(float Delta) { - if (!bShotAnim) - { + if (!bShotAnim) { RageSpeedTween = FClamp(RageSpeedTween + (Delta * 0.75), 0, 1.0); - GroundSpeed = OriginalGroundSpeed + ((OriginalGroundSpeed * 0.75 / MaxRageCounter * (RageCounter + 1) * RageSpeedTween)); - if (bBurnified) - GroundSpeed *= BurnGroundSpeedMul; } Global.Tick(Delta); diff --git a/sources/Zeds/Nice/NiceZombieBruteBase.uc b/sources/Zeds/Nice/NiceZombieBruteBase.uc index 58af2a0..7bbd5e5 100644 --- a/sources/Zeds/Nice/NiceZombieBruteBase.uc +++ b/sources/Zeds/Nice/NiceZombieBruteBase.uc @@ -33,7 +33,6 @@ var bool bServerBlock; var bool bClientBlock; var float BlockDmgMul; // Multiplier for damage taken from blocked shots var float BlockFireDmgMul; -var float BurnGroundSpeedMul; // Multiplier for ground speed when burning replication { reliable if(Role == ROLE_Authority) @@ -61,7 +60,6 @@ defaultproperties BlockAddScale=2.500000 BlockDmgMul=0.100000 BlockFireDmgMul=1.000000 - BurnGroundSpeedMul=0.700000 StunThreshold=4.000000 flameFuel=0.500000 clientHeadshotScale=1.300000 @@ -110,6 +108,7 @@ defaultproperties Health=1000 HeadHeight=2.500000 HeadScale=1.300000 + minStoppingThreshold=0.1 MenuName="Brute" MovementAnims(0)="BruteWalkC" MovementAnims(1)="BruteWalkC" diff --git a/sources/Zeds/Nice/NiceZombieFleshPound.uc b/sources/Zeds/Nice/NiceZombieFleshPound.uc index 1a7ea05..8d5056d 100644 --- a/sources/Zeds/Nice/NiceZombieFleshPound.uc +++ b/sources/Zeds/Nice/NiceZombieFleshPound.uc @@ -49,7 +49,6 @@ function SetMindControlled(bool bNewMindControlled) if( bNewMindControlled != bZedUnderControl ) { - SetGroundSpeed(OriginalGroundSpeed * 1.25); Health *= 1.25; HealthMax *= 1.25; } @@ -252,21 +251,21 @@ Ignores StartChargingFP; if(fpController == none) fpController.RageFrustrationTimer = 0; - if( Health>0 && !bZapped ) - { - SetGroundSpeed(GetOriginalGroundSpeed()); - } - if( Level.NetMode!=NM_DedicatedServer ) ClientChargingAnims(); NetUpdateTime = Level.TimeSeconds - 1; } + simulated function UpdateGroundSpeed() { + super.UpdateGroundSpeed(); + if (!bShotAnim) { + groundSpeed *= 2.3; + } + } function Tick( float Delta ) { if( !bShotAnim ) { - SetGroundSpeed(OriginalGroundSpeed * 2.3);//2.0; if( !bFrustrated && !bZedUnderControl && Level.TimeSeconds>RageEndTime ) { GoToState(''); @@ -330,11 +329,16 @@ Ignores StartChargingFP; state ChargeToMarker extends RageCharging { Ignores StartChargingFP; + simulated function UpdateGroundSpeed() { + super.UpdateGroundSpeed(); + if (!bShotAnim) { + groundSpeed *= 2.3; + } + } function Tick( float Delta ) { if( !bShotAnim ) { - SetGroundSpeed(OriginalGroundSpeed * 2.3); if( !bFrustrated && !bZedUnderControl && Level.TimeSeconds>RageEndTime ) { GoToState(''); diff --git a/sources/Zeds/Nice/NiceZombieFleshpoundBase.uc b/sources/Zeds/Nice/NiceZombieFleshpoundBase.uc index 6380eb1..54fc8c3 100644 --- a/sources/Zeds/Nice/NiceZombieFleshpoundBase.uc +++ b/sources/Zeds/Nice/NiceZombieFleshpoundBase.uc @@ -80,6 +80,8 @@ defaultproperties Health=1650 HeadHeight=2.500000 HeadScale=1.300000 + maxStoppingEffect=0.05 + minStoppingThreshold=0.68 MenuName="Nice Flesh Pound" MovementAnims(0)="PoundWalk" MovementAnims(1)="WalkB" diff --git a/sources/Zeds/Nice/NiceZombieGorefast.uc b/sources/Zeds/Nice/NiceZombieGorefast.uc index 6b75e97..a696b0e 100644 --- a/sources/Zeds/Nice/NiceZombieGorefast.uc +++ b/sources/Zeds/Nice/NiceZombieGorefast.uc @@ -45,7 +45,6 @@ function SetMindControlled(bool bNewMindControlled) if( bNewMindControlled != bZedUnderControl ) { - SetGroundSpeed(OriginalGroundSpeed * 1.25); Health *= 1.25; HealthMax *= 1.25; } @@ -73,13 +72,6 @@ function RangedAttack(Actor A){ if(!bShotAnim && !bDecapitated && VSize(A.Location - Location) <= 700) GoToState('RunningState'); } -simulated function Tick(float DeltaTime){ - super.Tick(DeltaTime); - if(IsInState('RunningState')) - SetGroundSpeed(GetOriginalGroundSpeed() * 1.875); - else - SetGroundSpeed(GetOriginalGroundSpeed()); -} state RunningState{ // Set the zed to the zapped behavior simulated function SetZappedBehavior(){ @@ -94,7 +86,6 @@ state RunningState{ if(bZapped) GoToState(''); else{ - SetGroundSpeed(OriginalGroundSpeed * 1.875); bRunning = true; if(Level.NetMode != NM_DedicatedServer) PostNetReceive(); @@ -103,7 +94,6 @@ state RunningState{ } } function EndState(){ - SetGroundSpeed(GetOriginalGroundSpeed()); bRunning = false; if(Level.NetMode != NM_DedicatedServer) PostNetReceive(); @@ -112,6 +102,10 @@ state RunningState{ NetUpdateTime = Level.TimeSeconds - 1; } + simulated function UpdateGroundSpeed() { + super.UpdateGroundSpeed(); + groundSpeed *= 1.875; + } function RemoveHead(){ GoToState(''); Global.RemoveHead(); diff --git a/sources/Zeds/Nice/NiceZombieHuskBase.uc b/sources/Zeds/Nice/NiceZombieHuskBase.uc index 7c93117..89b8a58 100644 --- a/sources/Zeds/Nice/NiceZombieHuskBase.uc +++ b/sources/Zeds/Nice/NiceZombieHuskBase.uc @@ -60,6 +60,7 @@ defaultproperties HeadHeight=1.000000 HeadScale=1.350000 AmbientSoundScaling=8.000000 + stoppingRecoveryRate=0.05 MenuName="Nice Husk" MovementAnims(0)="WalkF" MovementAnims(1)="WalkB" diff --git a/sources/Zeds/Nice/NiceZombieJason.uc b/sources/Zeds/Nice/NiceZombieJason.uc index ab0a1f6..c32c255 100644 --- a/sources/Zeds/Nice/NiceZombieJason.uc +++ b/sources/Zeds/Nice/NiceZombieJason.uc @@ -105,15 +105,11 @@ State SawingLoop else GoToState(''); } } -simulated function float GetOriginalGroundSpeed() -{ - local float result; - result = OriginalGroundSpeed; - if ( bWasRaged || bCharging ) - result *= 3.5; - else if( bZedUnderControl ) - result *= 1.25; - return result; +simulated function UpdateGroundSpeed() { + super.UpdateGroundSpeed(); + if (bWasRaged || bCharging) { + groundSpeed *= 3.5; + } } state RunningState { @@ -124,7 +120,6 @@ state RunningState GoToState(''); else { bCharging = true; - SetGroundSpeed(GetOriginalGroundSpeed()); if( Level.NetMode!=NM_DedicatedServer ) PostNetReceive(); NetUpdateTime = Level.TimeSeconds - 1; @@ -133,8 +128,6 @@ state RunningState function EndState() { bCharging = False; - if( !bZapped ) - SetGroundSpeed(GetOriginalGroundSpeed()); if( Level.NetMode!=NM_DedicatedServer ) PostNetReceive(); } @@ -163,6 +156,8 @@ defaultproperties ChallengeSound(2)=None ChallengeSound(3)=None ScoringValue=300 + maxStoppingEffect=0.25 + minStoppingThreshold=0.25 MenuName="Jason" AmbientSound=Sound'ScrnZedPack_S.Jason.Jason_Sound' Mesh=SkeletalMesh'ScrnZedPack_A.JasonMesh' diff --git a/sources/Zeds/Nice/NiceZombieScrake.uc b/sources/Zeds/Nice/NiceZombieScrake.uc index 190e4fb..22f2797 100644 --- a/sources/Zeds/Nice/NiceZombieScrake.uc +++ b/sources/Zeds/Nice/NiceZombieScrake.uc @@ -83,7 +83,6 @@ function SetMindControlled(bool bNewMindControlled) if( bNewMindControlled != bZedUnderControl ) { - SetGroundSpeed(OriginalGroundSpeed * 1.25); Health *= 1.25; HealthMax *= 1.25; } @@ -185,8 +184,9 @@ state RunningState { return false; } - simulated function float GetOriginalGroundSpeed() { - return 3.5 * OriginalGroundSpeed; + simulated function UpdateGroundSpeed() { + super.UpdateGroundSpeed(); + groundSpeed *= 3.5; } function BeginState(){ local NiceHumanPawn rageTarget, rageCause; @@ -214,7 +214,6 @@ state RunningState if(bZapped) GoToState(''); else{ - SetGroundSpeed(OriginalGroundSpeed * 3.5); bCharging = true; if( Level.NetMode!=NM_DedicatedServer ) PostNetReceive(); @@ -224,10 +223,6 @@ state RunningState } function EndState() { - if( !bZapped ) - { - SetGroundSpeed(GetOriginalGroundSpeed()); - } bCharging = False; if( Level.NetMode!=NM_DedicatedServer ) PostNetReceive(); @@ -265,8 +260,9 @@ State SawingLoop { return false; } - simulated function float GetOriginalGroundSpeed() { - return OriginalGroundSpeed * AttackChargeRate; + simulated function UpdateGroundSpeed() { + super.UpdateGroundSpeed(); + groundSpeed *= attackChargeRate; } function bool CanGetOutOfWay() { @@ -279,7 +275,6 @@ State SawingLoop // Randomly have the scrake charge during an attack so it will be less predictable if(Health/HealthMax < 0.5 || FRand() <= 0.95) { - SetGroundSpeed(OriginalGroundSpeed * AttackChargeRate); bCharging = true; if( Level.NetMode!=NM_DedicatedServer ) PostNetReceive(); @@ -327,8 +322,6 @@ State SawingLoop { AmbientSound=default.AmbientSound; MeleeDamage = Max( DifficultyDamageModifer() * default.MeleeDamage, 1 ); - - SetGroundSpeed(GetOriginalGroundSpeed()); bCharging = False; if(Level.NetMode != NM_DedicatedServer) PostNetReceive(); diff --git a/sources/Zeds/Nice/NiceZombieScrakeBase.uc b/sources/Zeds/Nice/NiceZombieScrakeBase.uc index 6ccd9f6..2905831 100644 --- a/sources/Zeds/Nice/NiceZombieScrakeBase.uc +++ b/sources/Zeds/Nice/NiceZombieScrakeBase.uc @@ -63,6 +63,8 @@ defaultproperties HealthMax=1000.000000 Health=1000 HeadHeight=2.200000 + maxStoppingEffect=0.15 + minStoppingThreshold=0.15 MenuName="Nice Scrake" MovementAnims(0)="SawZombieWalk" MovementAnims(1)="SawZombieWalk" diff --git a/sources/Zeds/Nice/NiceZombieShiver.uc b/sources/Zeds/Nice/NiceZombieShiver.uc index fbd612a..72c110e 100644 --- a/sources/Zeds/Nice/NiceZombieShiver.uc +++ b/sources/Zeds/Nice/NiceZombieShiver.uc @@ -179,7 +179,6 @@ state Running Global.Tick(Delta); if (RunUntilTime < Level.TimeSeconds) GotoState(''); - GroundSpeed = GetOriginalGroundSpeed(); } function BeginState() { @@ -190,13 +189,12 @@ state Running function EndState() { bRunning = false; - GroundSpeed = global.GetOriginalGroundSpeed(); RunCooldownEnd = Level.TimeSeconds + PeriodRunCoolBase + FRand() * PeriodRunCoolRan; MovementAnims[0] = WalkAnim; } - function float GetOriginalGroundSpeed() - { - return global.GetOriginalGroundSpeed() * 2.5; + simulated function UpdateGroundSpeed() { + super.UpdateGroundSpeed(); + groundSpeed *= 2.5; } function bool CanSpeedAdjust() { @@ -219,14 +217,6 @@ simulated function bool AnimNeedsWait(name TestAnim) } return ExpectingChannel == 0; } -simulated function float GetOriginalGroundSpeed() -{ - local float result; - result = OriginalGroundSpeed; - if( bZedUnderControl ) - result *= 1.25; - return result; -} simulated function HandleAnimation(float Delta) { // hehehe diff --git a/sources/Zeds/Nice/NiceZombieSiren.uc b/sources/Zeds/Nice/NiceZombieSiren.uc index ad5b69b..1ea867c 100644 --- a/sources/Zeds/Nice/NiceZombieSiren.uc +++ b/sources/Zeds/Nice/NiceZombieSiren.uc @@ -281,6 +281,12 @@ simulated function HurtRadius(float DamageAmount, float DamageRadius, class 0){ currScreamTime = Level.TimeSeconds - screamStartTime; diff --git a/sources/Zeds/Nice/NiceZombieTeslaHusk.uc b/sources/Zeds/Nice/NiceZombieTeslaHusk.uc index 030c45f..ff60b33 100644 --- a/sources/Zeds/Nice/NiceZombieTeslaHusk.uc +++ b/sources/Zeds/Nice/NiceZombieTeslaHusk.uc @@ -709,7 +709,6 @@ defaultproperties HealEnergyDrain=0.200000 ProjectileFireInterval=5.000000 BurnDamageScale=1.000000 - mind=0.000000 bFireImmune=False MoanVoice=SoundGroup'KF_EnemiesFinalSnd_CIRCUS.Husk.Husk_Talk' BleedOutDuration=5.000000 diff --git a/sources/Zeds/NiceMonster.uc b/sources/Zeds/NiceMonster.uc index 85b79d9..0c13d76 100644 --- a/sources/Zeds/NiceMonster.uc +++ b/sources/Zeds/NiceMonster.uc @@ -24,6 +24,7 @@ class NiceMonster extends KFMonster #exec OBJ LOAD FILE=KF_EnemyGlobalSndTwo.uax #exec OBJ LOAD FILE=KFZED_FX_T.utx +var bool initializationComplete; //============================================================================== //============================================================================== // > Affliction system @@ -75,13 +76,15 @@ var float stunLoopStart, stunLoopEnd, idleInsertFrame; var bool bWasIdleStun; // Were we using idleanimation for stun? var float prevStunAnimFrame; // At which tick we were? //============================================================================== -// >> Another default stun system allows tostuns zeds by repeatedly dealing +// >> Another default stun system allows to stun zeds by repeatedly dealing // head damage to them fast enough: // 1. Dealing head damage increases accumulated damage // 2. If head damage was received for a certain time period, - // accumulated damage starts to decrease // 3. If accumulated damage is high enough, passes 'IsStunPossible' check -// and has low enough mind level - normal duration stun activates +// - normal duration stun activates +// How much more time will this zed spend concussed? +var float concussionCountdown; // Accumulated head damage var float accHeadDamage; // Rate (per second) at which accumulated head damage diminishes @@ -91,16 +94,6 @@ var float headRecoveryTime; // Count down variable for above mentioned time var float headRecoveryCountDown; -//============================================================================== -//============================================================================== -// > Mind system -// Largly underdeveloped and currently only exists to decide whether or not -// zed can be stunned by accumulating head damage -// Current mind level (1.0 - default and maximum value) -var float mind; -// Treshold, required for stun by accumulated head damage -var float accStunMindLvl; - //============================================================================== //============================================================================== // > Temperature system @@ -148,16 +141,14 @@ var bool bFrugalFuelUsage; // Is a value from 0.0 to 1.0 and `1 - stoppingEffect` acts as speed multiplier // for the zed var float stoppingEffect; -// (Absolute) Point in time at which recovery would start, updated when zeds -// receives another stopping effect from somewhere -var float stoppingRecoveryStartTime; -// How much stopping effect would be rcovred in a second +// How much stopping effect would be recovred in a second var float stoppingRecoveryRate; -// Maximum stopping effect this zed can tank +// Maximum `stoppingEffect` value zed can accumulate var float maxStoppingEffect; // Minimal stopping threshold for the zed (supposed to be subtracted from // incoming effects' strenght). var float minStoppingThreshold; + //============================================================================== //============================================================================== // > Miscellaneous variables @@ -241,6 +232,7 @@ simulated function PostBeginPlay(){ SavedExtCollision = MyExtCollision.bCollideActors; } } + initializationComplete = true; } //============================================================================== @@ -381,6 +373,15 @@ simulated function FearTick(float deltaTime){ + 0.75 * accelRate * Normal(Location - fearCenter); } //============================================================================== +// >> Decrease active stopping power on the zed as the time goes by +simulated function StoppingPowerTick(float deltaTime) { + if (stoppingEffect <= 0.0 || concussionCountdown > 0.0) { + return; + } + stoppingEffect -= deltaTime * stoppingRecoveryRate; + stoppingEffect = FMax(0, stoppingEffect); +} +//============================================================================== // >> Set of functions to handle animation changes during stun simulated function CalcRemainigStunStructure( name seqName, float oFrame, @@ -470,14 +471,14 @@ simulated function StunTick(float deltaTime){ } //============================================================================== // >> Set of functions to handle stun from head damage accumulation -function AccumulateHeadDamage( float addDamage, +function AccumulateHeadDamage( float addDamage, bool bIsHeadshot, NicePlayerController nicePlayer){ if(bIsHeadshot){ AccHeadDamage += addDamage; HeadRecoveryCountDown = HeadRecoveryTime; if(AccHeadDamage > (default.HeadHealth / 1.5) - && (Mind <= AccStunMindLvl && IsStunPossible())) + && (concussionCountdown > 0.0 && IsStunPossible())) DoStun(nicePlayer.pawn,,,, 1.0); } else if(HeadRecoveryCountDown > 0.0) @@ -485,11 +486,13 @@ function AccumulateHeadDamage( float addDamage, HeadRecoveryTime / 2); } function HeadDamageRecoveryTick(float delta){ - HeadRecoveryCountDown -= delta; - HeadRecoveryCountDown = FMax(0.0, HeadRecoveryCountDown); - if(HeadRecoveryCountDown <= 0.0) - AccHeadDamage -= delta * HeadDamageRecoveryRate; - AccHeadDamage = FMax(AccHeadDamage, 0.0); + concussionCountdown -= delta; + concussionCountdown = FMax(0.0, concussionCountdown); + headRecoveryCountDown -= delta; + headRecoveryCountDown = FMax(0.0, headRecoveryCountDown); + if(headRecoveryCountDown <= 0.0) + accHeadDamage -= delta * HeadDamageRecoveryRate; + accHeadDamage = FMax(accHeadDamage, 0.0); } //============================================================================== // >> Function that calls actual 'HeatTick' when needed @@ -546,15 +549,6 @@ simulated function FakeHeatTick(float deltaTime){ // >> Ticks from TWI's code // Updates zed's speed if it's not relevant; // code, specific to standalone game and listen servers was cut out -simulated function NonRelevantSpeedupTick(float deltaTime){ - if(Level.netMode == NM_Client || !CanSpeedAdjust()) return; - if(Level.TimeSeconds - LastReplicateTime > 0.5) - SetGroundSpeed(default.GroundSpeed * (300.0 / default.GroundSpeed)); - else{ - LastSeenOrRelevantTime = Level.TimeSeconds; - SetGroundSpeed(GetOriginalGroundSpeed()); - } -} // Kill zed if it has been bleeding long enough simulated function BleedOutTick(float deltaTick) @@ -605,7 +599,6 @@ simulated function TWITick(float deltaTime){ // If we've flagged this character to be destroyed next tick, handle that if(bDestroyNextTick && TimeSetDestroyNextTickTime < Level.TimeSeconds) Destroy(); - NonRelevantSpeedupTick(deltaTime); // Reset AnimAction if(bResetAnimAct && ResetAnimActTime < Level.TimeSeconds){ AnimAction = ''; @@ -628,8 +621,10 @@ simulated function Tick(float deltaTime){ DecapTick(deltaTime); FearTick(deltaTime); StunTick(deltaTime); + StoppingPowerTick(deltaTime); HeadDamageRecoveryTick(deltaTime); FakeHeatTick(deltaTime); + UpdateGroundSpeed(); // TWI's tick TWITick(deltaTime); } @@ -1613,7 +1608,7 @@ function UnFreeze(){ GroundSpeed = GetOriginalGroundSpeed(); bFrozenZed = false; } -function TakeDamageClient( int damage, +function TakeDamageClient( int damage, Pawn instigatedBy, Vector hitLocation, Vector momentum, @@ -1632,22 +1627,24 @@ function TakeDamageClient( int damage, KFPRI = KFPlayerReplicationInfo(instigatedBy.PlayerReplicationInfo); if(headHealth <= 0) headshotLevel = 0.0; + // Handle special weapon effects + HandleStoppingPower(damageType, headshotLevel); // Handle elemental damage components - ExtractElementalDamage( regDamage, heatDamage, damage, + ExtractElementalDamage(regDamage, heatDamage, damage, instigatedBy, hitLocation, momentum, damageType, KFPRI, headshotLevel, lockonTime); - FireDamageEffects( HeatDamage, instigatedBy, hitLocation, momentum, + FireDamageEffects( HeatDamage, instigatedBy, hitLocation, momentum, damageType, headshotLevel, KFPRI); - FrostEffects( instigatedBy, hitLocation, momentum, + FrostEffects( instigatedBy, hitLocation, momentum, damageType, headshotLevel, KFPRI); // Handle body parts damage components - ExtractPartsDamage( bodyDamage, headDamage, painDamage, + ExtractPartsDamage( bodyDamage, headDamage, painDamage, RegDamage + HeatDamage, instigatedBy, hitLocation, momentum, damageType, KFPRI, headshotLevel, lockonTime); - DoRightPainReaction( painDamage, instigatedBy, hitLocation, momentum, + DoRightPainReaction( painDamage, instigatedBy, hitLocation, momentum, damageType, headshotLevel, KFPRI); - DealPartsDamage( bodyDamage, headDamage, instigatedBy, + DealPartsDamage( bodyDamage, headDamage, instigatedBy, hitLocation, momentum, damageType, KFPRI, headshotLevel, lockonTime); AddKillAssistant(instigatedBy, bodyDamage); @@ -1658,6 +1655,28 @@ function TakeDamageClient( int damage, // like why the fuck is it being done HERE? Makes no fucking sense bBackstabbed = false; } +function HandleStoppingPower( + class damageType, + float headshotLevel +) { + local float strength; + local float actualMinStoppingThreshold, actualMaxStoppingEffect; + + strength = damageType.default.stoppingPower; + if (headshotLevel > 0.0) { + strength *= 2; + } + if (concussionCountdown > 0) { + actualMinStoppingThreshold = FMax(0.0, minStoppingThreshold - 0.2); + actualMaxStoppingEffect = FMin(0.9, maxStoppingEffect + 0.2); + } + else { + actualMinStoppingThreshold = minStoppingThreshold; + actualMaxStoppingEffect = maxStoppingEffect; + } + strength = FMax(0, strength - actualMinStoppingThreshold); + stoppingEffect = FMin(actualMaxStoppingEffect, stoppingEffect + strength); +} function TakeDamage(int damage, Pawn instigatedBy, Vector hitLocation, @@ -1798,7 +1817,6 @@ simulated function UnSetBurningBehavior(){ if(Role == Role_Authority){ Intelligence = default.Intelligence; if(!bZapped){ - SetGroundSpeed(GetOriginalGroundSpeed()); AirSpeed = default.AirSpeed; WaterSpeed = default.WaterSpeed; } @@ -1810,6 +1828,39 @@ simulated function UnSetBurningBehavior(){ WalkAnims[i] = default.WalkAnims[i]; } } +simulated function SetGroundSpeed(float newGroundSpeed) { + if (initializationComplete) { + UpdateGroundSpeed(); + } else { + // Let `KFMonster`'s code setup original speed for this zed. + // This is a hack to be removed later, when we'll be untangling + // initialization code + super.SetGroundSpeed(newGroundSpeed); + } +} +simulated function UpdateGroundSpeed() { + if (TryNonRelevantSpeedup()) { + return; + } + groundSpeed = GetOriginalGroundSpeed(); + groundSpeed *= (1.0 - stoppingEffect); + if (bDecapitated) { + groundSpeed *= 0.8; + } +} +// If this function returns `true`, then we shouldn't touch speed further, +// because a speed hack was used for the zed +simulated function bool TryNonRelevantSpeedup(){ + if(level.netMode == NM_Client || !CanSpeedAdjust()) { + return false; + } + if(level.timeSeconds - lastReplicateTime > 0.5) { + groundSpeed = default.groundSpeed * (300.0 / default.groundSpeed); + return true; + } + lastSeenOrRelevantTime = level.timeSeconds; + return false; +} simulated function ServerDropFaster(NiceHumanPawn nicePawn){ if(nicePawn == none) return; if(Health > 0) @@ -1827,7 +1878,7 @@ simulated function RemoveHead(){ if(kfDmgType != none && kfDmgType.default.bIsMeleeDamage) bMeleeDecapitated = true; SetAnimAction('HitF'); - SetGroundSpeed(GroundSpeed *= 0.80); + UpdateGroundSpeed(); // No more raspy breathin'...cuz he has no throat or mouth :S AmbientSound = MiscSound; if(Health > 0) @@ -2220,8 +2271,6 @@ defaultproperties lastStunTime=-1.000000 headDamageRecoveryRate=100.000000 headRecoveryTime=1.000000 - mind=1.000000 - accStunMindLvl=0.500000 bCanBurn=True fuelRatio=0.750000 heatDissipationRate=0.666000 @@ -2236,9 +2285,8 @@ defaultproperties RagdollLifeSpan=120.000000 ControllerClass=class'NiceMonsterController' stoppingEffect=0.0 - stoppingRecoveryStartTime=2.0 - stoppingRecoveryRate=0.5 - maxStoppingEffect=0.5 + stoppingRecoveryRate=0.025 + maxStoppingEffect=0.25 minStoppingThreshold=0.0 Begin Object Class=KarmaParamsSkel Name=KarmaParamsSkelN KConvulseSpacing=(Max=2.200000)