diff --git a/TeammateRevive/Configuration/PluginConfig.cs b/TeammateRevive/Configuration/PluginConfig.cs index ea271f9..33cecbe 100644 --- a/TeammateRevive/Configuration/PluginConfig.cs +++ b/TeammateRevive/Configuration/PluginConfig.cs @@ -220,10 +220,16 @@ static BindCollection BindRuleValues(ConfigFile configFile, ReviveRuleValues val defaultValue: values.CutReviveeHp) .Bind( key: "Death Curse chance", - description: "[Only with Death Curse enabled] Chance to receive Death Curse on revival (Range: 0-100%)", + description: "[Only with Death Curse enabled] Chance to receive Death Curse on revival for revivee (Range: 0-100%)", set: v => values.DeathCurseChance = v, defaultValue: values.DeathCurseChance, metadata: new FloatMetadata(0, 100, 1)) + .Bind( + key: "Reviver Death Curse chance", + description: "[Only with Death Curse enabled] Chance to receive Death Curse on revival for reviver (Range: 0-100%)", + set: v => values.ReviverDeathCurseChance = v, + defaultValue: values.ReviverDeathCurseChance, + metadata: new FloatMetadata(0, 100, 1)) .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.", diff --git a/TeammateRevive/Revive/RevivalTracker.cs b/TeammateRevive/Revive/RevivalTracker.cs index 698e076..1495dba 100644 --- a/TeammateRevive/Revive/RevivalTracker.cs +++ b/TeammateRevive/Revive/RevivalTracker.cs @@ -205,16 +205,19 @@ void Revive(Player dead) private void ApplyDeathCurses(Player dead, Player[] linkedPlayers) { // invert - from "chance to get curse" to "chance to avoid curse" - var percentChance = Mathf.Clamp(100 - rules.Values.DeathCurseChance, 0, 100); + var reviveeChance = Mathf.Clamp(100 - rules.Values.DeathCurseChance, 0, 100); + var reviverChance = Mathf.Clamp(100 - rules.Values.ReviverDeathCurseChance, 0, 100); - bool RollCurse(Player player, float extraLuck) + bool RollCurse(Player player, float chance, float extraLuck) { // negative luck - take largest roll value // if value > chance - roll is failed // therefore positive luck - outcome is more likely // using inverted roll, so clover sound effect will be triggered if clover is present var luckTotal = extraLuck + player.master.master.luck; - var curseAvoided = Util.CheckRoll(percentChance, luckTotal, player.master.master.luck > 0 ? player.master.master : null); + var curseAvoided = Util.CheckRoll(chance, luckTotal, player.master.master.luck > 0 ? player.master.master : null); + + Log.Info($"Rolled curse for {player.networkUser.userName}: {chance:F1}% (luck: {player.master.master.luck:F0}+{extraLuck:F0}). Success: {curseAvoided}"); if (!curseAvoided) { player.GiveItem(DeathCurse.ItemIndex); @@ -225,8 +228,7 @@ bool RollCurse(Player player, float extraLuck) }); return true; } - - Log.Info($"Rolled curse for {player.networkUser.userName}: {percentChance:F1}% (luck: {player.master.master.luck:F0}+{extraLuck:F0}). Success: {curseAvoided}"); + Chat.SendBroadcastChat(new Chat.SimpleChatMessage { baseToken = LanguageConsts.TEAMMATE_REVIVAL_UI_AVOIDED_CURSE, @@ -235,14 +237,15 @@ bool RollCurse(Player player, float extraLuck) return false; } - RollCurse(dead, dead.ItemCount(RevivalToken.Index)); + // roll for revivee + RollCurse(dead, reviveeChance, dead.ItemCount(RevivalToken.Index)); // the more time spent reviving this player - the greater chance to receive a curse var array = SortByLinkDuration(linkedPlayers, dead).ToArray(); for (var index = 0; index < array.Length; index++) { var player = array[index]; - if (RollCurse(player, index)) + if (RollCurse(player, reviverChance, index)) { // when at least one player received curse, stop rolling for other members break; diff --git a/TeammateRevive/Revive/Rules/ReviveRuleValues.cs b/TeammateRevive/Revive/Rules/ReviveRuleValues.cs index 3c5b19a..14b6927 100644 --- a/TeammateRevive/Revive/Rules/ReviveRuleValues.cs +++ b/TeammateRevive/Revive/Rules/ReviveRuleValues.cs @@ -33,6 +33,8 @@ public class ReviveRuleValues public float DeathCurseChance { get; set; } = 66f; + public float ReviverDeathCurseChance { get; set; } = 66f; + public ReviveRuleValues Clone() { return (ReviveRuleValues)MemberwiseClone();