Fixes & Cat becomes Amnesiac if copied role is single

This commit is contained in:
Gurge44 committed 2024-04-06 22:30:24 +02:00
1 parent 28d448a93a
commit c8ef3f0a9f
13 files changed
+83 -12

No files matched your search

+9
View File
@@ -2089,6 +2089,7 @@ public static class Options
CTAPlayersCanWinWithOriginalTeam = BooleanOptionItem.Create(23550, "CTA.PlayersCanWinWithOriginalTeam", false, TabGroup.GameSettings, false)
.SetGameMode(CustomGameMode.Standard)
.SetHeader(true)
.SetColor(new Color32(215, 227, 84, byte.MaxValue));
CTAPlayersCanSeeEachOthersRoles = BooleanOptionItem.Create(23551, "CTA.PlayersCanSeeEachOthersRoles", true, TabGroup.GameSettings, false)
.SetGameMode(CustomGameMode.Standard)
@@ -2102,6 +2103,7 @@ public static class Options
SyncButtonMode = BooleanOptionItem.Create(23300, "SyncButtonMode", false, TabGroup.GameSettings, false)
.SetColor(new Color32(147, 241, 240, byte.MaxValue))
.SetHeader(true)
.SetGameMode(CustomGameMode.Standard);
SyncedButtonCount = IntegerOptionItem.Create(23310, "SyncedButtonCount", new(0, 100, 1), 10, TabGroup.GameSettings, false)
.SetParent(SyncButtonMode)
@@ -2165,9 +2167,11 @@ public static class Options
TextOptionItem.Create(100028, "MenuTitle.Other", TabGroup.GameSettings)
.SetGameMode(CustomGameMode.Standard)
.SetHeader(true)
.SetColor(new Color32(193, 255, 209, byte.MaxValue));
LadderDeath = BooleanOptionItem.Create(23800, "LadderDeath", false, TabGroup.GameSettings, false)
.SetHeader(true)
.SetColor(new Color32(193, 255, 209, byte.MaxValue));
LadderDeathChance = StringOptionItem.Create(23810, "LadderDeathChance", Rates[1..], 0, TabGroup.GameSettings, false)
.SetParent(LadderDeath);
@@ -2201,6 +2205,7 @@ public static class Options
TextOptionItem.Create(100029, "MenuTitle.Ghost", TabGroup.GameSettings)
.SetGameMode(CustomGameMode.Standard)
.SetHeader(true)
.SetColor(new Color32(217, 218, 255, byte.MaxValue));
LoadingPercentage = 99;
@@ -2208,6 +2213,7 @@ public static class Options
GhostCanSeeOtherRoles = BooleanOptionItem.Create(24300, "GhostCanSeeOtherRoles", true, TabGroup.GameSettings, false)
.SetGameMode(CustomGameMode.Standard)
.SetHeader(true)
.SetColor(new Color32(217, 218, 255, byte.MaxValue));
GhostCanSeeOtherVotes = BooleanOptionItem.Create(24400, "GhostCanSeeOtherVotes", true, TabGroup.GameSettings, false)
.SetGameMode(CustomGameMode.Standard)
@@ -2264,6 +2270,8 @@ public static class Options
CustomRoleCounts.Add(role, countOption);
}
public static HashSet<CustomRoles> SingleRoles = [];
public static void SetupSingleRoleOptions(int id, TabGroup tab, CustomRoles role, int count = 1, CustomGameMode customGameMode = CustomGameMode.Standard, bool zeroOne = false, bool hideMaxSetting = true)
{
var spawnOption = StringOptionItem.Create(id, role.ToString(), zeroOne ? RatesZeroOne : Rates, 0, tab, false).SetColor(Utils.GetRoleColor(role))
@@ -2277,6 +2285,7 @@ public static class Options
CustomRoleSpawnChances.Add(role, spawnOption);
CustomRoleCounts.Add(role, countOption);
SingleRoles.Add(role);
}
public static OptionItem CreateCDSetting(int id, TabGroup tab, CustomRoles role, bool isKCD = false) =>
+1
View File
@@ -1629,6 +1629,7 @@ public static class Utils
if (devUser.HasTag() || isMod)
{
string tag = devUser.GetTag();
if (tag == "null") tag = string.Empty;
if (player.AmOwner || player.IsModClient())
name = tag + (isMod ? ("<size=1.4>" + GetString("ModeratorTag") + "\r\n</size>") : string.Empty) + name;
else name = tag.Replace("\r\n", " - ") + (isMod ? ("<size=1.4>" + GetString("ModeratorTag") + " - </size>") : string.Empty) + name;
+1 -1
View File
@@ -297,7 +297,7 @@ internal class ChatCommands
case "ban":
if (GetRoleByName(args[2], out CustomRoles mainRole) && GetRoleByName(args[3], out CustomRoles addOn))
{
if (mainRole.IsAdditionRole() || !addOn.IsAdditionRole()) break;
if (mainRole.IsAdditionRole() || !addOn.IsAdditionRole() || addOn == CustomRoles.Lovers) break;
if (args[1] == "add") Main.AlwaysSpawnTogetherCombos[mainRole] = addOn;
else Main.NeverSpawnTogetherCombos[mainRole] = addOn;
Utils.SendMessage(string.Format(args[1] == "add" ? GetString("ComboAdd") : GetString("ComboBan"), GetString(mainRole.ToString()), GetString(addOn.ToString())), localPlayerId);
+9
View File
@@ -745,6 +745,15 @@ class ShapeshiftPatch
}
}
[HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.RpcShapeshift))]
class RpcShapeshiftPatch
{
public static void Postfix(PlayerControl __instance, [HarmonyArgument(0)] PlayerControl target)
{
Main.CheckShapeshift[__instance.PlayerId] = __instance.PlayerId != target.PlayerId;
}
}
[HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.ReportDeadBody))]
class ReportDeadBodyPatch
{
+1 -1
View File
@@ -261,7 +261,7 @@ public static class SabotageSystemTypeRepairDamagePatch
}
if (player.Is(CustomRoleTypes.Impostor) && !player.IsAlive() && Options.DeadImpCantSabotage.GetBool()) return false;
if (player.Is(CustomRoleTypes.Impostor) && (player.IsAlive() || !Options.DeadImpCantSabotage.GetBool()) && !player.Is(CustomRoles.Minimalism) && !player.Is(CustomRoles.Mafioso)) return true;
if (player.Is(CustomRoleTypes.Impostor) && (player.IsAlive() || !Options.DeadImpCantSabotage.GetBool()) && player.GetCustomRole() is not CustomRoles.Minimalism and not CustomRoles.Mafioso and not CustomRoles.Generator) return true;
return player.GetCustomRole() switch
{
CustomRoles.Jackal when Jackal.CanSabotage.GetBool() => true,
+1 -1
View File
@@ -596,7 +596,7 @@ internal class SelectRolesPatch
GameOptionsSender.AllSenders.Add(new PlayerGameOptionsSender(pc));
}
// Added players with unclassified roles to the list of players who require ResetCam.
// Add players with unclassified roles to the list of players who require ResetCam.
Main.ResetCamPlayerList.AddRange(Main.AllPlayerControls.Where(p => p.GetCustomRole() is CustomRoles.Arsonist or CustomRoles.Revolutionist or CustomRoles.Sidekick or CustomRoles.KB_Normal or CustomRoles.Killer or CustomRoles.Tasker or CustomRoles.Potato or CustomRoles.Seeker or CustomRoles.Hider or CustomRoles.Fox or CustomRoles.Troll or CustomRoles.Innocent || (p.Is(CustomRoles.Witness) && (!Options.UsePets.GetBool() || Options.WitnessUsePet.GetBool()))).Select(p => p.PlayerId));
Utils.CountAlivePlayers(true);
Utils.SyncAllSettings();
+2
View File
@@ -2625,7 +2625,9 @@
"Sentry.ShowInfoDuration": "Info is Visible for",
"Sentry.PlayersKnowAboutCamera": "Players Know if the Room is Monitored",
"Sentry.Suffix.MonitoredRoom": "<size=80%>This room is monitored by the {0}</size>",
"Sentry.Suffix.Self": "<size=70%>Monitoring: <#00ffa5>{0}</color></size>",
"Sentry.Notify.Info": "<u>Info about your monitored room:</u>\\nPlayers: {0}\\nDead players: {1}\\nPlayers that used a vent: {2}\\nShapeshifters: {3}",
"Sentry.Notify.Info.NoData": "<#ff0000>none</color>",
"SchrodingersCat": "Schrödinger's Cat",
"SchrodingersCatInfo": "Get Attacked to Get a Role",
"SchrodingersCatInfoLong": "(Neutrals):\\nAs Schrödinger's Cat, if you get attacked, you turn into the same role as your killer.\\nIf you don't get attacked, you lose, or you can win with crewmates, depending on the settings.",
+43 -3
View File
@@ -59,7 +59,7 @@ namespace EHR.Roles.Impostor
public override void OnPet(PlayerControl pc)
{
if (MonitoredRoom == null) MonitoredRoom = pc.GetPlainShipRoom();
if (MonitoredRoom == null || MonitoredRoom == default || MonitoredRoom == default(PlainShipRoom)) MonitoredRoom = pc.GetPlainShipRoom();
else DisplayRoomInfo(pc);
}
@@ -73,13 +73,19 @@ namespace EHR.Roles.Impostor
var vented = GetColoredNames(PlayersVentedInRoom);
var shifted = GetColoredNames(PlayersShiftedInRoom);
var noDataString = Translator.GetString("Sentry.Notify.Info.NoData");
if (players.Length == 0) players = noDataString;
if (bodies.Length == 0) bodies = noDataString;
if (vented.Length == 0) vented = noDataString;
if (shifted.Length == 0) shifted = noDataString;
pc.Notify(string.Format(Translator.GetString("Sentry.Notify.Info"), players, bodies, vented, shifted), ShowInfoDuration.GetInt());
return;
static string GetColoredNames(IEnumerable<byte> ids) => ids.Where(x => Utils.GetPlayerById(x) != null).Select(x => Utils.ColorString(Main.PlayerColors[x], Utils.GetPlayerById(x).GetRealName())).Join();
}
bool IsInMonitoredRoom(PlayerControl pc) => pc.GetPlainShipRoom().name == MonitoredRoom.name;
public bool IsInMonitoredRoom(PlayerControl pc) => MonitoredRoom != null && pc.GetPlainShipRoom() == MonitoredRoom;
public void OnAnyoneShapeshiftLoop(PlayerControl shapeshifter)
{
@@ -110,7 +116,41 @@ namespace EHR.Roles.Impostor
public static string GetSuffix(PlayerControl seer)
{
return !PlayersKnowAboutCamera.GetBool() ? string.Empty : string.Format(Translator.GetString("Sentry.Suffix.MonitoredRoom"), CustomRoles.Sentry.ToColoredString());
if (!PlayersKnowAboutCamera.GetBool()) return string.Empty;
if (Main.PlayerStates[seer.PlayerId].Role is Sentry s && s.MonitoredRoom != null) return string.Format(Translator.GetString("Sentry.Suffix.Self"), Translator.GetString($"{s.MonitoredRoom.RoomId}"));
foreach (var state in Main.PlayerStates.Values)
{
if (state.Role is Sentry st && st.IsInMonitoredRoom(seer))
{
return string.Format(Translator.GetString("Sentry.Suffix.MonitoredRoom"), CustomRoles.Sentry.ToColoredString());
}
}
return string.Empty;
}
private readonly HashSet<byte> LastNotified = [];
public override void OnGlobalFixedUpdate(PlayerControl pc, bool lowLoad)
{
if (!GameStates.IsInTask || lowLoad) return;
bool nowInMonitoredRoom = IsInMonitoredRoom(pc);
bool wasInMonitoredRoom = LastNotified.Contains(pc.PlayerId);
switch (nowInMonitoredRoom)
{
case true when !wasInMonitoredRoom:
Utils.NotifyRoles(SpecifySeer: pc, SpecifyTarget: pc);
LastNotified.Add(pc.PlayerId);
break;
case false when wasInMonitoredRoom:
Utils.NotifyRoles(SpecifySeer: pc, SpecifyTarget: pc);
LastNotified.Remove(pc.PlayerId);
break;
}
}
}
}
+2
View File
@@ -166,6 +166,8 @@ namespace EHR.Roles.Impostor
public override bool OnShapeshift(PlayerControl shapeshifter, PlayerControl target, bool shapeshifting)
{
if (!shapeshifting) return true;
int cost = ActionCosts[Action.Shapeshift];
if (Charges < cost)
+10 -5
View File
@@ -34,13 +34,18 @@ public class Amnesiac : RoleBase
public static void SetupCustomOption()
{
SetupRoleOptions(Id, TabGroup.NeutralRoles, CustomRoles.Amnesiac);
RememberMode = StringOptionItem.Create(Id + 9, "RememberMode", RememberModes, 0, TabGroup.NeutralRoles, false).SetParent(CustomRoleSpawnChances[CustomRoles.Amnesiac]);
RememberCooldown = FloatOptionItem.Create(Id + 10, "RememberCooldown", new(0f, 180f, 2.5f), 5f, TabGroup.NeutralRoles, false).SetParent(CustomRoleSpawnChances[CustomRoles.Amnesiac])
RememberMode = StringOptionItem.Create(Id + 9, "RememberMode", RememberModes, 0, TabGroup.NeutralRoles, false)
.SetParent(CustomRoleSpawnChances[CustomRoles.Amnesiac]);
RememberCooldown = FloatOptionItem.Create(Id + 10, "RememberCooldown", new(0f, 180f, 2.5f), 5f, TabGroup.NeutralRoles, false)
.SetParent(CustomRoleSpawnChances[CustomRoles.Amnesiac])
.SetValueFormat(OptionFormat.Seconds);
RefugeeKillCD = FloatOptionItem.Create(Id + 11, "RefugeeKillCD", new(0f, 180f, 2.5f), 25f, TabGroup.NeutralRoles, false).SetParent(CustomRoleSpawnChances[CustomRoles.Amnesiac])
RefugeeKillCD = FloatOptionItem.Create(Id + 11, "RefugeeKillCD", new(0f, 180f, 2.5f), 25f, TabGroup.NeutralRoles, false)
.SetParent(CustomRoleSpawnChances[CustomRoles.Amnesiac])
.SetValueFormat(OptionFormat.Seconds);
IncompatibleNeutralMode = StringOptionItem.Create(Id + 12, "IncompatibleNeutralMode", AmnesiacIncompatibleNeutralMode, 0, TabGroup.NeutralRoles, false).SetParent(CustomRoleSpawnChances[CustomRoles.Amnesiac]);
CanVent = BooleanOptionItem.Create(Id + 13, "CanVent", false, TabGroup.NeutralRoles, false).SetParent(CustomRoleSpawnChances[CustomRoles.Amnesiac]);
IncompatibleNeutralMode = StringOptionItem.Create(Id + 12, "IncompatibleNeutralMode", AmnesiacIncompatibleNeutralMode, 0, TabGroup.NeutralRoles, false)
.SetParent(CustomRoleSpawnChances[CustomRoles.Amnesiac]);
CanVent = BooleanOptionItem.Create(Id + 13, "CanVent", false, TabGroup.NeutralRoles, false)
.SetParent(CustomRoleSpawnChances[CustomRoles.Amnesiac]);
}
public override void Init()
+2
View File
@@ -42,5 +42,7 @@ namespace EHR.Roles.Impostor
var target = ExternalRpcPetPatch.SelectKillButtonTarget(pc);
if (target != null && pc.RpcCheckAndMurder(target)) pc.RpcRemoveAbilityUse();
}
public override bool CanUseKillButton(PlayerControl pc) => false;
}
}
+1
View File
@@ -28,6 +28,7 @@
public override bool OnCheckMurderAsTarget(PlayerControl killer, PlayerControl target)
{
var killerRole = killer.GetCustomRole();
if (Options.SingleRoles.Contains(killerRole)) killerRole = CustomRoles.Amnesiac;
target.RpcSetCustomRole(killerRole);
+1 -1
View File
@@ -51,7 +51,7 @@ namespace EHR
public virtual bool CanUseSabotage(PlayerControl pc)
{
return pc.Is(Team.Impostor) || (pc.Is(CustomRoles.Mischievous) || (pc.Is(CustomRoles.Bloodlust) && Bloodlust.HasImpVision.GetBool()) && pc.IsAlive());
return pc.Is(Team.Impostor) || pc.Is(CustomRoles.Mischievous) || (pc.Is(CustomRoles.Bloodlust) && Bloodlust.HasImpVision.GetBool()) && pc.IsAlive();
}
public virtual void ApplyGameOptions(IGameOptions opt, byte playerId)