Skip to content

Commit

Permalink
Add Aftermath
Browse files Browse the repository at this point in the history
  • Loading branch information
mxyx0412 committed Jun 27, 2024
1 parent 4d3e189 commit 73c1dac
Show file tree
Hide file tree
Showing 19 changed files with 238 additions and 43 deletions.
Binary file modified Strings.xlsx
Binary file not shown.
26 changes: 13 additions & 13 deletions TheOtherRoles/Buttons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ internal static class HudManagerStartPatch
private static CustomButton disperserDisperseButton;
private static CustomButton buttonBarryButton;
private static CustomButton morphlingButton;
private static CustomButton camouflagerButton;
public static CustomButton camouflagerButton;
public static CustomButton portalmakerPlacePortalButton;
private static CustomButton usePortalButton;
private static CustomButton portalmakerMoveToPortalButton;
Expand All @@ -55,9 +55,9 @@ internal static class HudManagerStartPatch
public static CustomButton swooperSwoopButton;
public static CustomButton swooperKillButton;
private static CustomButton jackalSidekickButton;
private static CustomButton eraserButton;
private static CustomButton placeJackInTheBoxButton;
private static CustomButton lightsOutButton;
public static CustomButton eraserButton;
public static CustomButton placeJackInTheBoxButton;
public static CustomButton lightsOutButton;
public static CustomButton cleanerCleanButton;
public static CustomButton undertakerDragButton;
public static CustomButton warlockCurseButton;
Expand Down Expand Up @@ -1952,7 +1952,8 @@ public static void createButtonsPostfix(HudManager __instance)
jackalSwoopButton = new CustomButton(
() =>
{ /* On Use */
MessageWriter invisibleWriter = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.SetJackalSwoop, SendOption.Reliable, -1);
var invisibleWriter = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId,
(byte)CustomRPC.SetJackalSwoop, SendOption.Reliable, -1);
invisibleWriter.Write(Jackal.jackal.PlayerId);
invisibleWriter.Write(byte.MinValue);
AmongUsClient.Instance.FinishRpcImmediately(invisibleWriter);
Expand Down Expand Up @@ -3590,8 +3591,8 @@ public static void createButtonsPostfix(HudManager __instance)
// Could Use
var text = getString("BlackmailerText");
if (Blackmailer.blackmailed != null) text = Blackmailer.blackmailed.Data.PlayerName;
showTargetNameOnButtonExplicit(Blackmailer.currentTarget, blackmailerButton,
text); //Show target name under button if setting is true
//Show target name under button if setting is true
showTargetNameOnButtonExplicit(Blackmailer.currentTarget, blackmailerButton, text);
return Blackmailer.currentTarget != null && CachedPlayer.LocalPlayer.PlayerControl.CanMove;
},
() => { blackmailerButton.Timer = blackmailerButton.MaxTimer; },
Expand Down Expand Up @@ -3695,22 +3696,21 @@ public static void createButtonsPostfix(HudManager __instance)
SoundEffectsManager.play(Terrorist.selfExplosion ? "bombExplosion" : "trapperTrap");
}
terroristButton.Timer = terroristButton.MaxTimer;
Terrorist.isPlanted = true;
if (Terrorist.selfExplosion)
{
var loacl = CachedPlayer.LocalPlayer.PlayerId;
var writer = AmongUsClient.Instance.StartRpcImmediately(
CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.UncheckedMurderPlayer,
SendOption.Reliable);
writer.Write(Terrorist.terrorist.Data.PlayerId);
writer.Write(Terrorist.terrorist.PlayerId);
writer.Write(loacl);
writer.Write(byte.MaxValue);
AmongUsClient.Instance.FinishRpcImmediately(writer);
RPCProcedure.uncheckedMurderPlayer(Terrorist.terrorist.Data.PlayerId, loacl, byte.MaxValue);
RPCProcedure.uncheckedMurderPlayer(Terrorist.terrorist.PlayerId, loacl, byte.MaxValue);
}
terroristButton.Timer = terroristButton.MaxTimer;
Terrorist.isPlanted = true;
},
() =>
{
Expand All @@ -3734,7 +3734,7 @@ public static void createButtonsPostfix(HudManager __instance)
terroristButton.isEffectActive = false;
terroristButton.actionButton.cooldownTimerText.color = Palette.EnabledColor;
},
buttonText: Terrorist.bombText
buttonText: Terrorist.selfExplosion ? getString("TerroristBombText2") : getString("TerroristBombText1")
);

