Add limit to the damage from quad damage skill

This commit is contained in:
Anton Tarasenko 2024-11-26 03:33:21 +07:00
parent 3716813a7b
commit a3f4baabc6
6 changed files with 67 additions and 28 deletions

View File

@ -260,6 +260,21 @@ function PostRender(Canvas C)
}
}
//// Draw quad damage bar
if (nicePawn != none && nicePawn.quadDamageRemaining > 0.0)
{
C.SetDrawColor(255, 255, 255);
barTexture = redBar;
center = C.ClipX * 0.5;
y = C.ClipY * 0.45;
barWidth = C.ClipX * 0.2;
barWidth *= nicePawn.quadDamageRemaining / class'NiceSkillEnforcerBruteA'.default.maximumDamageAdded;
x = center - (barWidth / 2);
C.SetPos(x, y);
Log("DRAWING" @ x @ y @ barWidth);
C.DrawTile(barTexture, barWidth, 32, 0, 0, barTexture.MaterialUSize(), barTexture.MaterialVSize());
}//native(466) final function DrawTile( material Mat, float XL, float YL, float U, float V, float UL, float VL );
team = C.ViewPort.Actor.Pawn.PlayerReplicationInfo.Team;
//// Draw health still in regen timer
healthToGive = ScrnHumanPawn(C.ViewPort.Actor.Pawn).clientHealthToGive;

View File

