diff --git a/TeammateRevive/Configuration/PluginConfig.cs b/TeammateRevive/Configuration/PluginConfig.cs index 0388164..514b20f 100644 --- a/TeammateRevive/Configuration/PluginConfig.cs +++ b/TeammateRevive/Configuration/PluginConfig.cs @@ -156,7 +156,7 @@ static BindCollection BindRuleValues(ConfigFile configFile, ReviveRuleValues val defaultValue: values.ReduceReviveProgressFactor) .Bind( key: "Revive Link buff duration factor", - description: "[Only with Death Curse enabled] How long Revive Link buff will stay after player leave revive range. " + + description: "How long Revive Link buff will stay after player leave revive range. " + "\nBuffTime = TimeInCircle / ReduceReviveProgressFactor * ReviveLinkBuffTimeFactor + 1 second" + "\nBasically, when 1 - buff will be applied for exactly as long as it will take to remove all added revive progress (+1 second)." + "\nSo, when 0.5 - only half of that.", @@ -208,7 +208,12 @@ static BindCollection BindRuleValues(ConfigFile configFile, ReviveRuleValues val description: "[Only with Death Curse enabled] Chance to receive Death Curse on revival (Range: 0-100%)", set: v => values.DeathCurseChance = v, defaultValue: values.DeathCurseChance) - ; + .Bind( + key: "Post revive regeneration time", + description: "After reviving, 40% of revivee and linked revivers HP is restored. This value specify how long regeneration buff is active in seconds. If set to 0 - revive regen is disabled.", + set: v => values.PostReviveRegenDurationSec = v, + defaultValue: values.PostReviveRegenDurationSec + ); } } } \ No newline at end of file diff --git a/TeammateRevive/Content/ReviveRegen.cs b/TeammateRevive/Content/ReviveRegen.cs index 7eca04b..0cf878f 100644 --- a/TeammateRevive/Content/ReviveRegen.cs +++ b/TeammateRevive/Content/ReviveRegen.cs @@ -3,6 +3,7 @@ using TeammateRevive.Common; using TeammateRevive.Revive.Rules; using UnityEngine; +using UnityEngine.AddressableAssets; namespace TeammateRevive.Content { @@ -20,7 +21,7 @@ public ReviveRegen(ReviveRules rules) public override void Init() { - var sprite = LegacyResourcesAPI.Load("textures/bufficons/texBuffRegenBoostIcon"); + var sprite = Addressables.LoadAssetAsync("RoR2/Junk/Common/bdMeatRegenBoost.asset").WaitForCompletion().iconSprite; BuffDef buffDefinition = ScriptableObject.CreateInstance(); buffDefinition.name = Name; diff --git a/TeammateRevive/ProgressBar/ReviveProgressBarTracker.cs b/TeammateRevive/ProgressBar/ReviveProgressBarTracker.cs index 8f37931..e7c1e01 100644 --- a/TeammateRevive/ProgressBar/ReviveProgressBarTracker.cs +++ b/TeammateRevive/ProgressBar/ReviveProgressBarTracker.cs @@ -86,10 +86,7 @@ public void Update() { this.progressBar.SetFraction(this.trackingSkull.progress); this.progressBar.SetColor(this.trackingSkull.fractionPerSecond >= 0 ? PositiveProgressColor : NegativeProgressColor); - #if DEBUG - // for debug purposes, display speed and percentage this.progressBar.UpdateText(this.trackingSkull.PlayerName, this.trackingSkull.progress); - #endif } // player moved out of skull circle, queuing to hide @@ -106,6 +103,7 @@ public void Update() RemoveTracking(); } + // hiding based on time if (this.IsQueuedToHide && Time.time > this.queuedToHideAt) { Log.DebugMethod($"removing tracking after delay ({Time.time} > {this.queuedToHideAt})"); diff --git a/TeammateRevive/Revive/RevivalTracker.cs b/TeammateRevive/Revive/RevivalTracker.cs index a993274..80ea24a 100644 --- a/TeammateRevive/Revive/RevivalTracker.cs +++ b/TeammateRevive/Revive/RevivalTracker.cs @@ -144,10 +144,7 @@ public void Update() dead.reviveProgress = Mathf.Clamp01(dead.reviveProgress); // if player in range, update revive revive links - if (this.run.IsDeathCurseEnabled) - { - reviver.IncreaseReviveLinkDuration(dead, Time.deltaTime + Time.deltaTime / this.rules.Values.ReduceReviveProgressFactor * this.rules.Values.ReviveLinkBuffTimeFactor); - } + reviver.IncreaseReviveLinkDuration(dead, Time.deltaTime + Time.deltaTime / this.rules.Values.ReduceReviveProgressFactor * this.rules.Values.ReviveLinkBuffTimeFactor); DamageReviver(playerBody, dead); } @@ -168,7 +165,8 @@ public void Update() this.skullTracker.UpdateSkull(dead, insidePlayersHash, playersInRange, totalReviveSpeed); } - // update revive links + // update revive link buffs + // NOTE: revive links are tracked in Normal Mode, but no buff is displayed if (this.run.IsDeathCurseEnabled) UpdateReviveLinkBuffs(); @@ -196,8 +194,11 @@ void Revive(Player dead) player.RemoveReviveLink(dead); // add post-revive regeneration to revivers - foreach (var player in linkedPlayers) - player.GetBody().AddTimedBuff(ReviveRegen.Index, this.rules.Values.PostReviveRegenDurationSec); + if (this.rules.Values.PostReviveRegenDurationSec != 0) + { + foreach (var player in linkedPlayers) + player.GetBody().AddTimedBuff(ReviveRegen.Index, this.rules.Values.PostReviveRegenDurationSec); + } } private void ApplyDeathCurses(Player dead, Player[] linkedPlayers) diff --git a/TeammateRevive/Revive/Rules/SetRulesMessage.cs b/TeammateRevive/Revive/Rules/SetRulesMessage.cs index 90c9f41..f45870a 100644 --- a/TeammateRevive/Revive/Rules/SetRulesMessage.cs +++ b/TeammateRevive/Revive/Rules/SetRulesMessage.cs @@ -35,6 +35,7 @@ public void Serialize(NetworkWriter writer) writer.Write(this.ruleValues.DebugKeepSkulls); writer.Write(this.ruleValues.EnableRevivalToken); writer.Write(this.ruleValues.CutReviveeHp); + writer.Write(this.ruleValues.PostReviveRegenDurationSec); Log.Info("Sending new rule values"); } @@ -54,6 +55,7 @@ public void Deserialize(NetworkReader reader) this.ruleValues.DebugKeepSkulls = reader.ReadBoolean(); this.ruleValues.EnableRevivalToken = reader.ReadBoolean(); this.ruleValues.CutReviveeHp = reader.ReadBoolean(); + this.ruleValues.PostReviveRegenDurationSec = reader.ReadSingle(); } public void OnReceived()