Skip to content

Commit

Permalink
也许胜利条件做好了吧
Browse files Browse the repository at this point in the history
  • Loading branch information
mxyx0412 committed Jun 22, 2024
1 parent 1b3f66f commit 15c1082
Show file tree
Hide file tree
Showing 23 changed files with 102 additions and 102 deletions.
Binary file added Images/TOU_Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p align="center"> <a href="README_EN.md"> English </a> </p>

![mod banner](./Images/TOR_logo.png)
![mod banner](./Images/TOU_Logo.png)

<p align="center"><a href="https://github.com/mxyx-club/TheOtherUs-Edited/releases/latest">
<img src="https://badgen.net/github/release/mxyx-club/TheOtherUs-Edited"></a>
Expand Down Expand Up @@ -29,8 +29,11 @@

- #### 新增内容:

- 新增中立职业:巴甫洛夫、巴甫洛夫的狗
- 填充职业介绍文本
- 将会议中左上角的职业信息显示移动到右下角
- 新增选项 “阻止任务完成结束游戏”
- 新增赌怪模式选项:“强制巴甫洛夫为赌怪”
- 新增功能:房主可以在游戏中使用快捷键 "Ctrl+T+Enter" 或在聊天框中输入 "/end" 强制结束游戏
- 新增功能:房主可以在游戏中使用快捷键 "Ctrl+M+Enter" 或在聊天框中输入 "/mt" 或 "/meeting" 强制开启/关闭会议
- 豺狼:删除假跟班设定与对应选项
Expand All @@ -42,6 +45,7 @@

- 优化游戏开始时重置cd的逻辑
- 市长 & 执钮人:现在可以在破坏中使用紧急破坏按钮了(房主可设置)
- 魅魔:调整胜利条件顺序,现在会优先以恋人身份结束游戏
- 隐身人:修复隐身人为小孩时击杀冷却不是双倍
- 炸弹狂:将炸弹爆炸的击杀改为远程击杀而非自杀
- 末日预言家:适配赌怪能力为原生赌怪,修复在赌怪模式中猜测错误后图标不会消失等其它bug
Expand Down
2 changes: 1 addition & 1 deletion README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<p align="center"><a href="https://github.com/mxyx-club/TheOtherUs-Edited/releases/"><img src="https://badgen.net/github/release/mxyx-club/TheOtherUs-Edited"> <img src="https://badgen.net/github/assets-dl/mxyx-club/TheOtherUs-Edited"> <img src="https://badgen.net/github/watchers/mxyx-club/TheOtherUs-Edited"></a></p>

![mod banner](./Images/TOR_logo.png)
![mod banner](./Images/TOU_Logo.png)


