Files
EndlessHostRoles/Roles/Crewmate/Sensor.cs
T

42 lines
1.4 KiB
C#

namespace EHR.Crewmate;
public class Sensor : RoleBase
{
public static bool On;
public static OptionItem ArrowDuration;
private static OptionItem AbilityUseLimit;
private static OptionItem AbilityUseGainWithEachTaskCompleted;
private static OptionItem AbilityChargesWhenFinishedTasks;
public override bool IsEnable => On;
private byte SensorId;
public override void SetupCustomOption()
{
StartSetup(656900)
.AutoSetupOption(ref ArrowDuration, 5, new IntegerValueRule(1, 60, 1), OptionFormat.Seconds)
.AutoSetupOption(ref AbilityUseLimit, 1f, new FloatValueRule(0, 20, 0.05f), OptionFormat.Times)
.AutoSetupOption(ref AbilityUseGainWithEachTaskCompleted, 0.5f, new FloatValueRule(0f, 5f, 0.05f), OptionFormat.Times)
.AutoSetupOption(ref AbilityChargesWhenFinishedTasks, 0.2f, new FloatValueRule(0f, 5f, 0.05f), OptionFormat.Times);
}
public override void Init()
{
On = false;
}
public override void Add(byte playerId)
{
On = true;
SensorId = playerId;
playerId.SetAbilityUseLimit(AbilityUseLimit.GetFloat());
}
public override string GetSuffix(PlayerControl seer, PlayerControl target, bool hud = false, bool meeting = false)
{
if (seer.PlayerId != SensorId || seer.PlayerId != target.PlayerId || hud || meeting) return string.Empty;
return TargetArrow.GetAllArrows(seer.PlayerId);
}
}