Add Composter

This commit is contained in:
Gurge44 committed 2025-10-17 11:27:52 +02:00
1 parent 390bede3bc
commit 93c25c5a2c
8 files changed
+38 -3

No files matched your search

+1
View File
@@ -506,6 +506,7 @@ public enum CustomRoles
Clumsy,
Commited,
Compelled,
Composter,
Contagious,
Damocles,
Deadlined,
+1
View File
@@ -656,6 +656,7 @@ public class Main : BasePlugin
{ CustomRoles.Listener, "#060270" },
{ CustomRoles.Unbound, "#DFC57B" },
{ CustomRoles.AntiTP, "#fcba03" },
{ CustomRoles.Composter, "#8D6F64" },
{ CustomRoles.TaskMaster, "#00ffa5" },
{ CustomRoles.Compelled, "#D2E44C" },
{ CustomRoles.Commited, "#f5c542" },
+1
View File
@@ -1098,6 +1098,7 @@ internal static class CustomRolesHelper
{
return role.IsAdditionRole() && (!Main.NeverSpawnTogetherCombos.TryGetValue(OptionItem.CurrentPreset, out Dictionary<CustomRoles, List<CustomRoles>> neverList) || !neverList.TryGetValue(pc.GetCustomRole(), out List<CustomRoles> bannedAddonList) || !bannedAddonList.Contains(role)) && pc.GetCustomRole() is not CustomRoles.GuardianAngelEHR and not CustomRoles.God && !pc.Is(CustomRoles.Madmate) && !pc.Is(CustomRoles.GM) && role is not CustomRoles.Lovers && !pc.Is(CustomRoles.Needy) && (!pc.HasSubRole() || pc.GetCustomSubRoles().Count < Options.NoLimitAddonsNumMax.GetInt()) && (!Options.AddonCanBeSettings.TryGetValue(role, out (OptionItem Imp, OptionItem Neutral, OptionItem Crew, OptionItem Coven) o) || ((o.Imp.GetBool() || !pc.GetCustomRole().IsImpostor()) && (o.Neutral.GetBool() || !pc.GetCustomRole().IsNeutral()) && (o.Crew.GetBool() || !pc.IsCrewmate()) && (o.Coven.GetBool() || !pc.Is(Team.Coven)))) && (!role.IsImpOnlyAddon() || (pc.IsImpostor() && !pc.Is(CustomRoles.DoubleAgent)) || (pc.Is(CustomRoles.Traitor) && Traitor.CanGetImpostorOnlyAddons.GetBool())) && role switch
{
CustomRoles.Composter when float.IsNaN(pc.GetAbilityUseLimit()) => false,
CustomRoles.Fragile when pc.Is(CustomRoles.SchrodingersCat) => false,
CustomRoles.TaskMaster when !pc.IsCrewmate() || !Utils.HasTasks(pc.Data, forRecompute: false) => false,
CustomRoles.Commited when pc.GetRoleTypes() is not (RoleTypes.Impostor or RoleTypes.Phantom or RoleTypes.Shapeshifter or RoleTypes.Viper) => false,
+6 -1
View File
@@ -484,7 +484,12 @@ public class TaskState
}
float add = Utils.GetSettingNameAndValueForRole(player.GetCustomRole(), "AbilityUseGainWithEachTaskCompleted");
if (Math.Abs(add - float.MaxValue) > 0.5f && add > 0) player.RpcIncreaseAbilityUseLimitBy(add);
if (Math.Abs(add - float.MaxValue) > 0.5f && add > 0)
{
if (player.Is(CustomRoles.Composter)) add *= Composter.AbilityUseGainMultiplier.GetFloat();
player.RpcIncreaseAbilityUseLimitBy(add);
}
}
try { Main.PlayerStates[player.PlayerId].Role.OnTaskComplete(player, CompletedTasksCount, AllTasksCount); }
+6 -1
View File
@@ -721,7 +721,12 @@ public static class Utils
if (Main.PlayerStates[killer.PlayerId].Role is Mafioso { IsEnable: true } mo) mo.OnMurder(killer, null);
float add = GetSettingNameAndValueForRole(killer.GetCustomRole(), "AbilityUseGainWithEachKill");
killer.RpcIncreaseAbilityUseLimitBy(add);
if (Math.Abs(add - float.MaxValue) > 0.5f && add > 0)
{
if (killer.Is(CustomRoles.Composter)) add *= Composter.AbilityUseGainMultiplier.GetFloat();
killer.RpcIncreaseAbilityUseLimitBy(add);
}
}
public static void ThrowException(Exception ex, [CallerFilePath] string fileName = "", [CallerLineNumber] int lineNumber = 0, [CallerMemberName] string callerMemberName = "")
+1 -1
View File
@@ -2002,7 +2002,7 @@ internal static class FixedUpdatePatch
if (Math.Abs(add - float.MaxValue) > 0.5f && add > 0)
{
if (player.Is(CustomRoles.Bloodlust)) add *= 5;
if (player.Is(CustomRoles.Composter)) add *= Composter.AbilityUseGainMultiplier.GetFloat();
player.RpcIncreaseAbilityUseLimitBy(add);
}
}
+5
View File
@@ -4390,6 +4390,11 @@
"FabricatorInfoLong": "(Impostors):\\nAs the Fabricator, you can use <b>/fabricate {deathreason}</b> to set the death reason for your next kill. Replace '{deathreason}' with one of the available death reasons in the mod.",
"Fabricator.InvalidDeathReason": "<#ff5555>X <#bb0000>Invalid death reason '<#ffffff>{0}</color>'!",
"Fabricator.SetDeathReason": "<#00ff00>✓ <#00bb00>Your next kill will have the death reason: <#ffffff>{0}</color>",
"Composter": "Composter",
"ComposterInfo": "You Gain More Ability Uses",
"ComposterInfoLong": "(Add-ons):\\nAs a Composter, you gain more ability uses by a set multiplier per task, kill, or after finishing tasks.",
"Composter.AbilityUseGainMultiplier": "Ability Use Gain Multiplier",
"Prefix.Composter": "Composter",
"Slenderman": "Slenderman",
"SlendermanInfo": "Everyone Gets Blinded Near You",
"SlendermanInfoLong": "(Neutrals):\\nAs the Slenderman, whenever someone gets close to you, they will be blinded until they move away from you.\\n\\nKill everyone to win!",
+17
View File
@@ -0,0 +1,17 @@
namespace EHR.AddOns.Common;
public class Composter : IAddon
{
public AddonTypes Type => AddonTypes.Helpful;
public static OptionItem AbilityUseGainMultiplier;
public void SetupCustomOption()
{
Options.SetupAdtRoleOptions(656000, CustomRoles.Composter, canSetNum: true, teamSpawnOptions: true);
AbilityUseGainMultiplier = new FloatOptionItem(656010, "Composter.AbilityUseGainMultiplier", new(1.05f, 10f, 0.05f), 1.5f, TabGroup.Addons)
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Composter])
.SetValueFormat(OptionFormat.Multiplier);
}
}