mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
73 lines
2.3 KiB
C#
73 lines
2.3 KiB
C#
using System;
|
|
|
|
namespace EHR.Roles;
|
|
|
|
public class VoodooMaster : CovenBase
|
|
{
|
|
public static bool On;
|
|
|
|
private static OptionItem AbilityCooldown;
|
|
private static OptionItem AbilityUseLimit;
|
|
private static OptionItem CanVentBeforeNecronomicon;
|
|
private static OptionItem CanVentAfterNecronomicon;
|
|
|
|
protected override NecronomiconReceivePriorities NecronomiconReceivePriority => NecronomiconReceivePriorities.Random;
|
|
|
|
public override bool IsEnable => On;
|
|
|
|
public override void SetupCustomOption()
|
|
{
|
|
StartSetup(650050)
|
|
.AutoSetupOption(ref AbilityCooldown, 30f, new FloatValueRule(0f, 120f, 0.5f), OptionFormat.Seconds)
|
|
.AutoSetupOption(ref AbilityUseLimit, 5f, new FloatValueRule(0, 20, 1f), OptionFormat.Times)
|
|
.AutoSetupOption(ref CanVentBeforeNecronomicon, false)
|
|
.AutoSetupOption(ref CanVentAfterNecronomicon, true);
|
|
}
|
|
|
|
public override void Init()
|
|
{
|
|
On = false;
|
|
}
|
|
|
|
public override void Add(byte playerId)
|
|
{
|
|
On = true;
|
|
playerId.SetAbilityUseLimit(AbilityUseLimit.GetFloat());
|
|
}
|
|
|
|
public override bool CanUseImpostorVentButton(PlayerControl pc)
|
|
{
|
|
return HasNecronomicon ? CanVentAfterNecronomicon.GetBool() : CanVentBeforeNecronomicon.GetBool();
|
|
}
|
|
|
|
public override bool CanUseKillButton(PlayerControl pc)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public override void SetKillCooldown(byte id)
|
|
{
|
|
Main.AllPlayerKillCooldown[id] = AbilityCooldown.GetFloat();
|
|
}
|
|
|
|
public override bool OnCheckMurder(PlayerControl killer, PlayerControl target)
|
|
{
|
|
if (Thanos.IsImmune(target)) return HasNecronomicon;
|
|
|
|
if (killer.GetAbilityUseLimit() > 0)
|
|
{
|
|
RoleBase roleBase = Main.PlayerStates[target.PlayerId].Role;
|
|
Type type = roleBase.GetType();
|
|
|
|
if (type.GetMethod("OnCheckMurder")?.DeclaringType == type) roleBase.OnCheckMurder(target, target);
|
|
else if (type.GetMethod("OnPet")?.DeclaringType == type) roleBase.OnPet(target);
|
|
|
|
Logger.Info($"Explicit OnCheckMurder triggered for {target.GetNameWithRole()}", "VoodooMaster");
|
|
if (!HasNecronomicon) killer.SetKillCooldown(AbilityCooldown.GetFloat());
|
|
killer.RpcRemoveAbilityUse();
|
|
}
|
|
|
|
return HasNecronomicon;
|
|
}
|
|
}
|