Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mxyx0412 committed Apr 25, 2024
1 parent db85931 commit 2fec1f0
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 30 deletions.
1 change: 1 addition & 0 deletions TheOtherRoles/Buttons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3574,6 +3574,7 @@ public static void createButtonsPostfix(HudManager __instance)
AmongUsClient.Instance.FinishRpcImmediately(writer);
RPCProcedure.uncheckedMurderPlayer(Terrorist.terrorist.Data.PlayerId, loacl, byte.MaxValue);
}
Error(((int)Terrorist.destructionTime + (int)Terrorist.bombActiveAfter) + Terrorist.selfExplosion.ToString());
},
() =>
{
Expand Down
6 changes: 3 additions & 3 deletions TheOtherRoles/CustomOptionHolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -734,12 +734,12 @@ public static void Load()
fungleElectrical = CustomOption.Create(101, Types.General, "添加电力系统\n (食堂-实验室-上引擎)", false, enableFungleModify);

enableCamoComms = CustomOption.Create(120, Types.General, cs(Palette.ImpostorRed, "通信破坏开启小黑人"), false, enableMapOptions, true);
restrictDevices = CustomOption.Create(121, Types.General, "限制信息设备使用", [getString("OFF"), "每一回合", "每局游戏"]);
restrictDevices = CustomOption.Create(121, Types.General, "限制信息设备使用", [getString("OFF"), "每一回合", "每局游戏"], enableMapOptions);
//restrictAdmin = CustomOption.Create(122, Types.General, "限制使用管理室地图时长", 30f, 0f, 600f, 5f, restrictDevices);
restrictCameras = CustomOption.Create(123, Types.General, "限制使用监控时长", 30f, 0f, 600f, 5f, restrictDevices);
restrictVents = CustomOption.Create(124, Types.General, "限制使用心电图时长", 30f, 0f, 600f, 5f, restrictDevices);
disableCamsRound1 = CustomOption.Create(125, Types.General, "第一回合无法使用监控", false);
camsNightVision = CustomOption.Create(126, Types.General, "熄灯时监控开启夜视模式", false);
disableCamsRound1 = CustomOption.Create(125, Types.General, "第一回合无法使用监控", false, enableMapOptions);
camsNightVision = CustomOption.Create(126, Types.General, "熄灯时监控开启夜视模式", false, enableMapOptions);
camsNoNightVisionIfImpVision = CustomOption.Create(127, Types.General, "内鬼无视监控的夜视模式", false, camsNightVision);

dynamicMap = CustomOption.Create(130, Types.General, "随机地图玩法", false, enableMapOptions, true);
Expand Down
12 changes: 6 additions & 6 deletions TheOtherRoles/Patches/EndGamePatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ public static void Postfix(AmongUsClient __instance, [HarmonyArgument(0)] ref En
winnersToRemove.Add(winner);
foreach (var winner in winnersToRemove) TempData.winners.Remove(winner);

var everyoneDead = AdditionalTempData.playerRoles.All(x => !x.IsAlive);
var jesterWin = Jester.jester != null && gameOverReason == (GameOverReason)CustomGameOverReason.JesterWin;
var werewolfWin = gameOverReason == (GameOverReason)CustomGameOverReason.WerewolfWin &&
Werewolf.werewolf != null && !Werewolf.werewolf.Data.IsDead;
Expand All @@ -175,7 +176,6 @@ public static void Postfix(AmongUsClient __instance, [HarmonyArgument(0)] ref En
(Sidekick.sidekick != null && !Sidekick.sidekick.Data.IsDead));
var vultureWin = Vulture.vulture != null && gameOverReason == (GameOverReason)CustomGameOverReason.VultureWin;
var prosecutorWin = Lawyer.lawyer != null && gameOverReason == (GameOverReason)CustomGameOverReason.ProsecutorWin;
var everyoneDead = AdditionalTempData.playerRoles.All(x => !x.IsAlive);
var akujoWin = Akujo.akujo != null && gameOverReason == (GameOverReason)CustomGameOverReason.AkujoWin && (Akujo.honmei != null && !Akujo.honmei.Data.IsDead && !Akujo.akujo.Data.IsDead);
bool lawyerSoloWin = Lawyer.lawyer != null && gameOverReason == (GameOverReason)CustomGameOverReason.LawyerSoloWin;

Expand Down Expand Up @@ -460,6 +460,11 @@ public static void Postfix(EndGameManager __instance)

switch (AdditionalTempData.winCondition)
{
case WinCondition.EveryoneDied:
textRenderer.text = "无人生还";
textRenderer.color = Palette.DisabledGrey;
__instance.BackgroundBar.material.SetColor("_Color", Palette.DisabledGrey);
break;
case WinCondition.JesterWin:
textRenderer.text = "听我说谢谢你";
textRenderer.color = Jester.color;
Expand Down Expand Up @@ -511,11 +516,6 @@ public static void Postfix(EndGameManager __instance)
textRenderer.text = "豺狼的全家福.jpg";
textRenderer.color = Jackal.color;
break;
case WinCondition.EveryoneDied:
textRenderer.text = "无人生还";
textRenderer.color = Palette.DisabledGrey;
__instance.BackgroundBar.material.SetColor("_Color", Palette.DisabledGrey);
break;
case WinCondition.AkujoWin:
textRenderer.text = "请给我扭曲你人生的权利!";
textRenderer.color = Akujo.color;
Expand Down
55 changes: 35 additions & 20 deletions TheOtherRoles/Patches/PlayerControlPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -978,26 +978,40 @@ private static void snitchUpdate()
}
arrowIndex++;
}
// Text
if (numberOfTasks <= Snitch.taskCountForReveal && (forImpTeam || forKillerTeam || forEvilTeam || forNeutraTeam))
{
if (Snitch.text == null)
{
Snitch.text = Object.Instantiate(FastDestroyableSingleton<HudManager>.Instance.KillButton.cooldownTimerText, FastDestroyableSingleton<HudManager>.Instance.transform);
Snitch.text.enableWordWrapping = false;
Snitch.text.transform.localScale = Vector3.one * 0.75f;
Snitch.text.transform.localPosition += new Vector3(0f, 1.8f, -69f);
Snitch.text.gameObject.SetActive(true);
}
else if (!snitchIsDead && Snitch.snitch != null)
{
Snitch.text.text = "告密者还活着 " + playerCompleted + "/" + playerTotal;
}
else if (snitchIsDead || Snitch.snitch == null)
{
Snitch.text = null;
}
}
}
}
}
// Text
private static void snitchTextUpdate()
{
if (Snitch.localArrows == null || Snitch.snitch == null) return;
var (playerCompleted, playerTotal) = TasksHandler.taskInfo(Snitch.snitch.Data);
int numberOfTasks = playerTotal - playerCompleted;

var snitchIsDead = Snitch.snitch.Data.IsDead;
var local = CachedPlayer.LocalPlayer.PlayerControl;

bool forImpTeam = local.Data.Role.IsImpostor;
bool forKillerTeam = Snitch.Team == Snitch.includeNeutralTeam.KillNeutral && Helpers.isKiller(local);
bool forEvilTeam = Snitch.Team == Snitch.includeNeutralTeam.EvilNeutral && Helpers.isEvil(local);
bool forNeutraTeam = Snitch.Team == Snitch.includeNeutralTeam.AllNeutral && Helpers.isNeutral(local);
if (numberOfTasks <= Snitch.taskCountForReveal && (forImpTeam || forKillerTeam || forEvilTeam || forNeutraTeam))
{
if (Snitch.text == null)
{
Snitch.text = Object.Instantiate(FastDestroyableSingleton<HudManager>.Instance.KillButton.cooldownTimerText, FastDestroyableSingleton<HudManager>.Instance.transform);
Snitch.text.enableWordWrapping = false;
Snitch.text.transform.localScale = Vector3.one * 0.75f;
Snitch.text.transform.localPosition += new Vector3(0f, 1.8f, -69f);
Snitch.text.gameObject.SetActive(true);
}
else if (!snitchIsDead && Snitch.snitch != null)
{
Snitch.text.text = "告密者还活着 " + playerCompleted + "/" + playerTotal;
}
else if (snitchIsDead || Snitch.snitch == null)
{
Snitch.text.text = null;
}
}
}
Expand Down Expand Up @@ -1796,6 +1810,7 @@ public static void Postfix(PlayerControl __instance)
arsonistSetTarget();
// Snitch
snitchUpdate();
snitchTextUpdate();
// BodyGuard
bodyGuardSetTarget();
// undertaker
Expand Down
6 changes: 5 additions & 1 deletion TheOtherRoles/TheOtherRoles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3088,11 +3088,15 @@ public static void clearBomb(bool flag = true)

public static void clearAndReload()
{
if (defuseDuration + bombActiveAfter <= 1)
if (destructionTime + bombActiveAfter <= 1)
{
bombText = getString("TerroristBombText2");
selfExplosion = true;
};

Info("Terrorist Debug" + destructionTime + bombActiveAfter + " - " + selfExplosion.ToString());
Info("Terrorist Debug INT:" + (int)destructionTime + (int)bombActiveAfter + " - " + selfExplosion.ToString());

clearBomb(false);
terrorist = null;
bomb = null;
Expand Down

0 comments on commit 2fec1f0

Please sign in to comment.