Legacy Lovers

This commit is contained in:
Gurge44 committed 2024-05-30 12:36:51 +02:00
1 parent 8195169201
commit b26ba4c650
10 files changed
+87 -1

No files matched your search

+2
View File
@@ -131,6 +131,8 @@ public enum CustomRoles
Convener,
CopyCat,
Bloodhound, // Coroner
LovingCrewmate,
LovingImpostor,
Crusader,
Demolitionist,
Deputy,
+16
View File
@@ -4,6 +4,7 @@ using System.Linq;
using AmongUs.GameOptions;
using EHR.Roles.Impostor;
using EHR.Roles.Neutral;
using EHR.Roles.AddOns.Common;
using HarmonyLib;
namespace EHR.Modules;
@@ -83,12 +84,15 @@ internal static class CustomRoleSelector
foreach (var id in Main.SetRoles.Keys.Where(id => Utils.GetPlayerById(id) == null).ToArray()) Main.SetRoles.Remove(id);
(bool Spawning, bool OneIsImp) LoversData = (Lovers.LegacyLovers.GetBool(), rd.Next(100) < Lovers.LovingImpostorSpawnChance.GetInt());
foreach (var role in Enum.GetValues<CustomRoles>())
{
int chance = role.GetMode();
if (role.IsVanilla() || chance == 0 || role.IsAdditionRole() || (role.OnlySpawnsWithPets() && !Options.UsePets.GetBool()) || (role != CustomRoles.Randomizer && role.IsCrewmate() && Options.AprilFoolsMode.GetBool()) || HnSManager.AllHnSRoles.Contains(role)) continue;
switch (role)
{
case CustomRoles.LovingCrewmate or CustomRoles.LovingImpostor when !Lovers.LegacyLovers.GetBool():
case CustomRoles.Commander when optImpNum <= 1 && Commander.CannotSpawnAsSoloImp.GetBool():
case CustomRoles.Changeling when Changeling.GetAvailableRoles(check: true).Count == 0:
case CustomRoles.Camouflager when Camouflager.DoesntSpawnOnFungle.GetBool() && Main.CurrentMap == MapNames.Fungle:
@@ -119,6 +123,18 @@ internal static class CustomRoleSelector
else Roles[RoleAssignType.Crewmate].Add(info);
}
LoversData.Spawning &= rd.Next(100) < Options.CustomAdtRoleSpawnRate[CustomRoles.Lovers].GetInt();
if (LoversData.Spawning)
{
if (LoversData.OneIsImp)
{
Roles[RoleAssignType.Crewmate].Add(new(CustomRoles.LovingCrewmate, 100, 1));
Roles[RoleAssignType.Impostor].Add(new(CustomRoles.LovingImpostor, 100, 1));
}
else Roles[RoleAssignType.Crewmate].Add(new(CustomRoles.LovingCrewmate, 100, 2));
}
if (Roles[RoleAssignType.Impostor].Count == 0 && optNeutralKillingNum == 0 && optNonNeutralKillingNum == 0 && !Main.SetRoles.Values.Any(x => x.IsImpostor() || x.IsNK()))
{
Roles[RoleAssignType.Impostor].Add(new(CustomRoles.ImpostorEHR, 100, optImpNum));
+3
View File
@@ -186,6 +186,8 @@ internal static class CustomRolesHelper
CustomRoles.Altruist => CustomRoles.Crewmate,
CustomRoles.Transmitter => CustomRoles.Crewmate,
CustomRoles.Autocrat => CustomRoles.Crewmate,
CustomRoles.LovingCrewmate => CustomRoles.Crewmate,
CustomRoles.LovingImpostor => CustomRoles.Impostor,
CustomRoles.ToiletMaster => CustomRoles.Crewmate,
CustomRoles.Sentry => CustomRoles.Crewmate,
CustomRoles.Perceiver => UsePets ? CustomRoles.Crewmate : CustomRoles.Engineer,
@@ -557,6 +559,7 @@ internal static class CustomRolesHelper
public static bool IsImpostor(this CustomRoles role) => role is
CustomRoles.Impostor or
CustomRoles.LovingImpostor or
CustomRoles.Godfather or
CustomRoles.Shapeshifter or
CustomRoles.ShapeshifterEHR or
+11
View File
@@ -273,6 +273,10 @@ public static class GuessManager
switch (target.GetCustomRole())
{
case CustomRoles.LovingCrewmate or CustomRoles.LovingImpostor when Lovers.CannotBeGuessed.GetBool():
if (!isUI) Utils.SendMessage(GetString("GuessLovers"), pc.PlayerId);
else pc.ShowPopUp(GetString("GuessLovers"));
return true;
case CustomRoles.Workaholic when Workaholic.WorkaholicVisibleToEveryone.GetBool():
if (!isUI) Utils.SendMessage(GetString("GuessWorkaholic"), pc.PlayerId);
else pc.ShowPopUp(GetString("GuessWorkaholic"));
@@ -347,6 +351,13 @@ public static class GuessManager
return true;
}
if (target.Is(CustomRoles.Lovers) && Lovers.CannotBeGuessed.GetBool())
{
if (!isUI) Utils.SendMessage(GetString("GuessLovers"), pc.PlayerId);
else pc.ShowPopUp(GetString("GuessLovers"));
return true;
}
if (Jailor.playerIdList.Any(x => Main.PlayerStates[x].Role is Jailor { IsEnable: true } jl && jl.JailorTarget == target.PlayerId))
{
if (!isUI) Utils.SendMessage(GetString("Can'tGuessJailed"), pc.PlayerId, title: Utils.ColorString(Utils.GetRoleColor(CustomRoles.Jailor), GetString("JailorTitle")));
+1
View File
@@ -206,6 +206,7 @@ public static class Options
public static OptionItem SidekickCanKillJackal;
public static OptionItem SidekickCanKillSidekick;
public static OptionItem VanillaCrewmateCannotBeGuessed;
public static OptionItem EGCanGuessImp;
public static OptionItem EGCanGuessAdt;
public static OptionItem EGCanGuessTime;
+20
View File
@@ -178,6 +178,17 @@ class BeginCrewmatePatch
return false;
}
if (PlayerControl.LocalPlayer.GetCustomRole() == CustomRoles.LovingCrewmate)
{
teamToDisplay = new();
teamToDisplay.Add(PlayerControl.LocalPlayer);
teamToDisplay.Add(Main.LoversPlayers.First(x => x.PlayerId != PlayerControl.LocalPlayer.PlayerId));
}
else if (PlayerControl.LocalPlayer.GetCustomRole() == CustomRoles.LovingImpostor)
{
teamToDisplay.Add(Main.LoversPlayers.First(x => x.PlayerId != PlayerControl.LocalPlayer.PlayerId));
}
if (CustomTeamManager.EnabledCustomTeams.Count > 0)
{
var team = CustomTeamManager.GetCustomTeam(PlayerControl.LocalPlayer.PlayerId);
@@ -223,6 +234,15 @@ class BeginCrewmatePatch
__instance.ImpostorText.gameObject.SetActive(true);
__instance.ImpostorText.text = GetString("SubText.Bloodlust");
}
else if (role is CustomRoles.LovingCrewmate or CustomRoles.LovingImpostor)
{
__instance.TeamTitle.text = GetString($"Team{role}");
__instance.TeamTitle.color = __instance.BackgroundBar.material.color = Utils.GetRoleColor(role);
PlayerControl.LocalPlayer.Data.Role.IntroSound = GetIntroSound(role.GetRoleTypes());
__instance.ImpostorText.gameObject.SetActive(true);
byte otherLoverId = Main.LoversPlayers.First(x => x.PlayerId != PlayerControl.LocalPlayer.PlayerId).PlayerId;
__instance.ImpostorText.text = string.Format(GetString($"SubText.{role}"), Utils.ColorString(Main.PlayerColors.TryGetValue(otherLoverId, out var color) ? color : Color.white, Main.AllPlayerNames[otherLoverId]));
}
else
{
switch (role.GetCustomRoleTypes())
+9 -1
View File
@@ -10,6 +10,8 @@
"SubText.Impostor": "Sabotage and kill everyone",
"SubText.Neutral": "A team on their own",
"SubText.Madmate": "Help the <color=#ff1919>Impostors</color>",
"SubText.LovingCrewmate": "You are in love with {0}",
"SubText.LovingImpostor": "You're an <#ff1919>Impostor</color>, but also in love with {0}",
"TypeImpostor": "Impostors",
"TypeCrewmate": "Crewmates",
"TypeNeutral": "Neutrals",
@@ -18,6 +20,8 @@
"TeamNeutral": "Neutral",
"TeamCrewmate": "Crewmate",
"TeamMadmate": "Madmate",
"TeamLovingCrewmate": "Lover",
"TeamLovingImpostor": "Loving Impostor",
"Neutral": "Neutral",
"YouAreCrewmate": "<size=1.7><color=#ffffff>TEAM:</color> CREWMATES</size>",
"YouAreImpostor": "<size=0>.</size>",
@@ -594,7 +598,6 @@
"ClumsyInfo": "You trip while walking",
"MischievousInfo": "You can sabotage",
"UnreportableInfo": "Your body can't be reported",
"RogueInfo": "Work against your team and win with other Rogues",
"LuckyInfo": "Dodge attackers",
"DoubleShotInfo": "You have an extra life when guessing",
"RascalInfo": "You appear evil in some cases",
@@ -1348,6 +1351,11 @@
"LoverSuicide": "<color=#ff9ace>Lovers</color> die together",
"NumberOfLovers": "Number of <color=#ff9ace>Lover Pairs</color> (x2 members)",
"LoverKnowRoles": "<color=#ff9ace>Lovers</color> know the roles of each other",
"LegacyLovers": "Legacy Lovers",
"LovingImpostorSpawnChance": "<color=#ff9ace>Loving</color> <#ff1919>Impostor</color> Spawn Chance",
"PrivateChat": "Enable Private Chat for Lovers",
"CannotBeGuessed": "<color=#ff9ace>Lovers</color> Cannot Be Guessed",
"GuessLovers": "Sorry, <color=#ff9ace>Lovers</color> cannot be guessed.",
"TrapperBlockMoveTime": "Freeze time",
"RogueKnowEachOtherRoles": "<color=#696969>Rogues</color> know the roles of each other",
"RogueKnowEachOther": "<color=#696969>Rogues</color> know each other",
+21
View File
@@ -6,6 +6,11 @@ namespace EHR.Roles.AddOns.Common
{
public AddonTypes Type => AddonTypes.Mixed;
public static OptionItem LegacyLovers;
public static OptionItem LovingImpostorSpawnChance;
public static OptionItem PrivateChat;
public static OptionItem CannotBeGuessed;
public void SetupCustomOption()
{
const CustomRoles role = CustomRoles.Lovers;
@@ -43,6 +48,22 @@ namespace EHR.Roles.AddOns.Common
.SetParent(spawnOption)
.SetGameMode(customGameMode);
LegacyLovers = BooleanOptionItem.Create(id + 8, "LegacyLovers", false, TabGroup.Addons)
.SetParent(spawnOption)
.SetGameMode(customGameMode);
LovingImpostorSpawnChance = FloatOptionItem.Create(id + 9, "LovingImpostorSpawnChance", new(0, 100, 5), 25, TabGroup.Addons)
.SetParent(LegacyLovers)
.SetGameMode(customGameMode);
PrivateChat = BooleanOptionItem.Create(id + 10, "PrivateChat", false, TabGroup.Addons)
.SetParent(spawnOption)
.SetGameMode(customGameMode);
CannotBeGuessed = BooleanOptionItem.Create(id + 11, "CannotBeGuessed", false, TabGroup.Addons)
.SetParent(spawnOption)
.SetGameMode(customGameMode);
var countOption = IntegerOptionItem.Create(id + 1, "NumberOfLovers", new(2, 2, 1), 2, TabGroup.Addons)
.SetParent(spawnOption)
+2
View File
@@ -17,6 +17,8 @@ namespace EHR.Roles.Crewmate
ScientistDur = FloatOptionItem.Create(5111, "VitalsDuration", new(1f, 250f, 1f), 15f, Tab)
.SetParent(CustomRoleSpawnChances[CustomRoles.ScientistEHR])
.SetValueFormat(OptionFormat.Seconds);
VanillaCrewmateCannotBeGuessed = BooleanOptionItem.Create(5112, "VanillaCrewmateCannotBeGuessed", false, Tab)
.SetParent(CustomRoleSpawnChances[CustomRoles.CrewmateEHR]);
}
}
}
+2
View File
@@ -330,6 +330,8 @@ public class Main : BasePlugin
{ CustomRoles.Gaulois, "#42d1f5" },
{ CustomRoles.Druid, "#ffb694" },
{ CustomRoles.Autocrat, "#e2ed64" },
{ CustomRoles.LovingCrewmate, "#ff9ace" },
{ CustomRoles.LovingImpostor, "#ff9ace" },
{ CustomRoles.ToiletMaster, "#4281f5" },
{ CustomRoles.Goose, "#f9ffb8" },
{ CustomRoles.Sentry, "#db55f2" },