Change cooldowns to only decrease on kills

This commit is contained in:
Anton Tarasenko 2024-11-26 02:10:50 +07:00
parent 4924e41e84
commit 3716813a7b
3 changed files with 26 additions and 13 deletions

View File

@ -74,6 +74,7 @@ State MatchInProgress{
function ScoreKill(Controller Killer, Controller Other)
{
local NicePlayerController niceKiller;
local PlayerReplicationInfo OtherPRI;
local float KillScore;
local Controller C;
@ -198,7 +199,10 @@ function ScoreKill(Controller Killer, Controller Other)
}
/* End Marco's Kill Messages */
niceKiller = NicePlayerController(killer);
if (niceKiller != none && niceKiller.abilityManager != none) {
niceKiller.abilityManager.AddToAllCooldowns(-1);
}
}
function DramaticEvent(float BaseZedTimePossibility, optional float DesiredZedTimeDuration){

View File

@ -334,7 +334,7 @@ simulated function UpdateMeleeInvincibility
nicePawn.TryExtendingInv(niceZed, false, headshotLevel > 0.0);
// Handle melee-cases
if(mainTarget && class<niceDamageTypeVetBerserker>(damageType) != none)
nicePawn.TryExtendingInv(niceZed, true, headshotLevel > 0.0);
nicePawn.TryExtendingInv(niceZed, true, headshotLevel > 0.0);
nicePawn.ApplyWeaponStats(nicePawn.weapon);
}
simulated function UpdateArdour(bool isKill, NicePlayerController nicePlayer){

View File

@ -29,19 +29,19 @@ struct NiceAbilityDescription{
// Image to be used as an ability's icon
var Texture icon;
// Default cooldown duration
var float cooldownLength;
var int cooldownLength;
// Can ability be canceled once activated?
var bool canBeCancelled;
var bool canBeCancelled;
};
// Complete description of current status of an ability,
// including it's complete description.
struct NiceAbilityStatus{
// Complete description of ability in question
var NiceAbilityDescription description;
var NiceAbilityDescription description;
// Current cooldown value
var float cooldown;
var int cooldown;
// Current state of an ability
var EAbilityState myState;
var EAbilityState myState;
};
var NiceAbilityStatus currentAbilities[5];
var int currentAbilitiesAmount;
@ -65,7 +65,7 @@ function AddAbility(NiceAbilityDescription description){
if(currentAbilities[i].description.ID ~= description.ID)
return;
newRecord.description = description;
newRecord.cooldown = 0.0;
newRecord.cooldown = 0;
newRecord.myState = ASTATE_READY;
currentAbilities[currentAbilitiesAmount] = newRecord;
currentAbilitiesAmount += 1;
@ -147,7 +147,7 @@ function SetAbilityState(int abilityIndex, EAbilityState newState){
// Changes ability's cooldown by a given amount.
// If this brings cooldown to zero or below -
// resets current ability to a 'ready' (ASTATE_READY) state.
function AddToCooldown(int abilityIndex, float delta){
function AddToCooldown(int abilityIndex, int delta){
if(abilityIndex < 0 || abilityIndex >= currentAbilitiesAmount) return;
if(currentAbilities[abilityIndex].myState != ASTATE_COOLDOWN) return;
currentAbilities[abilityIndex].cooldown += delta;
@ -155,12 +155,21 @@ function AddToCooldown(int abilityIndex, float delta){
SetAbilityState(abilityIndex, ASTATE_READY);
hackCounter ++;
}
function Tick(float deltaTime){
function AddToAllCooldowns(int delta){
local int i;
if(Role != Role_AUTHORITY) return;
for(i = 0;i < currentAbilitiesAmount;i ++)
AddToCooldown(i, -deltaTime);
for (i = 0; i < currentAbilitiesAmount; i += 1) {
if (currentAbilities[i].myState == ASTATE_COOLDOWN) {
currentAbilities[i].cooldown += delta;
if(currentAbilities[i].cooldown <= 0) {
SetAbilityState(i, ASTATE_READY);
}
}
}
hackCounter ++;
}
defaultproperties
{
maxAbilitiesAmount=5