defuseButton = new CustomButton(
Expand Down
10 changes: 6 additions & 4 deletions TheOtherRoles/Helper/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,7 @@ public static bool isShiftNeutral(PlayerControl player)
public static bool isNeutral(PlayerControl player)
{
var roleInfo = RoleInfo.getRoleInfoForPlayer(player, false).FirstOrDefault();
if (roleInfo != null)
return roleInfo.isNeutral;
return false;
return roleInfo != null && roleInfo.isNeutral;
}

public static bool isKiller(PlayerControl player)
Expand Down Expand Up @@ -1238,8 +1236,12 @@ public static void setDefaultLook(this PlayerControl target, bool enforceNightVi
return MurderAttemptResult.SuppressKill;
}

// Block impostor not fully grown mini kill
if (Aftermath.aftermath != null && Aftermath.aftermath == target)
{
RPCProcedure.aftermathDead(target.PlayerId, killer.PlayerId);
}

// Block impostor not fully grown mini kill
if (Mini.mini != null && target == Mini.mini && !Mini.isGrownUp()) return MurderAttemptResult.SuppressKill;
// Block Time Master with time shield kill
if (TimeMaster.shieldActive && TimeMaster.timeMaster != null && TimeMaster.timeMaster == target)
Expand Down
12 changes: 5 additions & 7 deletions TheOtherRoles/Modules/ChatCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,19 +114,17 @@ private static bool Prefix(ChatController __instance)
}
// 游戏中玩家指令
// 查看自己的职业介绍
else if (text.ToLower().StartsWith("/m") && InGame)
if (text.ToLower().StartsWith("/m") && InGame)
{
var localRole = RoleInfo.getRoleInfoForPlayer(CachedPlayer.LocalPlayer.PlayerControl);
var roleInfo = "";
for (var i = 0; i < localRole.Count; i++)
{
roleInfo += RoleInfo.GetRoleDescription(localRole[i]);
if (i < localRole.Count - 1)
{
roleInfo += "\n\n";
}
roleInfo = RoleInfo.GetRoleDescription(localRole[i]);

__instance.AddChat(CachedPlayer.LocalPlayer.PlayerControl, $"{localRole[i].name}:\n {roleInfo}\n");

}
__instance.AddChat(CachedPlayer.LocalPlayer.PlayerControl, roleInfo);
handled = true;
}

Expand Down
2 changes: 1 addition & 1 deletion TheOtherRoles/Modules/CustomHats/CustomHatManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static class CustomHatManager
public const string InnerslothPackageName = "Innersloth Hats";
public const string DeveloperPackageName = "Developer Hats";