This mod is not affiliated with Among Us or Innersloth LLC, and the content contained therein is not endorsed or otherwise sponsored by Innersloth LLC. Portions of the materials contained herein are property of Innersloth LLC. © Innersloth LLC.
Expand Down
Binary file modified Strings.xlsx
Binary file not shown.
55 changes: 28 additions & 27 deletions TheOtherRoles/Buttons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ internal static class HudManagerStartPatch
{
private static bool initialized;

private static float defaultMaxTimer = 0.5f;
private static readonly float defaultMaxTimer = 0.5f;
public static CustomButton engineerRepairButton;
public static CustomButton sheriffKillButton;
private static CustomButton deputyHandcuffButton;
Expand Down Expand Up @@ -291,7 +291,7 @@ public static void resetHuntedRewindButton()
var positionOffsetValue =
positionOffset ?? button.PositionOffset; // For non custom buttons, we can set these manually.
positionOffsetValue.z = -0.1f;
couldUse = couldUse ?? button.CouldUse;
couldUse ??= button.CouldUse;
var replacementHandcuffedButton = new CustomButton(() => { }, () => { return true; }, couldUse, () => { },
Deputy.getHandcuffedButtonSprite(), positionOffsetValue, button.hudManager, button.hotkey,
true, Deputy.handcuffDuration, () => { }, button.mirror);
Expand Down Expand Up @@ -543,44 +543,44 @@ public static void createButtonsPostfix(HudManager __instance)
if (checkAndDoVetKill(Sheriff.currentTarget)) return;
var murderAttemptResult = checkMuderAttempt(Sheriff.sheriff, Sheriff.currentTarget);
if (murderAttemptResult == MurderAttemptResult.SuppressKill) return;
var target = Sheriff.currentTarget;
if (murderAttemptResult == MurderAttemptResult.PerformKill)
{
byte targetId = 0;
if ((Sheriff.currentTarget != Mini.mini || Mini.isGrownUp()) &&
(Sheriff.currentTarget.Data.Role.IsImpostor ||
Jackal.jackal == Sheriff.currentTarget ||
Sidekick.sidekick == Sheriff.currentTarget ||
Juggernaut.juggernaut == Sheriff.currentTarget ||
Werewolf.werewolf == Sheriff.currentTarget ||
Swooper.swooper == Sheriff.currentTarget ||
Pavlovsdogs.pavlovsowner == Sheriff.currentTarget ||
Pavlovsdogs.pavlovsdogs.Any(p => p == Sheriff.currentTarget) ||
(Sheriff.spyCanDieToSheriff && Spy.spy == Sheriff.currentTarget) ||
if ((target != Mini.mini || Mini.isGrownUp()) &&
(target.Data.Role.IsImpostor ||
Jackal.jackal == target ||
Sidekick.sidekick == target ||
Juggernaut.juggernaut == target ||
Werewolf.werewolf == target ||
Swooper.swooper == target ||
Pavlovsdogs.pavlovsowner == target ||
Pavlovsdogs.pavlovsdogs.Any(p => p == target) ||
(Sheriff.spyCanDieToSheriff && Spy.spy == target) ||
(Sheriff.canKillNeutrals &&
((Arsonist.arsonist == Sheriff.currentTarget && Sheriff.canKillArsonist) ||
(Jester.jester == Sheriff.currentTarget && Sheriff.canKillJester) ||
(Vulture.vulture == Sheriff.currentTarget && Sheriff.canKillVulture) ||
(Thief.thief == Sheriff.currentTarget && Sheriff.canKillThief) ||
(Amnisiac.amnisiac == Sheriff.currentTarget && Sheriff.canKillAmnesiac) ||
(Lawyer.lawyer == Sheriff.currentTarget && Sheriff.canKillLawyer) ||
(Executioner.executioner == Sheriff.currentTarget && Sheriff.canKillExecutioner) ||
(Pursuer.pursuer == Sheriff.currentTarget && Sheriff.canKillPursuer) ||
(Doomsayer.doomsayer == Sheriff.currentTarget && Sheriff.canKillDoomsayer) ||
Akujo.akujo == Sheriff.currentTarget))))
(Akujo.akujo == target || isKiller(target) ||
(Jester.jester == target && Sheriff.canKillJester) ||
(Vulture.vulture == target && Sheriff.canKillVulture) ||
(Thief.thief == target && Sheriff.canKillThief) ||
(Amnisiac.amnisiac == target && Sheriff.canKillAmnesiac) ||
(Lawyer.lawyer == target && Sheriff.canKillLawyer) ||
(Executioner.executioner == target && Sheriff.canKillExecutioner) ||
(Pursuer.pursuer == target && Sheriff.canKillPursuer) ||
(Doomsayer.doomsayer == target && Sheriff.canKillDoomsayer)))))
{
targetId = Sheriff.currentTarget.PlayerId;
targetId = target.PlayerId;
}
else if (Sheriff.misfireKills == 0)
{
targetId = CachedPlayer.LocalPlayer.PlayerId;
}
else if (Sheriff.misfireKills == 1)
{
targetId = Sheriff.currentTarget.PlayerId;
targetId = target.PlayerId;
}
else if (Sheriff.misfireKills == 2)
{
targetId = Sheriff.currentTarget.PlayerId;
targetId = target.PlayerId;
var killWriter2 = AmongUsClient.Instance.StartRpcImmediately(
CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.UncheckedMurderPlayer,
SendOption.Reliable);
Expand All @@ -603,7 +603,7 @@ public static void createButtonsPostfix(HudManager __instance)
}
if (murderAttemptResult == MurderAttemptResult.BodyGuardKill)
checkMurderAttemptAndKill(Sheriff.sheriff, Sheriff.currentTarget);
checkMurderAttemptAndKill(Sheriff.sheriff, target);
sheriffKillButton.Timer = sheriffKillButton.MaxTimer;
Sheriff.currentTarget = null;
Expand Down Expand Up @@ -2129,6 +2129,7 @@ public static void createButtonsPostfix(HudManager __instance)
AmongUsClient.Instance.FinishRpcImmediately(writer);
RPCProcedure.pavlovsCreateDog(Pavlovsdogs.currentTarget.PlayerId);
SoundEffectsManager.play("jackalSidekick");
Pavlovsdogs.createDogNum -= 1;
pavlovsownerCreateDogButton.Timer = pavlovsownerCreateDogButton.MaxTimer;
},
() =>
Expand Down Expand Up @@ -3501,7 +3502,7 @@ public static void createButtonsPostfix(HudManager __instance)
RPCProcedure.placeNinjaTrace(buff);
}
if (attempt == MurderAttemptResult.BlankKill || attempt == MurderAttemptResult.PerformKill)
if (attempt is MurderAttemptResult.BlankKill or MurderAttemptResult.PerformKill)
{
ninjaButton.Timer = ninjaButton.MaxTimer;
Ninja.ninja.killTimer = GameOptionsManager.Instance.currentNormalGameOptions.KillCooldown;
Expand Down
17 changes: 8 additions & 9 deletions TheOtherRoles/CustomOptionHolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ public class CustomOptionHolder
public static CustomOption sheriffMisfireKills;
public static CustomOption sheriffCooldown;
public static CustomOption sheriffCanKillNeutrals;
public static CustomOption sheriffCanKillArsonist;
public static CustomOption sheriffCanKillLawyer;
public static CustomOption sheriffCanKillExecutioner;
public static CustomOption sheriffCanKillJester;
Expand Down Expand Up @@ -617,6 +616,7 @@ public class CustomOptionHolder
public static CustomOption guesserGamemodeImpNumber;
public static CustomOption guesserForceJackalGuesser;
public static CustomOption guesserGamemodeSidekickIsAlwaysGuesser;
public static CustomOption guesserForcePavlovsGuesser;
public static CustomOption guesserForceThiefGuesser;
public static CustomOption guesserGamemodeHaveModifier;
public static CustomOption guesserGamemodeNumberOfShots;
Expand Down Expand Up @@ -743,16 +743,18 @@ public static void Load()
//allowModGuess = Create(31, Types.General, "allowModGuess", false);
//ghostSpeed = Create(33, Types.General, "ghostSpeed", 1f, 0.75f, 5f, 0.125f);

transparentTasks = Create(40, Types.General, "transparentTasks", false, null, true);
WireTaskIsRandomOption = Create(221, Types.General, "WireTaskIsRandomOption", false, enableMapOptions, true);
WireTaskNumOption = Create(222, Types.General, "WireTaskNumOption", 3f, 1f, 8f, 1f, WireTaskIsRandomOption);
transparentTasks = Create(40, Types.General, "transparentTasks", false);
disableMedbayWalk = Create(41, Types.General, "disableMedbayWalk", false);
allowParallelMedBayScans = Create(44, Types.General, "allowParallelMedBayScans", false);
finishTasksBeforeHauntingOrZoomingOut = Create(42, Types.General, "finishTasksBeforeHauntingOrZoomingOut", false);
//preventTaskEnd = Create(43, Types.General, "preventTaskEnd", false);
preventTaskEnd = Create(43, Types.General, "preventTaskEnd", false);

//Map options
enableMapOptions = Create(200, Types.General, "enableMapOptions", false, null, true);

IsReactorDurationSetting = Create(201, Types.General, "IsReactorDurationSetting", false, enableMapOptions, true);
IsReactorDurationSetting = Create(201, Types.General, "IsReactorDurationSetting", false, null, true);
SkeldReactorTimeLimit = Create(202, Types.General, "SkeldReactorTimeLimit", 30f, 15f, 60f, 2.5f, IsReactorDurationSetting);
SkeldLifeSuppTimeLimit = Create(203, Types.General, "SkeldLifeSuppTimeLimit", 30f, 15f, 60f, 2.5f, IsReactorDurationSetting);
MiraLifeSuppTimeLimit = Create(204, Types.General, "MiraLifeSuppTimeLimit", 30f, 15f, 60f, 2.5f, IsReactorDurationSetting);
Expand Down Expand Up @@ -785,9 +787,6 @@ public static void Load()
enableFungleModify = Create(100, Types.General, cs(new Color(200f / 200f, 200f / 200f, 0, 1f), "Fungle"), false, enableMapOptions);
fungleElectrical = Create(101, Types.General, "fungleElectrical", false, enableFungleModify);

WireTaskIsRandomOption = Create(221, Types.General, "WireTaskIsRandomOption", false, enableMapOptions, true);
WireTaskNumOption = Create(222, Types.General, "WireTaskNumOption", 3f, 1f, 8f, 1f, WireTaskIsRandomOption);

enableCamoComms = Create(120, Types.General, cs(Palette.ImpostorRed, "enableCamoComms"), false, enableMapOptions, true);
//fungleDisableCamoComms = Create(211, Types.General, "fungleDisableCamoComms", true, enableCamoComms);
restrictDevices = Create(121, Types.General, "restrictDevices", ["optionOff", "restrictDevices2", "restrictDevices3"], enableMapOptions);
Expand Down Expand Up @@ -1057,7 +1056,6 @@ public static void Load()
sheriffCanKillVulture = Create(30155, Types.Crewmate, "可执法 " + cs(Vulture.color, "秃鹫"), true, sheriffCanKillNeutrals);
sheriffCanKillThief = Create(30157, Types.Crewmate, "可执法 " + cs(Thief.color, "身份窃贼"), true, sheriffCanKillNeutrals);
sheriffCanKillDoomsayer = Create(30159, Types.Crewmate, "可执法 " + cs(Doomsayer.color, "末日预言家"), true, sheriffCanKillNeutrals);
sheriffCanKillArsonist = Create(30154, Types.Crewmate, "可执法 " + cs(Arsonist.color, "纵火犯"), true, sheriffCanKillNeutrals);

deputySpawnRate = Create(30170, Types.Crewmate, cs(Deputy.color, "可拥有一名捕快"), rates, sheriffSpawnRate);
deputyNumberOfHandcuffs = Create(30171, Types.Crewmate, "手铐可用次数", 5f, 1f, 10f, 1f, deputySpawnRate);
Expand Down Expand Up @@ -1317,6 +1315,7 @@ public static void Load()
guesserGamemodeImpNumber = Create(2003, Types.Guesser, cs(Guesser.color, "伪装者阵营赌怪数"), 3f, 0f, 15f, 1f);
guesserForceJackalGuesser = Create(2007, Types.Guesser, "强制豺狼成为赌怪", false, null, true);
guesserGamemodeSidekickIsAlwaysGuesser = Create(2012, Types.Guesser, "强制跟班成为赌怪", false);
guesserForcePavlovsGuesser = Create(2013, Types.Guesser, "强制巴甫洛夫为赌怪", false);
guesserForceThiefGuesser = Create(2011, Types.Guesser, "强制身份窃贼为赌怪", false);
guesserGamemodeHaveModifier = Create(2004, Types.Guesser, "赌怪可以拥有附加能力", true, null, true);
guesserGamemodeNumberOfShots = Create(2005, Types.Guesser, "赌怪猜测最大次数", 2f, 1f, 15f, 1f);
Expand Down Expand Up @@ -1416,7 +1415,7 @@ public static void Load()

blockedRolePairings.Add((byte)RoleId.Vulture, [(byte)RoleId.Cleaner]);
blockedRolePairings.Add((byte)RoleId.Cleaner, [(byte)RoleId.Vulture]);

blockedRolePairings.Add((byte)RoleId.Executioner, [(byte)RoleId.Lawyer]);
blockedRolePairings.Add((byte)RoleId.Lawyer, [(byte)RoleId.Executioner]);

Expand Down
7 changes: 2 additions & 5 deletions TheOtherRoles/Helper/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@
using Hazel;
using InnerNet;
using Reactor.Utilities.Extensions;
using Rewired.Utils.Platforms.Windows;
using TheOtherRoles.CustomGameModes;
using TheOtherRoles.Modules;
using TheOtherRoles.Objects;
using TheOtherRoles.Patches;
using TheOtherRoles.Roles.Impostor;
using TheOtherRoles.Utilities;
using UnityEngine;
using Object = UnityEngine.Object;
Expand Down Expand Up @@ -380,8 +378,7 @@ public static SabatageTypes getActiveSabo()
return SabatageTypes.Lights;
else if (task.TaskType == TaskTypes.RestoreOxy)
return SabatageTypes.O2;
else if (task.TaskType == TaskTypes.ResetReactor || task.TaskType == TaskTypes.StopCharles ||
task.TaskType == TaskTypes.StopCharles)
else if (task.TaskType is TaskTypes.ResetReactor or TaskTypes.StopCharles or TaskTypes.StopCharles)
return SabatageTypes.Reactor;
else if (task.TaskType == TaskTypes.FixComms)
return SabatageTypes.Comms;
Expand Down Expand Up @@ -846,7 +843,7 @@ public static bool isCustomServer()
{
if (FastDestroyableSingleton<ServerManager>.Instance == null) return false;
var n = FastDestroyableSingleton<ServerManager>.Instance.CurrentRegion.TranslateName;
return n != StringNames.ServerNA && n != StringNames.ServerEU && n != StringNames.ServerAS;
return n is not StringNames.ServerNA and not StringNames.ServerEU and not StringNames.ServerAS;
}

public static bool isDead(this PlayerControl player)
Expand Down
6 changes: 0 additions & 6 deletions TheOtherRoles/Main.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using AmongUs.Data;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Unity.IL2CPP;
using Hazel;
using InnerNet;
using Reactor.Networking;
using Reactor.Networking.Attributes;
using TheOtherRoles.Modules;
using TheOtherRoles.Modules.CustomHats;
using TheOtherRoles.Patches;
using TheOtherRoles.Utilities;
using UnityEngine;
using Object = UnityEngine.Object;
using Random = System.Random;

namespace TheOtherRoles;

Expand Down
1 change: 1 addition & 0 deletions TheOtherRoles/MapOption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ internal static class MapOption
{
public static float ButtonCooldown => CustomOptionHolder.resteButtonCooldown.getFloat();
public static float KillCooddown => GameOptionsManager.Instance.currentNormalGameOptions.KillCooldown;
public static bool PreventTaskEnd => CustomOptionHolder.preventTaskEnd.getBool();

// Set values
public static int maxNumberOfMeetings = 10;
Expand Down
12 changes: 5 additions & 7 deletions TheOtherRoles/Modules/ChatCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private static bool Prefix(ChatController __instance)
// 踢出玩家
if (text.ToLower().StartsWith("/kick "))
{
var playerName = text.Substring(6);
var playerName = text[6..];
PlayerControl target =
CachedPlayer.AllPlayers.FirstOrDefault(x => x.Data.PlayerName.Equals(playerName));
if (target != null && AmongUsClient.Instance != null && AmongUsClient.Instance.CanBan())
Expand All @@ -56,7 +56,7 @@ private static bool Prefix(ChatController __instance)
// 封禁玩家
else if (text.ToLower().StartsWith("/ban "))
{
var playerName = text.Substring(5);
var playerName = text[5..];
PlayerControl target =
CachedPlayer.AllPlayers.FirstOrDefault(x => x.Data.PlayerName.Equals(playerName));
if (target != null && AmongUsClient.Instance != null && AmongUsClient.Instance.CanBan())
Expand Down Expand Up @@ -145,10 +145,8 @@ private static bool Prefix(ChatController __instance)
else if (text.ToLower().StartsWith("/color "))
{
handled = true;
int col;
if (!int.TryParse(text.Substring(7), out col))
__instance.AddChat(CachedPlayer.LocalPlayer.PlayerControl,
"Unable to parse color id\nUsage: /color {id}");
if (!int.TryParse(text.AsSpan(7), out var col))
__instance.AddChat(CachedPlayer.LocalPlayer.PlayerControl, "Unable to parse color id\nUsage: /color {id}");
col = Math.Clamp(col, 0, Palette.PlayerColors.Length - 1);
CachedPlayer.LocalPlayer.PlayerControl.SetColor(col);
__instance.AddChat(CachedPlayer.LocalPlayer.PlayerControl, "Changed color succesfully");
Expand All @@ -158,7 +156,7 @@ private static bool Prefix(ChatController __instance)
// 死亡玩家指令
if (text.ToLower().StartsWith("/tp ") && CachedPlayer.LocalPlayer.Data.IsDead)
{
var playerName = text.Substring(4).ToLower();
var playerName = text[4..].ToLower();
PlayerControl target =
CachedPlayer.AllPlayers.FirstOrDefault(x => x.Data.PlayerName.ToLower().Equals(playerName));
if (target != null)
Expand Down
Loading

0 comments on commit 15c1082

Please sign in to comment.