Skip to content

Commit

Permalink
Merge v1.0.9.8
Browse files Browse the repository at this point in the history
  • Loading branch information
mxyx0412 committed Nov 27, 2024
1 parent 4bad154 commit fe53440
Show file tree
Hide file tree
Showing 36 changed files with 485 additions and 705 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ Among Us/*/*

TheOtherRoles/obj
TheOtherRoles/bin
TheOtherRoles/Properties/

.idea/
.vs/
Expand Down
27 changes: 9 additions & 18 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
v1.0.9.0更新日志:
v1.0.9.8更新日志:

* 完善职业介绍
* 游戏内添加职业介绍按钮(可按H打开)
* 优化游戏内按钮布局
* 新增伪装者职业:掷弹兵
* 新增选项: "禁用破坏功能", 可以直接禁用所有破坏(但可以关门)
* 新增选项:"诅咒模式", 将小部分的任务难度加强到地狱级
* 反骨:隐藏职业时,可以分配到已有附加能力的玩家中。
* 破平者:重做逻辑,现在为全局1.5票,不会与其它职业冲突。
* 大神官:现在不会出现与破平冲突导致驱除出错的问题了
* 大神官:更换会议界面背景图片
* 抹除者:修复抹除刀余波时会导致房主会卡在驱逐画面的问题
* 专业刺客:优化赌怪猜测,修复猜错后无法继续猜测下一位玩家的问题。
* 身份窃贼:修复击杀巴甫洛夫阵营时会出现一个人同时是"巴甫洛夫"和"巴甫洛夫的狗"的问题
* 修正部分预设问题
* 修复巴甫洛夫无法破坏的问题
* 修复大神官能多次使用技能的问题
* 修复一个玩家有可能获得两个附加能力的问题
* 新增警长等相关的死亡描述
* 魅魔:修复胜利条件
* 反骨:修正分配阵营问题
* 换票师:修复无法正常换票的问题
* 纵火犯:将点火击杀改为强制击杀,使其不会在点火时被老兵反弹而死
* 身份窃贼:被身份窃贼击杀的中立阵营会转换成死亡的幸存者,不会变为船员

#### 新增Lite轻量化版本,仅删除躲猫猫模式与其它无用功能以增强稳定性。
Binary file modified Strings.xlsx
Binary file not shown.
113 changes: 67 additions & 46 deletions TheOtherRoles/Buttons/Buttons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ internal static class HudManagerStartPatch
public static CustomButton securityGuardButton;
public static CustomButton securityGuardCamButton;
public static CustomButton arsonistButton;
public static CustomButton arsonistKillButton;
public static CustomButton vultureEatButton;
public static CustomButton mediumButton;
public static CustomButton pursuerButton;
Expand Down Expand Up @@ -578,41 +579,44 @@ public static void createButtonsPostfix(HudManager __instance)
byte targetId = 0;

if (Sheriff.sheriffCanKillNeutral(target))
{
targetId = target.PlayerId;
GameHistory.RpcOverrideDeathReasonAndKiller(target, CustomDeathReason.SheriffKill, Sheriff.sheriff);
}
else
{
switch (Sheriff.misfireKills)
{
case 0:
targetId = CachedPlayer.LocalPlayer.PlayerId;
GameHistory.RpcOverrideDeathReasonAndKiller(Sheriff.sheriff, CustomDeathReason.SheriffMisfire, Sheriff.sheriff);
break;
case 1:
targetId = target.PlayerId;
GameHistory.RpcOverrideDeathReasonAndKiller(target, CustomDeathReason.SheriffMisadventure, Sheriff.sheriff);
break;
case 2:
targetId = target.PlayerId;
var killWriter2 = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId,
(byte)CustomRPC.UncheckedMurderPlayer, SendOption.Reliable);
var killWriter2 = StartRPC(CachedPlayer.LocalPlayer.PlayerControl.NetId, CustomRPC.UncheckedMurderPlayer);
killWriter2.Write(Sheriff.sheriff.Data.PlayerId);
killWriter2.Write(CachedPlayer.LocalPlayer.PlayerId);
killWriter2.Write(byte.MaxValue);
AmongUsClient.Instance.FinishRpcImmediately(killWriter2);
killWriter2.EndRPC();
RPCProcedure.uncheckedMurderPlayer(Sheriff.sheriff.Data.PlayerId, CachedPlayer.LocalPlayer.PlayerId, byte.MaxValue);
GameHistory.RpcOverrideDeathReasonAndKiller(target, CustomDeathReason.SheriffMisadventure, Sheriff.sheriff);
GameHistory.RpcOverrideDeathReasonAndKiller(Sheriff.sheriff, CustomDeathReason.SheriffMisfire, Sheriff.sheriff);
break;
}
}

var killWriter = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId,
(byte)CustomRPC.UncheckedMurderPlayer, SendOption.Reliable
);
var killWriter = StartRPC(CachedPlayer.LocalPlayer.PlayerControl.NetId, CustomRPC.UncheckedMurderPlayer);
killWriter.Write(Sheriff.sheriff.Data.PlayerId);
killWriter.Write(targetId);
killWriter.Write(byte.MaxValue);
AmongUsClient.Instance.FinishRpcImmediately(killWriter);
killWriter.EndRPC();
RPCProcedure.uncheckedMurderPlayer(Sheriff.sheriff.Data.PlayerId, targetId, byte.MaxValue);
}


if (murderAttemptResult == MurderAttemptResult.BodyGuardKill) checkMurderAttemptAndKill(Sheriff.sheriff, target);

sheriffKillButton.Timer = sheriffKillButton.MaxTimer;
Expand Down Expand Up @@ -1152,7 +1156,7 @@ public static void createButtonsPostfix(HudManager __instance)
() =>
{
if (Morphling.sampledTarget == null) showTargetNameOnButton(Morphling.currentTarget, morphlingButton, GetString("SampleText"));
return (Morphling.currentTarget || Morphling.sampledTarget) && !isActiveCamoComms() &&
return (Morphling.currentTarget || Morphling.sampledTarget) && !isActiveCamoComms &&
CachedPlayer.LocalPlayer.PlayerControl.CanMove && !MushroomSabotageActive();
},
() =>
Expand Down Expand Up @@ -1201,7 +1205,7 @@ public static void createButtonsPostfix(HudManager __instance)
Camouflager.camouflager == CachedPlayer.LocalPlayer.PlayerControl &&
!CachedPlayer.LocalPlayer.Data.IsDead;
},
() => { return !isActiveCamoComms() && CachedPlayer.LocalPlayer.PlayerControl.CanMove; },
() => { return !isActiveCamoComms && CachedPlayer.LocalPlayer.PlayerControl.CanMove; },
() =>
{
camouflagerButton.Timer = camouflagerButton.MaxTimer;
Expand Down Expand Up @@ -3016,26 +3020,14 @@ public static void createButtonsPostfix(HudManager __instance)
securityGuardChargesText.transform.localScale = Vector3.one * 0.5f;
securityGuardChargesText.transform.localPosition += new Vector3(-0.05f, 0.7f, 0);

// Arsonist button
// Arsonist button (涂油)
arsonistButton = new CustomButton(
() =>
{
var dousedEveryoneAlive = Arsonist.dousedEveryoneAlive();
if (dousedEveryoneAlive)
{
var winWriter = AmongUsClient.Instance.StartRpcImmediately(
CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.ArsonistWin, SendOption.Reliable);
AmongUsClient.Instance.FinishRpcImmediately(winWriter);
RPCProcedure.arsonistWin();
arsonistButton.HasEffect = false;
}
else if (Arsonist.currentTarget != null)
{
if (checkAndDoVetKill(Arsonist.currentTarget)) return;
Arsonist.douseTarget = Arsonist.currentTarget;
arsonistButton.HasEffect = true;
SoundEffectsManager.play("arsonistDouse");
}
if (checkAndDoVetKill(Arsonist.currentTarget)) return;
Arsonist.douseTarget = Arsonist.currentTarget;
arsonistButton.HasEffect = true;
SoundEffectsManager.play("arsonistDouse");
},
() =>
{
Expand All @@ -3047,7 +3039,6 @@ public static void createButtonsPostfix(HudManager __instance)
var dousedEveryoneAlive = Arsonist.dousedEveryoneAlive();
if (!dousedEveryoneAlive)
showTargetNameOnButton(Arsonist.currentTarget, arsonistButton, GetString("DouseText"));
if (dousedEveryoneAlive) arsonistButton.actionButton.graphic.sprite = Arsonist.igniteSprite;

if (arsonistButton.isEffectActive && Arsonist.douseTarget != Arsonist.currentTarget)
{
Expand All @@ -3056,8 +3047,7 @@ public static void createButtonsPostfix(HudManager __instance)
arsonistButton.isEffectActive = false;
}

return CachedPlayer.LocalPlayer.PlayerControl.CanMove &&
(dousedEveryoneAlive || Arsonist.currentTarget != null);
return CachedPlayer.LocalPlayer.PlayerControl.CanMove && Arsonist.currentTarget != null;
},
() =>
{
Expand All @@ -3066,7 +3056,7 @@ public static void createButtonsPostfix(HudManager __instance)
Arsonist.douseTarget = null;
},
Arsonist.douseSprite,
ButtonPositions.lowerRowRight,
ButtonPositions.upperRowRight,
__instance,
abilityInput.keyCode,
true,
Expand All @@ -3075,8 +3065,8 @@ public static void createButtonsPostfix(HudManager __instance)
{
if (Arsonist.douseTarget != null) Arsonist.dousedPlayers.Add(Arsonist.douseTarget);

arsonistButton.Timer = Arsonist.dousedEveryoneAlive() ? 0 : arsonistButton.MaxTimer;

arsonistButton.Timer = arsonistButton.MaxTimer;
arsonistKillButton.Timer = arsonistButton.MaxTimer;
foreach (var p in Arsonist.dousedPlayers)
if (ModOption.playerIcons.ContainsKey(p.PlayerId))
ModOption.playerIcons[p.PlayerId].setSemiTransparent(false);
Expand All @@ -3093,6 +3083,43 @@ public static void createButtonsPostfix(HudManager __instance)
}
);

// Arsonist button (点火)
arsonistKillButton = new CustomButton(
() =>
{
foreach (PlayerControl p in Arsonist.dousedPlayers.Where(p => p.IsAlive()))
{
MurderPlayer(Arsonist.arsonist, p, false);
GameHistory.RpcOverrideDeathReasonAndKiller(p, CustomDeathReason.Arson, Arsonist.arsonist);
}
arsonistKillButton.Timer = arsonistKillButton.MaxTimer;
arsonistButton.Timer = arsonistButton.MaxTimer;
},
() =>
{
return Arsonist.arsonist != null && Arsonist.arsonist == CachedPlayer.LocalPlayer.PlayerControl &&
CachedPlayer.LocalPlayer.IsAlive && Arsonist.dousedPlayers != null && Arsonist.dousedPlayers.Count > 0;
},
() =>
{
showTargetNameOnButton(Arsonist.currentTarget2, arsonistKillButton, GetString("IgniteText"));
return CachedPlayer.LocalPlayer.PlayerControl.CanMove && Arsonist.currentTarget2 != null && Arsonist.dousedPlayers.Any(p => p == Arsonist.currentTarget2);
},
() =>
{
var alivePlayersList = PlayerControl.AllPlayerControls.ToArray().Where(pc => !pc.Data.IsDead);
var count = alivePlayersList.Count(pc => pc.IsKiller());

if (count < 1 && Arsonist.igniteCooldownRemoved) arsonistKillButton.Timer = arsonistKillButton.MaxTimer = 0f;
else arsonistKillButton.Timer = arsonistKillButton.MaxTimer;
},
Arsonist.igniteSprite,
ButtonPositions.upperRowCenter,
__instance,
modKillInput.keyCode,
buttonText: GetString("IgniteText")
);

// Vulture Eat
vultureEatButton = new CustomButton(
() =>
Expand Down Expand Up @@ -3954,44 +3981,38 @@ public static void createButtonsPostfix(HudManager __instance)
if (Thief.suicideFlag)
{
// Suicide
var writer2 = AmongUsClient.Instance.StartRpcImmediately(
CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.UncheckedMurderPlayer,
SendOption.Reliable);
var writer2 = StartRPC(CachedPlayer.LocalPlayer.PlayerControl.NetId, CustomRPC.UncheckedMurderPlayer);
writer2.Write(thief.PlayerId);
writer2.Write(thief.PlayerId);
writer2.Write(0);
writer2.EndRPC();
RPCProcedure.uncheckedMurderPlayer(thief.PlayerId, thief.PlayerId, 0);
AmongUsClient.Instance.FinishRpcImmediately(writer2);
Thief.thief.clearAllTasks();
}

// Steal role if survived.
if (!Thief.thief.Data.IsDead && result == MurderAttemptResult.PerformKill)
{
var writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId,
(byte)CustomRPC.ThiefStealsRole, SendOption.Reliable);
var writer = StartRPC(CachedPlayer.LocalPlayer.PlayerControl.NetId, CustomRPC.ThiefStealsRole);
writer.Write(target.PlayerId);
AmongUsClient.Instance.FinishRpcImmediately(writer);
writer.EndRPC();
RPCProcedure.thiefStealsRole(target.PlayerId);
}

// Kill the victim (after becoming their role - so that no win is triggered for other teams)
if (result == MurderAttemptResult.PerformKill)
{
var writer = AmongUsClient.Instance.StartRpcImmediately(
CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.UncheckedMurderPlayer,
SendOption.Reliable);
var writer = StartRPC(CachedPlayer.LocalPlayer.PlayerControl.NetId, CustomRPC.UncheckedMurderPlayer);
writer.Write(thief.PlayerId);
writer.Write(target.PlayerId);
writer.Write(byte.MaxValue);
AmongUsClient.Instance.FinishRpcImmediately(writer);
writer.EndRPC();
RPCProcedure.uncheckedMurderPlayer(thief.PlayerId, target.PlayerId, byte.MaxValue);
}
},
() =>
{
return Thief.thief != null && CachedPlayer.LocalPlayer.PlayerControl == Thief.thief &&
!CachedPlayer.LocalPlayer.Data.IsDead;
return Thief.thief != null && CachedPlayer.LocalPlayer.PlayerControl == Thief.thief && CachedPlayer.LocalPlayer.PlayerControl.IsAlive();
},
() => { return Thief.currentTarget != null && CachedPlayer.LocalPlayer.PlayerControl.CanMove; },
() => { thiefKillButton.Timer = thiefKillButton.MaxTimer; },
Expand Down
5 changes: 2 additions & 3 deletions TheOtherRoles/Buttons/CustomButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ public CustomButton SetTimer(float timer)
public void Update()
{
var localPlayer = CachedPlayer.LocalPlayer;
var moveable = localPlayer.PlayerControl.moveable;

if (localPlayer.Data == null || MeetingHud.Instance || ExileController.Instance || !HasButton())
{
Expand All @@ -211,7 +210,7 @@ public void Update()
// This had to be reordered, so that the handcuffs do not stop the underlying timers from running
if (HasEffect && isEffectActive)
DeputyTimer -= Time.deltaTime;
else if (!localPlayer.PlayerControl.inVent && moveable)
else if (!localPlayer.PlayerControl.inVent)
DeputyTimer -= Time.deltaTime;
}

Expand Down Expand Up @@ -260,7 +259,7 @@ public void Update()
{
if (HasEffect && isEffectActive)
Timer -= Time.deltaTime;
else if (!localPlayer.PlayerControl.inVent && moveable)
else if (!localPlayer.PlayerControl.inVent)
Timer -= Time.deltaTime;
}

Expand Down
Loading

0 comments on commit fe53440

Please sign in to comment.