internal static readonly Tuple<string, string, string> Repository = new("mxyx-club", "TheOtherHats", "master");
internal static readonly Tuple<string, string, string> Repository = new("TheOtherRolesAU", "TheOtherHats", "master");
internal static string RepositoryUrl
{
get
Expand Down
11 changes: 9 additions & 2 deletions TheOtherRoles/Objects/Trap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,12 @@ public static void activateTrap(byte trapId, PlayerControl trapper, PlayerContro
return;
}
else if ((p == 1f) && !target.Data.IsDead)
{ // 正常にキルが発生する場合の処理
{
// 正常にキルが発生する場合の処理
target.moveable = true;
if (CachedPlayer.LocalPlayer.PlayerControl == EvilTrapper.evilTrapper)
{
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.TrapperKill, SendOption.Reliable, -1);
var writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.TrapperKill, SendOption.Reliable, -1);
writer.Write(trapId);
writer.Write(CachedPlayer.LocalPlayer.PlayerControl.PlayerId);
writer.Write(target.PlayerId);
Expand Down Expand Up @@ -399,6 +400,12 @@ public static void trapKill(byte trapId, PlayerControl trapper, PlayerControl ta
audioSource.Stop();
audioSource.maxDistance = EvilTrapper.maxDistance;
audioSource.PlayOneShot(kill);
if (target == Medic.currentTarget || (target == Veteren.veteren && Veteren.alertActive) || target == BodyGuard.currentTarget
|| MapOption.shieldFirstKill && MapOption.firstKillPlayer == target || target == Mini.mini)
{
clearAllTraps();
checkMuderAttempt(EvilTrapper.evilTrapper, target);
}
FastDestroyableSingleton<HudManager>.Instance.StartCoroutine(Effects.Lerp(kill.length, new Action<float>((p) =>
{
if (p == 1f)
Expand Down
4 changes: 4 additions & 0 deletions TheOtherRoles/Options/CustomOptionHolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,8 @@ public class CustomOptionHolder
//public static CustomOption modifierBaitSwapNeutral;
//public static CustomOption modifierBaitSwapImpostor;

public static CustomOption modifierAftermath;

public static CustomOption modifierLover;
public static CustomOption modifierLoverImpLoverRate;
public static CustomOption modifierLoverBothDie;
Expand Down Expand Up @@ -1249,6 +1251,8 @@ public static void Load()
modifierBaitReportDelayMax = Create(40153, Types.Modifier, "诱饵报告延迟时间(最大)", 0f, 0f, 10f, 0.5f, modifierBait);
modifierBaitShowKillFlash = Create(40154, Types.Modifier, "用闪光灯警告杀手", true, modifierBait);

modifierAftermath = Create(40360, Types.Modifier, cs(Color.yellow, "Aftermath"), rates, null, true);

modifierSunglasses = Create(40170, Types.Modifier, cs(Color.yellow, "Sunglasses"), rates, null, true);
modifierSunglassesQuantity = Create(40171, Types.Modifier, cs(Color.yellow, "太阳镜数量"), ratesModifier, modifierSunglasses);
modifierSunglassesVision = Create(40172, Types.Modifier, "太阳镜的视野倍率", ["-10%", "-20%", "-30%", "-40%", "-50%"], modifierSunglasses);
Expand Down
2 changes: 1 addition & 1 deletion TheOtherRoles/Patches/ExileControllerPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ private static void WrapUpPostfix(GameData.PlayerInfo exiled)
}
// Mini exile lose condition
else if (exiled != null && Mini.mini != null && Mini.mini.PlayerId == exiled.PlayerId && !Mini.isGrownUp() &&
!Mini.mini.Data.Role.IsImpostor && !RoleInfo.getRoleInfoForPlayer(Mini.mini).Any(x => x.isNeutral))
!Mini.mini.Data.Role.IsImpostor && !isNeutral(Mini.mini))
Mini.triggerMiniLose = true;
// Jester win condition
else if (exiled != null && Jester.jester != null && Jester.jester.PlayerId == exiled.PlayerId)
Expand Down
4 changes: 3 additions & 1 deletion TheOtherRoles/Patches/MeetingHudPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ private static void guesserOnClick(int buttonTarget, MeetingHud __instance)
{
// Allow Guessing the following mods: Bait, TieBreaker, Bloody, and VIP
if (roleInfo.roleId is
not RoleId.Aftermath and
not RoleId.Bait and
not RoleId.Tiebreaker and
not RoleId.Bloody and
Expand Down Expand Up @@ -276,7 +277,8 @@ private static void guesserOnClick(int buttonTarget, MeetingHud __instance)
var roleData = RoleManagerSelectRolesPatch.getRoleAssignmentData();
switch (roleInfo.roleId)
{
case RoleId.Pursuer when CustomOptionHolder.lawyerSpawnRate.getSelection() == 0 && CustomOptionHolder.executionerSpawnRate.getSelection() == 0:
case RoleId.Pursuer when CustomOptionHolder.lawyerSpawnRate.getSelection() == 0
&& CustomOptionHolder.executionerSpawnRate.getSelection() == 0:
case RoleId.Spy when roleData.impostors.Count <= 1:
continue;
}
Expand Down
1 change: 1 addition & 0 deletions TheOtherRoles/Patches/PlayerControlPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1606,6 +1606,7 @@ public static void miniCooldownUpdate()
HudManagerStartPatch.jackalKillButton.MaxTimer = Jackal.cooldown * multiplier;
HudManagerStartPatch.sidekickKillButton.MaxTimer = Sidekick.cooldown * multiplier;
HudManagerStartPatch.warlockCurseButton.MaxTimer = Warlock.cooldown * multiplier;
HudManagerStartPatch.pavlovsdogsKillButton.MaxTimer = Pavlovsdogs.cooldown * multiplier;
HudManagerStartPatch.cleanerCleanButton.MaxTimer = Cleaner.cooldown * multiplier;
HudManagerStartPatch.witchSpellButton.MaxTimer =
(Witch.cooldown + Witch.currentCooldownAddition) * multiplier;
Expand Down
13 changes: 13 additions & 0 deletions TheOtherRoles/Patches/RoleAssignmentPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ private static void assignModifiers()
var chanceImpModifiers = new List<RoleId>();
allModifiers.AddRange(new List<RoleId>
{
RoleId.Aftermath,
RoleId.Tiebreaker,
RoleId.Mini,
RoleId.Giant,
Expand Down Expand Up @@ -924,6 +925,15 @@ private static byte setModifierToRandomPlayer(byte modifierId, List<PlayerContro

modifiers.RemoveAll(x => x == RoleId.Sunglasses);
}
if (modifiers.Contains(RoleId.Aftermath))
{
var Player = new List<PlayerControl>(playerList);
Player.RemoveAll(x => x.Data.Role.IsImpostor);
playerId = setModifierToRandomPlayer((byte)RoleId.Aftermath, Player);
Player.RemoveAll(x => x.PlayerId == playerId);
playerList.RemoveAll(x => x.PlayerId == playerId);
modifiers.RemoveAll(x => x == RoleId.Aftermath);
}
if (Bait.SwapCrewmate && modifiers.Contains(RoleId.Bait))
{
playerId = setModifierToRandomPlayer((byte)RoleId.Bait, crewPlayer);
Expand Down Expand Up @@ -1040,6 +1050,9 @@ private static int getSelectionForRoleId(RoleId roleId, bool multiplyQuantity =
case RoleId.Giant:
selection = CustomOptionHolder.modifierGiant.getSelection();
break;
case RoleId.Aftermath:
selection = CustomOptionHolder.modifierAftermath.getSelection();
break;
case RoleId.Bait:
selection = CustomOptionHolder.modifierBait.getSelection();
break;
Expand Down
2 changes: 2 additions & 0 deletions TheOtherRoles/Patches/UpdatePatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,13 @@ private static void setNameColors()
{
setPlayerNameColor(Sheriff.sheriff, Sheriff.color);
if (Deputy.deputy != null && Deputy.knowsSheriff) setPlayerNameColor(Deputy.deputy, Sheriff.color);
if (Sheriff.formerSheriff != null && Deputy.knowsSheriff) setPlayerNameColor(Sheriff.formerSheriff, Sheriff.color);
}
if (Deputy.deputy != null && Deputy.deputy == localPlayer)
{
setPlayerNameColor(Deputy.deputy, Deputy.color);
if (Sheriff.sheriff != null && Deputy.knowsSheriff) setPlayerNameColor(Sheriff.sheriff, Sheriff.color);
if (Sheriff.formerSheriff != null && Deputy.knowsSheriff) setPlayerNameColor(Sheriff.formerSheriff, Sheriff.color);
}

if (Prophet.prophet != null && Prophet.prophet == localPlayer)
Expand Down
Loading

0 comments on commit 73c1dac

Please sign in to comment.