@ -46,10 +46,11 @@ struct InvincExtentions{
var array<InvincExtentions> zedInvExtList;
var int headshotStack;
var float bruteTimer;
var float quadDamageRemaining;
replication{
reliable if(Role == ROLE_Authority)
headshotStack, hmgShieldLevel, forcedZedTimeCountDown, maniacTimeout, invincibilityTimer, safeMeleeMisses, ffScale,
currentCalibrationState, calibrationScore, gunslingerTimer;
currentCalibrationState, calibrationScore, gunslingerTimer, quadDamageRemaining;
reliable if(Role == ROLE_Authority)
ClientChangeWeapon;
reliable if(Role < ROLE_AUTHORITY)

View File

@ -120,28 +120,28 @@ function SetAbilityState(int abilityIndex, EAbilityState newState){
if(abilityIndex < 0 || abilityIndex >= currentAbilitiesAmount) return;
currentState = currentAbilities[abilityIndex].myState;
if(currentState == newState)
return;
return;
if( currentState == ASTATE_ACTIVE && newState == ASTATE_READY
&& !currentAbilities[abilityIndex].description.canBeCancelled)
return;
&& !currentAbilities[abilityIndex].description.canBeCancelled)
return;
currentAbilities[abilityIndex].myState = newState;
if(newState == ASTATE_COOLDOWN){
cooldown = currentAbilities[abilityIndex].description.cooldownLength;
events.static.CallModAbilityCooldown(
currentAbilities[abilityIndex].description.ID,
relatedPlayer,
cooldown
);
currentAbilities[abilityIndex].cooldown = cooldown;
cooldown = currentAbilities[abilityIndex].description.cooldownLength;
events.static.CallModAbilityCooldown(
currentAbilities[abilityIndex].description.ID,
relatedPlayer,
cooldown
);
currentAbilities[abilityIndex].cooldown = cooldown;
}
hackCounter ++;
netUpdateTime = level.timeSeconds - 1;
// Fire off events
if(newState == ASTATE_ACTIVE){
events.static.CallAbilityActivated(
currentAbilities[abilityIndex].description.ID,
relatedPlayer
);
events.static.CallAbilityActivated(
currentAbilities[abilityIndex].description.ID,
relatedPlayer
);
}
}
// Changes ability's cooldown by a given amount.

View File

@ -15,7 +15,6 @@ static function AbilityActivated(
NicePlayerController relatedPlayer)
{
local NiceHumanPawn nicePawn;
local NiceMonster victim;
if (relatedPlayer == none) return;
nicePawn = NiceHumanPawn(relatedPlayer.pawn);
@ -37,6 +36,23 @@ static function AbilityActivated(
{
nicePawn.bruteTimer =
class'NiceSkillEnforcerBruteA'.default.abilityDuration;
nicePawn.quadDamageRemaining = class'NiceSkillEnforcerBruteA'.default.maximumDamageAdded;
}
}
static function ModAbilityCooldown( string abilityID,
NicePlayerController relatedPlayer,
out float cooldown)
{
local NiceHumanPawn nicePawn;
if (relatedPlayer == none) return;
nicePawn = NiceHumanPawn(relatedPlayer.pawn);
if (nicePawn == none) return;
if (abilityID == "brute")
{
nicePawn.quadDamageRemaining = 0;
}
}

View File

@ -16,12 +16,15 @@ static function array<int> GetProgressArray(byte ReqNum, optional out int Double
// Other bonuses
static function int AddDamage(KFPlayerReplicationInfo KFPRI, KFMonster Injured, KFPawn DamageTaker, int InDamage, class<DamageType> DmgType)
{
local float fDamage;
local int bruteAbilityIndex;
local float fDamage, addedDamage;
local NicePlayerController nicePlayer;
local NiceHumanPawn nicePawn;
local NiceMonster niceTarget;
fDamage = float(InDamage);
nicePlayer = NicePlayerController(KFPRI.Owner);
nicePawn = NiceHumanPawn(nicePlayer.pawn);
niceTarget = NiceMonster(injured);
if ( niceTarget != none
&& niceTarget.bFrozenZed
@ -31,9 +34,20 @@ static function int AddDamage(KFPlayerReplicationInfo KFPRI, KFMonster Injured,
(1 + class'NiceSkillEnforcerFinisherRounds'.default.damageBonus);
}
if( nicePlayer != none && nicePlayer.abilityManager != none
&& nicePawn != none && nicePawn.quadDamageRemaining > 0
&& nicePlayer.abilityManager.IsAbilityActive(class'NiceSkillEnforcerBruteA'.default.abilityID))
{
fDamage *= class'NiceSkillEnforcerBruteA'.default.damageMult;
addedDamage = fDamage * class'NiceSkillEnforcerBruteA'.default.damageMult - fDamage;
if (addedDamage >= nicePawn.quadDamageRemaining) {
addedDamage = nicePawn.quadDamageRemaining;
nicePawn.quadDamageRemaining = 0.0;
bruteAbilityIndex = nicePlayer.abilityManager.GetAbilityIndex(class'NiceSkillEnforcerBruteA'.default.abilityID);
nicePlayer.abilityManager.SetAbilityState(bruteAbilityIndex, ASTATE_COOLDOWN);
}
else {
nicePawn.quadDamageRemaining -= addedDamage;
}
fDamage += addedDamage;
}
return int(fDamage);
}
@ -45,7 +59,7 @@ static function float GetPenetrationDamageMulti(KFPlayerReplicationInfo KFPRI, f
return DefaultPenDamageReduction;
if(HasSkill(NicePlayerController(KFPRI.Owner), class'NiceSkillSupportStubbornness'))
bonusReduction = class'NiceSkillSupportStubbornness'.default.penLossRed;
PenDamageInverse = (1.0 - FMax(0, DefaultPenDamageReduction));
PenDamageInverse = (1.0 - FMax(0, DefaultPenDamageReduction));
return DefaultPenDamageReduction + PenDamageInverse * (0.6 + 0.4 * bonusReduction); // 60% better penetrations + bonus
}
@ -64,15 +78,6 @@ static function class<Grenade> GetNadeType(KFPlayerReplicationInfo KFPRI){
return class'NiceCryoNade';
}
static function float AddExtraAmmoFor(KFPlayerReplicationInfo KFPRI, Class<Ammunition> AmmoType){
local float bonusNades;
// Default bonus
bonusNades = 2;
if(AmmoType == class'FragAmmo')
return 1.0 + 0.2 * bonusNades;
return 1.0;
}
static function int ReduceDamage(KFPlayerReplicationInfo KFPRI, KFPawn Injured, Pawn Instigator, int InDamage, class<DamageType> DmgType){
local float fDamage;
fDamage = float(inDamage);

View File

@ -5,6 +5,7 @@ var string abilityID;
var float coolDown;
var float abilityDuration;
var float damageMult;
var float maximumDamageAdded;
function static SkillSelected(NicePlayerController nicePlayer)
{
@ -29,6 +30,7 @@ function static SkillDeSelected(NicePlayerController nicePlayer)
defaultproperties
{
maximumDamageAdded=10000
abilityID="brute"
cooldown=60.000000
abilityDuration=5.0