mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
Shifter uses pet to steal role & HUD override text cleanup
This commit is contained in:
1 parent
dd72a5c62f
commit
c4d1b6cbc7
35 files changed
+262
-247
No files matched your search
@@ -24,6 +24,7 @@ internal static class CustomRolesHelper
|
||||
CustomRoles.Sentry,
|
||||
CustomRoles.Cherokious,
|
||||
CustomRoles.Chemist,
|
||||
CustomRoles.Shifter,
|
||||
|
||||
// HnS
|
||||
CustomRoles.Jet,
|
||||
@@ -699,8 +700,9 @@ internal static class CustomRolesHelper
|
||||
CustomRoles.Refugee => true,
|
||||
CustomRoles.Necromancer => true,
|
||||
CustomRoles.Deathknight => true,
|
||||
CustomRoles.Shifter => true,
|
||||
|
||||
_ => false,
|
||||
_ => false
|
||||
};
|
||||
|
||||
public static bool OnlySpawnsWithPets(this CustomRoles role) => OnlySpawnsWithPetsRoleList.Contains(role);
|
||||
|
||||
+19
-165
@@ -4,7 +4,6 @@ using System.Linq;
|
||||
using EHR.Modules;
|
||||
using EHR.Roles.AddOns.Common;
|
||||
using EHR.Roles.Crewmate;
|
||||
using EHR.Roles.Impostor;
|
||||
using EHR.Roles.Neutral;
|
||||
using HarmonyLib;
|
||||
using Il2CppSystem.Text;
|
||||
@@ -156,7 +155,9 @@ class HudManagerPatch
|
||||
{
|
||||
if (player.IsAlive() || Options.CurrentGameMode != CustomGameMode.Standard)
|
||||
{
|
||||
bool usesPetInsteadOfKill = player.GetCustomRole().UsesPetInsteadOfKill();
|
||||
var role = player.GetCustomRole();
|
||||
|
||||
bool usesPetInsteadOfKill = role.UsesPetInsteadOfKill();
|
||||
if (usesPetInsteadOfKill)
|
||||
{
|
||||
__instance.PetButton?.OverrideText(GetString("KillButtonText"));
|
||||
@@ -165,187 +166,40 @@ class HudManagerPatch
|
||||
ActionButton usedButton = __instance.KillButton;
|
||||
if (usesPetInsteadOfKill) usedButton = __instance.PetButton;
|
||||
|
||||
__instance.KillButton?.OverrideText(GetString("KillButtonText"));
|
||||
__instance.ReportButton?.OverrideText(GetString("ReportButtonText"));
|
||||
__instance.PetButton?.OverrideText(GetString("PetButtonText"));
|
||||
__instance.ImpostorVentButton?.OverrideText(GetString("VentButtonText"));
|
||||
__instance.SabotageButton?.OverrideText(GetString("SabotageButtonText"));
|
||||
|
||||
__instance.AbilityButton?.OverrideText(GetString($"AbilityButtonText.{player.GetRoleTypes()}"));
|
||||
|
||||
Main.PlayerStates[player.PlayerId].Role.SetButtonTexts(__instance, player.PlayerId);
|
||||
|
||||
switch (player.GetCustomRole())
|
||||
switch (role)
|
||||
{
|
||||
case CustomRoles.Sentry:
|
||||
__instance.PetButton?.OverrideText(GetString("SentryPetButtonText"));
|
||||
break;
|
||||
case CustomRoles.FireWorks:
|
||||
__instance.AbilityButton?.OverrideText((Main.PlayerStates[player.PlayerId].Role as FireWorks).nowFireWorksCount == 0 ? GetString("FireWorksExplosionButtonText") : GetString("FireWorksInstallAtionButtonText"));
|
||||
break;
|
||||
case CustomRoles.Swiftclaw:
|
||||
__instance.PetButton?.OverrideText(GetString("SwiftclawKillButtonText"));
|
||||
break;
|
||||
case CustomRoles.Pestilence:
|
||||
__instance.KillButton?.OverrideText(GetString("KillButtonText"));
|
||||
break;
|
||||
case CustomRoles.PlagueDoctor:
|
||||
case CustomRoles.PlagueBearer:
|
||||
__instance.KillButton?.OverrideText(GetString("InfectiousKillButtonText"));
|
||||
break;
|
||||
case CustomRoles.Witch:
|
||||
Witch.GetAbilityButtonText(__instance);
|
||||
break;
|
||||
case CustomRoles.Arsonist:
|
||||
__instance.KillButton?.OverrideText(GetString("ArsonistDouseButtonText"));
|
||||
__instance.ImpostorVentButton.buttonLabelText.text = GetString("ArsonistVentButtonText");
|
||||
break;
|
||||
case CustomRoles.Farseer:
|
||||
usedButton?.OverrideText(GetString("FarseerKillButtonText"));
|
||||
break;
|
||||
case CustomRoles.Capitalism:
|
||||
__instance.KillButton?.OverrideText(GetString("CapitalismButtonText"));
|
||||
break;
|
||||
case CustomRoles.Pelican:
|
||||
__instance.KillButton?.OverrideText(GetString("PelicanButtonText"));
|
||||
case CustomRoles.Escort:
|
||||
case CustomRoles.Gaulois:
|
||||
case CustomRoles.Sheriff:
|
||||
case CustomRoles.Crusader:
|
||||
case CustomRoles.Monarch:
|
||||
usedButton?.OverrideText(GetString($"{role}KillButtonText"));
|
||||
break;
|
||||
case CustomRoles.Analyst:
|
||||
usedButton?.OverrideText(GetString("AnalyzerKillButtonText"));
|
||||
break;
|
||||
case CustomRoles.Pursuer:
|
||||
__instance.KillButton?.OverrideText(GetString("PursuerButtonText"));
|
||||
break;
|
||||
case CustomRoles.Postman:
|
||||
__instance.KillButton?.OverrideText(GetString("PostmanKillButtonText"));
|
||||
break;
|
||||
case CustomRoles.Escort:
|
||||
usedButton?.OverrideText(GetString("EscortKillButtonText"));
|
||||
break;
|
||||
case CustomRoles.Glitch:
|
||||
__instance.SabotageButton?.OverrideText(GetString("HackButtonText"));
|
||||
break;
|
||||
case CustomRoles.FFF:
|
||||
__instance.KillButton?.OverrideText(GetString("FFFButtonText"));
|
||||
break;
|
||||
case CustomRoles.Gaulois:
|
||||
usedButton?.OverrideText(GetString("GauloisKillButtonText"));
|
||||
break;
|
||||
case CustomRoles.Aid:
|
||||
case CustomRoles.DonutDelivery:
|
||||
case CustomRoles.Medic:
|
||||
usedButton?.OverrideText(GetString("MedicalerButtonText"));
|
||||
break;
|
||||
case CustomRoles.Gamer:
|
||||
__instance.KillButton?.OverrideText(GetString("GamerButtonText"));
|
||||
break;
|
||||
case CustomRoles.BallLightning:
|
||||
__instance.KillButton?.OverrideText(GetString("BallLightningButtonText"));
|
||||
break;
|
||||
case CustomRoles.Sapper:
|
||||
if (Options.UsePets.GetBool()) __instance.PetButton?.OverrideText(GetString("BomberShapeshiftText"));
|
||||
else __instance.AbilityButton?.OverrideText(GetString("BomberShapeshiftText"));
|
||||
break;
|
||||
case CustomRoles.Twister:
|
||||
if (Options.UsePets.GetBool())
|
||||
{
|
||||
__instance.PetButton?.OverrideText(GetString("TwisterButtonText"));
|
||||
}
|
||||
else
|
||||
{
|
||||
__instance.AbilityButton?.OverrideText(GetString("TwisterButtonText"));
|
||||
__instance.AbilityButton?.SetUsesRemaining((int)player.GetAbilityUseLimit());
|
||||
}
|
||||
|
||||
break;
|
||||
case CustomRoles.QuickShooter:
|
||||
if (Options.UsePets.GetBool())
|
||||
{
|
||||
__instance.PetButton?.OverrideText(GetString("QuickShooterShapeshiftText"));
|
||||
}
|
||||
else
|
||||
{
|
||||
__instance.AbilityButton?.OverrideText(GetString("QuickShooterShapeshiftText"));
|
||||
__instance.AbilityButton?.SetUsesRemaining(QuickShooter.ShotLimit.GetValueOrDefault(PlayerControl.LocalPlayer.PlayerId, 0));
|
||||
}
|
||||
|
||||
break;
|
||||
case CustomRoles.Camouflager:
|
||||
__instance.AbilityButton?.OverrideText(GetString("CamouflagerShapeshiftText"));
|
||||
__instance.AbilityButton?.SetUsesRemaining((int)PlayerControl.LocalPlayer.GetAbilityUseLimit());
|
||||
break;
|
||||
case CustomRoles.OverKiller:
|
||||
__instance.KillButton?.OverrideText(GetString("OverKillerButtonText"));
|
||||
break;
|
||||
case CustomRoles.KB_Normal:
|
||||
__instance.KillButton?.OverrideText(GetString("GamerButtonText"));
|
||||
break;
|
||||
case CustomRoles.Medusa:
|
||||
__instance.KillButton?.OverrideText(GetString("KillButtonText"));
|
||||
__instance.ReportButton?.OverrideText(GetString("MedusaReportButtonText"));
|
||||
break;
|
||||
case CustomRoles.Vulture:
|
||||
__instance.ReportButton?.OverrideText(GetString("VultureEatButtonText"));
|
||||
break;
|
||||
case CustomRoles.Disperser:
|
||||
if (Options.UsePets.GetBool())
|
||||
{
|
||||
__instance.PetButton?.OverrideText(GetString("DisperserVentButtonText"));
|
||||
}
|
||||
else
|
||||
{
|
||||
__instance.AbilityButton?.OverrideText(GetString("DisperserVentButtonText"));
|
||||
__instance.AbilityButton?.SetUsesRemaining((int)player.GetAbilityUseLimit());
|
||||
}
|
||||
|
||||
break;
|
||||
case CustomRoles.Sheriff:
|
||||
usedButton?.OverrideText(GetString("SheriffKillButtonText"));
|
||||
break;
|
||||
case CustomRoles.Crusader:
|
||||
usedButton?.OverrideText(GetString("CrusaderKillButtonText"));
|
||||
break;
|
||||
case CustomRoles.Totocalcio:
|
||||
__instance.KillButton?.OverrideText(GetString("TotocalcioKillButtonText"));
|
||||
break;
|
||||
case CustomRoles.Romantic:
|
||||
__instance.KillButton?.OverrideText(!Romantic.HasPickedPartner ? GetString("RomanticKillButtonText") : GetString("MedicalerButtonText"));
|
||||
break;
|
||||
case CustomRoles.VengefulRomantic:
|
||||
__instance.KillButton?.OverrideText(GetString("VengefulRomanticKillButtonText"));
|
||||
break;
|
||||
case CustomRoles.Succubus:
|
||||
__instance.KillButton?.OverrideText(GetString("SuccubusKillButtonText"));
|
||||
break;
|
||||
case CustomRoles.Amnesiac:
|
||||
ActionButton amneButton = Amnesiac.RememberMode.GetValue() == 0 ? __instance.KillButton : __instance.ReportButton;
|
||||
amneButton?.OverrideText(GetString("RememberButtonText"));
|
||||
break;
|
||||
case CustomRoles.Monarch:
|
||||
usedButton?.OverrideText(GetString("MonarchKillButtonText"));
|
||||
break;
|
||||
case CustomRoles.Deputy:
|
||||
usedButton?.OverrideText(GetString("DeputyHandcuffText"));
|
||||
break;
|
||||
case CustomRoles.Hangman:
|
||||
if (shapeshifting) __instance.KillButton?.OverrideText(GetString("HangmanKillButtonTextDuringSS"));
|
||||
__instance.AbilityButton?.SetUsesRemaining((int)player.GetAbilityUseLimit());
|
||||
break;
|
||||
case CustomRoles.Sidekick:
|
||||
__instance.KillButton?.OverrideText(GetString("KillButtonText"));
|
||||
__instance.ImpostorVentButton?.OverrideText(GetString("ReportButtonText"));
|
||||
__instance.SabotageButton?.OverrideText(GetString("SabotageButtonText"));
|
||||
break;
|
||||
case CustomRoles.Addict:
|
||||
__instance.AbilityButton?.OverrideText(GetString("AddictVentButtonText"));
|
||||
break;
|
||||
case CustomRoles.Alchemist:
|
||||
if (Options.UsePets.GetBool())
|
||||
__instance.PetButton?.OverrideText(GetString("AlchemistVentButtonText"));
|
||||
else
|
||||
__instance.AbilityButton?.OverrideText(GetString("AlchemistVentButtonText"));
|
||||
break;
|
||||
case CustomRoles.Dazzler:
|
||||
__instance.AbilityButton?.OverrideText(GetString("DazzleButtonText"));
|
||||
__instance.AbilityButton?.SetUsesRemaining((int)PlayerControl.LocalPlayer.GetAbilityUseLimit());
|
||||
break;
|
||||
case CustomRoles.Deathpact:
|
||||
__instance.AbilityButton?.OverrideText(GetString("DeathpactButtonText"));
|
||||
break;
|
||||
case CustomRoles.Devourer:
|
||||
__instance.AbilityButton?.OverrideText(GetString("DevourerButtonText"));
|
||||
break;
|
||||
}
|
||||
|
||||
if (LowerInfoText == null)
|
||||
@@ -388,7 +242,7 @@ class HudManagerPatch
|
||||
LowerInfoText.enabled = false;
|
||||
}
|
||||
|
||||
if (player.CanUseKillButton() && !player.GetCustomRole().UsesPetInsteadOfKill())
|
||||
if (player.CanUseKillButton() && !role.UsesPetInsteadOfKill())
|
||||
{
|
||||
__instance.KillButton?.ToggleVisible(player.IsAlive() && GameStates.IsInTask);
|
||||
player.Data.Role.CanUseKillButton = true;
|
||||
|
||||
@@ -20,10 +20,12 @@ namespace EHR.Roles.Crewmate
|
||||
public static OptionItem SpeedWhileImmortal;
|
||||
public static OptionItem FreezeTimeAfterImmortal;
|
||||
|
||||
private float SuicideTimer = -10f;
|
||||
private static float DefaultSpeed;
|
||||
private float ImmortalTimer = 420f;
|
||||
|
||||
private static float DefaultSpeed;
|
||||
private float SuicideTimer = -10f;
|
||||
|
||||
public override bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
public static void SetupCustomOption()
|
||||
{
|
||||
@@ -56,8 +58,6 @@ namespace EHR.Roles.Crewmate
|
||||
DefaultSpeed = Main.AllPlayerSpeed[playerId];
|
||||
}
|
||||
|
||||
public override bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
bool IsImmortal(PlayerControl player) => player.Is(CustomRoles.Addict) && ImmortalTimer <= ImmortalTimeAfterVent.GetFloat();
|
||||
|
||||
public override void OnReportDeadBody()
|
||||
@@ -132,5 +132,10 @@ namespace EHR.Roles.Crewmate
|
||||
addict.MarkDirtySettings();
|
||||
}, FreezeTimeAfterImmortal.GetFloat(), "AddictGetDown");
|
||||
}
|
||||
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
hud.AbilityButton?.OverrideText(Translator.GetString("AddictVentButtonText"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -422,5 +422,13 @@ namespace EHR.Roles.Crewmate
|
||||
{
|
||||
return !IsProtected;
|
||||
}
|
||||
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
if (UsePets.GetBool())
|
||||
hud.PetButton?.OverrideText(GetString("AlchemistVentButtonText"));
|
||||
else
|
||||
hud.AbilityButton?.OverrideText(GetString("AlchemistVentButtonText"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -207,5 +207,10 @@ namespace EHR.Roles.Impostor
|
||||
{
|
||||
DeadBodiesInRoom.Clear();
|
||||
}
|
||||
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
hud.PetButton?.OverrideText(Translator.GetString("SentryPetButtonText"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,8 @@ public class BallLightning : RoleBase
|
||||
private static List<byte> GhostPlayer = [];
|
||||
private static Dictionary<byte, PlayerControl> RealKiller = [];
|
||||
|
||||
public override bool IsEnable => playerIdList.Count > 0 || Randomizer.Exists;
|
||||
|
||||
public static void SetupCustomOption()
|
||||
{
|
||||
SetupRoleOptions(Id, TabGroup.ImpostorRoles, CustomRoles.BallLightning);
|
||||
@@ -43,8 +45,6 @@ public class BallLightning : RoleBase
|
||||
playerIdList.Add(playerId);
|
||||
}
|
||||
|
||||
public override bool IsEnable => playerIdList.Count > 0 || Randomizer.Exists;
|
||||
|
||||
private static void SendRPC(byte playerId)
|
||||
{
|
||||
if (!Utils.DoRPC) return;
|
||||
@@ -178,4 +178,9 @@ public class BallLightning : RoleBase
|
||||
GhostPlayer = [];
|
||||
SendRPC(byte.MaxValue);
|
||||
}
|
||||
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
hud.KillButton?.OverrideText(Translator.GetString("BallLightningButtonText"));
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,8 @@ namespace EHR.Roles.Impostor
|
||||
public static bool IsActive;
|
||||
public static bool On;
|
||||
|
||||
public override bool IsEnable => On;
|
||||
|
||||
public static void SetupCustomOption()
|
||||
{
|
||||
Options.SetupSingleRoleOptions(Id, TabGroup.ImpostorRoles, CustomRoles.Camouflager);
|
||||
@@ -49,8 +51,6 @@ namespace EHR.Roles.Impostor
|
||||
On = true;
|
||||
}
|
||||
|
||||
public override bool IsEnable => On;
|
||||
|
||||
public override bool OnShapeshift(PlayerControl pc, PlayerControl target, bool shapeshifting)
|
||||
{
|
||||
if (shapeshifting && pc.GetAbilityUseLimit() < 1)
|
||||
@@ -87,5 +87,11 @@ namespace EHR.Roles.Impostor
|
||||
Utils.NotifyRoles(ForceLoop: true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
hud.AbilityButton?.OverrideText(Translator.GetString("CamouflagerShapeshiftText"));
|
||||
hud.AbilityButton?.SetUsesRemaining((int)id.GetAbilityUseLimit());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,14 +9,14 @@ namespace EHR.Roles.Impostor
|
||||
{
|
||||
public static List<byte> CleanerBodies = [];
|
||||
|
||||
private bool HasImpostorVision;
|
||||
public static bool On;
|
||||
private bool CanVent;
|
||||
private float KillCooldown;
|
||||
private float KCDAfterClean;
|
||||
|
||||
private bool HasImpostorVision;
|
||||
|
||||
private bool IsMedusa;
|
||||
|
||||
public static bool On;
|
||||
private float KCDAfterClean;
|
||||
private float KillCooldown;
|
||||
public override bool IsEnable => On;
|
||||
|
||||
public static void SetupCustomOption()
|
||||
@@ -74,7 +74,12 @@ namespace EHR.Roles.Impostor
|
||||
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
hud.ReportButton?.OverrideText(Translator.GetString("CleanerReportButtonText"));
|
||||
if (IsMedusa)
|
||||
{
|
||||
hud.KillButton?.OverrideText(Translator.GetString("KillButtonText"));
|
||||
hud.ReportButton?.OverrideText(Translator.GetString("MedusaReportButtonText"));
|
||||
}
|
||||
else hud.ReportButton?.OverrideText(Translator.GetString("CleanerReportButtonText"));
|
||||
}
|
||||
|
||||
public override bool CheckReportDeadBody(PlayerControl cleaner, GameData.PlayerInfo target, PlayerControl killer)
|
||||
|
||||
@@ -11,8 +11,6 @@ namespace EHR.Roles.Impostor
|
||||
private const int Id = 3500;
|
||||
public static List<byte> playerIdList = [];
|
||||
|
||||
public List<byte> PlayersDazzled = [];
|
||||
|
||||
private static OptionItem KillCooldown;
|
||||
private static OptionItem ShapeshiftCooldown;
|
||||
private static OptionItem CauseVision;
|
||||
@@ -20,6 +18,10 @@ namespace EHR.Roles.Impostor
|
||||
private static OptionItem ResetDazzledVisionOnDeath;
|
||||
public static OptionItem DazzlerAbilityUseGainWithEachKill;
|
||||
|
||||
public List<byte> PlayersDazzled = [];
|
||||
|
||||
public override bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
public static void SetupCustomOption()
|
||||
{
|
||||
SetupRoleOptions(Id, TabGroup.ImpostorRoles, CustomRoles.Dazzler);
|
||||
@@ -56,8 +58,6 @@ namespace EHR.Roles.Impostor
|
||||
AURoleOptions.ShapeshifterDuration = 1f;
|
||||
}
|
||||
|
||||
public override bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
public override void SetKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = KillCooldown.GetFloat();
|
||||
|
||||
public override bool OnShapeshift(PlayerControl pc, PlayerControl target, bool shapeshifting)
|
||||
@@ -89,5 +89,11 @@ namespace EHR.Roles.Impostor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
hud.AbilityButton?.OverrideText(GetString("DazzleButtonText"));
|
||||
hud.AbilityButton?.SetUsesRemaining((int)id.GetAbilityUseLimit());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -306,5 +306,10 @@ namespace EHR.Roles.Impostor
|
||||
ClearDeathpact(deathpact);
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
hud.AbilityButton?.OverrideText(GetString("DeathpactButtonText"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,23 +9,19 @@ namespace EHR.Roles.Impostor
|
||||
{
|
||||
public class Devourer : RoleBase
|
||||
{
|
||||
private const int Id = 3550;
|
||||
private static readonly GameData.PlayerOutfit ConsumedOutfit = new GameData.PlayerOutfit().Set("", 15, "", "", "visor_Crack", "", "");
|
||||
private static Dictionary<byte, GameData.PlayerOutfit> OriginalPlayerSkins = [];
|
||||
|
||||
private const int Id = 3550;
|
||||
public static List<byte> playerIdList = [];
|
||||
|
||||
private static OptionItem DefaultKillCooldown;
|
||||
private static OptionItem ReduceKillCooldown;
|
||||
private static OptionItem MinKillCooldown;
|
||||
|
||||
private static OptionItem ShapeshiftCooldown;
|
||||
|
||||
// private static OptionItem ShapeshiftDuration;
|
||||
public static OptionItem HideNameOfConsumedPlayer;
|
||||
private float NowCooldown;
|
||||
|
||||
public List<byte> PlayerSkinsCosumed = [];
|
||||
private float NowCooldown;
|
||||
|
||||
public override bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
@@ -144,5 +140,10 @@ namespace EHR.Roles.Impostor
|
||||
|
||||
sender.SendMessage();
|
||||
}
|
||||
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
hud.AbilityButton?.OverrideText(GetString("DevourerButtonText"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -82,6 +82,15 @@ public class Disperser : RoleBase
|
||||
public override void SetButtonTexts(HudManager __instance, byte id)
|
||||
{
|
||||
__instance.AbilityButton.ToggleVisible(GetPlayerById(id).IsAlive());
|
||||
__instance.AbilityButton.OverrideText(GetString("DisperserVentButtonText"));
|
||||
|
||||
if (UsePets.GetBool())
|
||||
{
|
||||
__instance.PetButton?.OverrideText(GetString("DisperserVentButtonText"));
|
||||
}
|
||||
else
|
||||
{
|
||||
__instance.AbilityButton?.OverrideText(GetString("DisperserVentButtonText"));
|
||||
__instance.AbilityButton?.SetUsesRemaining((int)id.GetAbilityUseLimit());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -196,4 +196,9 @@ public class FireWorks : RoleBase
|
||||
|
||||
return retText;
|
||||
}
|
||||
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
hud.AbilityButton?.OverrideText(nowFireWorksCount == 0 ? GetString("FireWorksExplosionButtonText") : GetString("FireWorksInstallAtionButtonText"));
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,8 @@ public class Hangman : RoleBase
|
||||
private static OptionItem HangmanLimitOpt;
|
||||
public static OptionItem HangmanAbilityUseGainWithEachKill;
|
||||
|
||||
public override bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
public static void SetupCustomOption()
|
||||
{
|
||||
SetupRoleOptions(Id, TabGroup.ImpostorRoles, CustomRoles.Hangman);
|
||||
@@ -43,8 +45,6 @@ public class Hangman : RoleBase
|
||||
playerId.SetAbilityUseLimit(HangmanLimitOpt.GetInt());
|
||||
}
|
||||
|
||||
public override bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
public override void ApplyGameOptions(IGameOptions opt, byte id)
|
||||
{
|
||||
AURoleOptions.ShapeshifterCooldown = ShapeshiftCooldown.GetFloat();
|
||||
@@ -76,4 +76,10 @@ public class Hangman : RoleBase
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
if (id.IsPlayerShifted()) hud.KillButton?.OverrideText(Translator.GetString("HangmanKillButtonTextDuringSS"));
|
||||
hud.AbilityButton?.SetUsesRemaining((int)id.GetAbilityUseLimit());
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,8 @@ internal class QuickShooter : RoleBase
|
||||
|
||||
public static Dictionary<byte, int> ShotLimit = [];
|
||||
|
||||
public override bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
public static void SetupCustomOption()
|
||||
{
|
||||
Options.SetupRoleOptions(Id, TabGroup.ImpostorRoles, CustomRoles.QuickShooter);
|
||||
@@ -40,8 +42,6 @@ internal class QuickShooter : RoleBase
|
||||
ShotLimit.TryAdd(playerId, 0);
|
||||
}
|
||||
|
||||
public override bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
private static void SendRPC(byte playerId)
|
||||
{
|
||||
if (!Utils.DoRPC) return;
|
||||
@@ -110,4 +110,17 @@ internal class QuickShooter : RoleBase
|
||||
}
|
||||
|
||||
public override string GetProgressText(byte playerId, bool comms) => Utils.ColorString(ShotLimit.ContainsKey(playerId) && ShotLimit[playerId] > 0 ? Utils.GetRoleColor(CustomRoles.QuickShooter).ShadeColor(0.25f) : Color.gray, ShotLimit.TryGetValue(playerId, out var shotLimit) ? $"({shotLimit})" : "Invalid");
|
||||
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
if (Options.UsePets.GetBool())
|
||||
{
|
||||
hud.PetButton?.OverrideText(Translator.GetString("QuickShooterShapeshiftText"));
|
||||
}
|
||||
else
|
||||
{
|
||||
hud.AbilityButton?.OverrideText(Translator.GetString("QuickShooterShapeshiftText"));
|
||||
hud.AbilityButton?.SetUsesRemaining(ShotLimit.GetValueOrDefault(PlayerControl.LocalPlayer.PlayerId, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,8 @@ namespace EHR.Roles.Impostor
|
||||
|
||||
public static Dictionary<Vector2, long> Bombs = [];
|
||||
|
||||
public override bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
public static void SetupCustomOption()
|
||||
{
|
||||
SetupRoleOptions(Id, TabGroup.ImpostorRoles, CustomRoles.Sapper);
|
||||
@@ -54,8 +56,6 @@ namespace EHR.Roles.Impostor
|
||||
Main.AllPlayerKillCooldown[id] = 300f;
|
||||
}
|
||||
|
||||
public override bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
public override bool OnShapeshift(PlayerControl shapeshifter, PlayerControl target, bool shapeshifting)
|
||||
{
|
||||
return PlaceBomb(shapeshifter);
|
||||
@@ -130,5 +130,11 @@ namespace EHR.Roles.Impostor
|
||||
{
|
||||
Bombs.Clear();
|
||||
}
|
||||
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
if (UsePets.GetBool()) hud.PetButton?.OverrideText(GetString("BomberShapeshiftText"));
|
||||
else hud.AbilityButton?.OverrideText(GetString("BomberShapeshiftText"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,12 +4,15 @@ namespace EHR.Roles.Impostor
|
||||
{
|
||||
internal class Swiftclaw : RoleBase
|
||||
{
|
||||
private static int Id => 643340;
|
||||
public static OptionItem DashCD;
|
||||
public static OptionItem DashDuration;
|
||||
public static OptionItem DashSpeed;
|
||||
private static readonly Dictionary<byte, (long StartTimeStamp, float NormalSpeed)> DashStart = [];
|
||||
|
||||
public static bool On;
|
||||
private static int Id => 643340;
|
||||
public override bool IsEnable => On;
|
||||
|
||||
public static void SetupCustomOption()
|
||||
{
|
||||
Options.SetupRoleOptions(Id, TabGroup.ImpostorRoles, CustomRoles.Swiftclaw);
|
||||
@@ -35,9 +38,6 @@ namespace EHR.Roles.Impostor
|
||||
On = true;
|
||||
}
|
||||
|
||||
public static bool On;
|
||||
public override bool IsEnable => On;
|
||||
|
||||
public override void OnPet(PlayerControl pc)
|
||||
{
|
||||
if (pc == null || DashStart.ContainsKey(pc.PlayerId)) return;
|
||||
@@ -62,7 +62,13 @@ namespace EHR.Roles.Impostor
|
||||
{
|
||||
Main.AllPlayerSpeed[item.Key] = item.Value.NormalSpeed;
|
||||
}
|
||||
|
||||
DashStart.Clear();
|
||||
}
|
||||
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
hud.PetButton?.OverrideText(Translator.GetString("SwiftclawKillButtonText"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -92,5 +92,18 @@ namespace EHR.Roles.Impostor
|
||||
pc.Notify(ColorString(GetRoleColor(CustomRoles.Twister), string.Format(GetString("TeleportedByTwister"), target.GetRealName())));
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
if (UsePets.GetBool())
|
||||
{
|
||||
hud.PetButton?.OverrideText(GetString("TwisterButtonText"));
|
||||
}
|
||||
else
|
||||
{
|
||||
hud.AbilityButton?.OverrideText(GetString("TwisterButtonText"));
|
||||
hud.AbilityButton?.SetUsesRemaining((int)id.GetAbilityUseLimit());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -255,7 +255,7 @@ public class Witch : RoleBase
|
||||
return str.ToString();
|
||||
}
|
||||
|
||||
public static void GetAbilityButtonText(HudManager hud)
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
if (IsSpellMode(PlayerControl.LocalPlayer.PlayerId) && NowSwitchTrigger != SwitchTrigger.DoubleTrigger)
|
||||
{
|
||||
|
||||
@@ -168,4 +168,10 @@ public class Amnesiac : RoleBase
|
||||
if (player.Is(CustomRoles.Refugee) && target.Is(CustomRoleTypes.Impostor)) return true;
|
||||
return player.Is(CustomRoleTypes.Impostor) && target.Is(CustomRoles.Refugee);
|
||||
}
|
||||
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
ActionButton amneButton = RememberMode.GetValue() == 0 ? hud.KillButton : hud.ReportButton;
|
||||
amneButton?.OverrideText(GetString("RememberButtonText"));
|
||||
}
|
||||
}
|
||||
@@ -206,5 +206,11 @@ namespace EHR.Roles.Neutral
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
hud.KillButton?.OverrideText(Translator.GetString("ArsonistDouseButtonText"));
|
||||
hud.ImpostorVentButton?.OverrideText(Translator.GetString("ArsonistVentButtonText"));
|
||||
}
|
||||
}
|
||||
}
|
||||
+20
-12
@@ -26,6 +26,8 @@ namespace EHR.Roles.Neutral
|
||||
|
||||
public bool IsWon;
|
||||
|
||||
public override bool IsEnable => On;
|
||||
|
||||
public static void SetupCustomOption()
|
||||
{
|
||||
SetupRoleOptions(Id, TabGroup.NeutralRoles, CustomRoles.FFF, zeroOne: false);
|
||||
@@ -59,7 +61,6 @@ namespace EHR.Roles.Neutral
|
||||
Main.ResetCamPlayerList.Add(playerId);
|
||||
}
|
||||
|
||||
public override bool IsEnable => On;
|
||||
public override bool CanUseImpostorVentButton(PlayerControl pc) => false;
|
||||
|
||||
public override bool CanUseKillButton(PlayerControl pc)
|
||||
@@ -104,6 +105,7 @@ namespace EHR.Roles.Neutral
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (MisFireKillTarget.GetBool() && killer.RpcCheckAndMurder(target, true))
|
||||
{
|
||||
target.SetRealKiller(killer);
|
||||
@@ -111,6 +113,7 @@ namespace EHR.Roles.Neutral
|
||||
target.Data.IsDead = true;
|
||||
Main.PlayerStates[target.PlayerId].deathReason = PlayerState.DeathReason.Misfire;
|
||||
}
|
||||
|
||||
killer.Suicide(PlayerState.DeathReason.Sacrifice);
|
||||
Logger.Info($"{killer.GetRealName()} killed incorrect target => misfire", "FFF");
|
||||
return false;
|
||||
@@ -121,19 +124,24 @@ namespace EHR.Roles.Neutral
|
||||
return role switch
|
||||
{
|
||||
CustomRoles.Gangster or
|
||||
CustomRoles.Succubus or
|
||||
CustomRoles.Deathknight or
|
||||
CustomRoles.Necromancer or
|
||||
CustomRoles.Romantic or
|
||||
CustomRoles.RuthlessRomantic or
|
||||
CustomRoles.VengefulRomantic or
|
||||
CustomRoles.Sidekick or
|
||||
CustomRoles.Jackal or
|
||||
CustomRoles.Virus
|
||||
=> true,
|
||||
CustomRoles.Succubus or
|
||||
CustomRoles.Deathknight or
|
||||
CustomRoles.Necromancer or
|
||||
CustomRoles.Romantic or
|
||||
CustomRoles.RuthlessRomantic or
|
||||
CustomRoles.VengefulRomantic or
|
||||
CustomRoles.Sidekick or
|
||||
CustomRoles.Jackal or
|
||||
CustomRoles.Virus
|
||||
=> true,
|
||||
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
hud.KillButton?.OverrideText(Translator.GetString("FFFButtonText"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -155,4 +155,9 @@ public class Gamer : RoleBase
|
||||
else G = x;
|
||||
return new((byte)R, (byte)G, (byte)B, byte.MaxValue);
|
||||
}
|
||||
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
hud.KillButton?.OverrideText(Translator.GetString("GamerButtonText"));
|
||||
}
|
||||
}
|
||||
@@ -90,7 +90,8 @@ public class Glitch : RoleBase
|
||||
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
hud.SabotageButton.ToggleVisible(true);
|
||||
hud.SabotageButton?.ToggleVisible(true);
|
||||
hud.SabotageButton?.OverrideText(Translator.GetString("HackButtonText"));
|
||||
}
|
||||
|
||||
public override bool CanUseImpostorVentButton(PlayerControl pc) => CanVent.GetBool();
|
||||
|
||||
@@ -244,4 +244,9 @@ public class Pelican : RoleBase
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
hud.KillButton?.OverrideText(Translator.GetString("PelicanButtonText"));
|
||||
}
|
||||
}
|
||||
@@ -113,6 +113,11 @@ public class PlagueBearer : RoleBase
|
||||
Logger.Msg($"kill cooldown {PlagueBearerCD[killer.PlayerId]}", "PlagueBearer");
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
hud.KillButton?.OverrideText(GetString("InfectiousKillButtonText"));
|
||||
}
|
||||
}
|
||||
|
||||
public class Pestilence : RoleBase
|
||||
|
||||
@@ -311,5 +311,10 @@ namespace EHR.Roles.Neutral
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
hud.KillButton?.OverrideText(Translator.GetString("InfectiousKillButtonText"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -162,4 +162,9 @@ public class Postman : RoleBase
|
||||
if (seer.IsModClient() || Main.PlayerStates[seer.PlayerId].Role is not Postman { IsEnable: true } pm) return string.Empty;
|
||||
return !pm.IsFinished ? string.Format(GetString("PostmanTarget"), Utils.GetPlayerById(pm.Target).GetRealName()) : "<color=#00ff00>✓</color>";
|
||||
}
|
||||
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
hud.KillButton?.OverrideText(GetString("PostmanKillButtonText"));
|
||||
}
|
||||
}
|
||||
@@ -95,4 +95,9 @@ public class Pursuer : RoleBase
|
||||
{
|
||||
notActiveList.Clear();
|
||||
}
|
||||
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
hud.KillButton?.OverrideText(Translator.GetString("PursuerButtonText"));
|
||||
}
|
||||
}
|
||||
@@ -244,6 +244,11 @@ public class Romantic : RoleBase
|
||||
|
||||
RomanticPC.SetKillCooldown();
|
||||
}
|
||||
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
hud.KillButton?.OverrideText(!HasPickedPartner ? GetString("RomanticKillButtonText") : GetString("MedicalerButtonText"));
|
||||
}
|
||||
}
|
||||
|
||||
public class VengefulRomantic : RoleBase
|
||||
@@ -316,6 +321,11 @@ public class VengefulRomantic : RoleBase
|
||||
byte target = reader.ReadByte();
|
||||
Target = target;
|
||||
}
|
||||
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
hud.KillButton?.OverrideText(GetString("VengefulRomanticKillButtonText"));
|
||||
}
|
||||
}
|
||||
|
||||
public class RuthlessRomantic : RoleBase
|
||||
|
||||
@@ -7,6 +7,8 @@ public class Sidekick : RoleBase
|
||||
{
|
||||
public static List<byte> playerIdList = [];
|
||||
|
||||
public override bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
playerIdList = [];
|
||||
@@ -21,10 +23,16 @@ public class Sidekick : RoleBase
|
||||
Main.ResetCamPlayerList.Add(playerId);
|
||||
}
|
||||
|
||||
public override bool IsEnable => playerIdList.Count > 0;
|
||||
public override bool CanUseImpostorVentButton(PlayerControl pc) => Jackal.CanVent.GetBool();
|
||||
public override void SetKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = Jackal.KillCooldownSK.GetFloat();
|
||||
public override void ApplyGameOptions(IGameOptions opt, byte id) => opt.SetVision(Jackal.HasImpostorVision.GetBool());
|
||||
public override void SetButtonTexts(HudManager __instance, byte id) => __instance.SabotageButton.ToggleVisible(Jackal.CanSabotageSK.GetBool());
|
||||
public override bool CanUseSabotage(PlayerControl pc) => Jackal.CanSabotageSK.GetBool() && pc.IsAlive();
|
||||
|
||||
public override void SetButtonTexts(HudManager __instance, byte id)
|
||||
{
|
||||
__instance.SabotageButton.ToggleVisible(Jackal.CanSabotageSK.GetBool());
|
||||
__instance.KillButton?.OverrideText(Translator.GetString("KillButtonText"));
|
||||
__instance.ImpostorVentButton?.OverrideText(Translator.GetString("ReportButtonText"));
|
||||
__instance.SabotageButton?.OverrideText(Translator.GetString("SabotageButtonText"));
|
||||
}
|
||||
}
|
||||
@@ -125,4 +125,9 @@ public class Succubus : RoleBase
|
||||
charmed.Suicide(realKiller: pc);
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
hud.KillButton?.OverrideText(GetString("SuccubusKillButtonText"));
|
||||
}
|
||||
}
|
||||
@@ -153,4 +153,9 @@ public class Totocalcio : RoleBase
|
||||
if (Main.PlayerStates[playerId].Role is not Totocalcio tc) return string.Empty;
|
||||
return player == null ? string.Empty : Utils.ColorString(tc.CanUseKillButton(player) ? Utils.GetRoleColor(CustomRoles.Totocalcio) : Color.gray, $"({tc.BetTimes})");
|
||||
}
|
||||
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
hud.KillButton?.OverrideText(GetString("TotocalcioKillButtonText"));
|
||||
}
|
||||
}
|
||||
@@ -179,4 +179,9 @@ public class Vulture : RoleBase
|
||||
pc.RpcSetCustomRole(role);
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
hud.ReportButton?.OverrideText(GetString("VultureEatButtonText"));
|
||||
}
|
||||
}
|
||||
@@ -162,35 +162,6 @@ namespace EHR
|
||||
|
||||
public virtual void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
hud.KillButton?.OverrideText(Translator.GetString("KillButtonText"));
|
||||
hud.ReportButton?.OverrideText(Translator.GetString("ReportButtonText"));
|
||||
hud.PetButton?.OverrideText(Translator.GetString("PetButtonText"));
|
||||
hud.ImpostorVentButton?.OverrideText(Translator.GetString("VentButtonText"));
|
||||
hud.SabotageButton?.OverrideText(Translator.GetString("SabotageButtonText"));
|
||||
if (PlayerControl.LocalPlayer.GetCustomRole().UsesPetInsteadOfKill())
|
||||
{
|
||||
hud.PetButton?.OverrideText(Translator.GetString("KillButtonText"));
|
||||
}
|
||||
|
||||
if (PlayerControl.LocalPlayer.Is(RoleTypes.Shapeshifter))
|
||||
{
|
||||
hud.AbilityButton?.OverrideText(Translator.GetString("AbilityButtonText.Shapeshifter"));
|
||||
}
|
||||
|
||||
if (PlayerControl.LocalPlayer.Is(RoleTypes.Engineer))
|
||||
{
|
||||
hud.AbilityButton?.OverrideText(Translator.GetString("AbilityButtonText.Engineer"));
|
||||
}
|
||||
|
||||
if (PlayerControl.LocalPlayer.Is(RoleTypes.Scientist))
|
||||
{
|
||||
hud.AbilityButton?.OverrideText(Translator.GetString("AbilityButtonText.Scientist"));
|
||||
}
|
||||
|
||||
if (PlayerControl.LocalPlayer.Is(RoleTypes.GuardianAngel))
|
||||
{
|
||||
hud.AbilityButton?.OverrideText(Translator.GetString("AbilityButtonText.GuardianAngel"));
|
||||
}
|
||||
}
|
||||
|
||||
public virtual string GetSuffix(PlayerControl seer, PlayerControl target, bool isHUD = false, bool isMeeting = false)
|
||||
|
||||
Reference in new issue
Block a user