This repository has been archived by the owner on Feb 19, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 371
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #232 from NotSugden/fix-underdog
fix(Underdog): change kill cooldown at the end of a meeting
- Loading branch information
Showing
4 changed files
with
48 additions
and
15 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
source/Patches/ImpostorRoles/UnderdogMod/PatchKillTimer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using HarmonyLib; | ||
using TownOfUs.Roles; | ||
using UnityEngine; | ||
|
||
namespace TownOfUs.ImpostorRoles.UnderdogMod | ||
{ | ||
[HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.SetKillTimer))] | ||
public static class PatchKillTimer | ||
{ | ||
public static bool Prefix(PlayerControl __instance, [HarmonyArgument(0)] float time) | ||
{ | ||
var role = Role.GetRole(__instance); | ||
if (role?.RoleType != RoleEnum.Underdog) return true; | ||
var maxTimer = ((Underdog)role).MaxTimer(); | ||
__instance.killTimer = Mathf.Clamp(time, 0, maxTimer); | ||
HudManager.Instance.KillButton.SetCoolDown(__instance.killTimer, maxTimer); | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
using HarmonyLib; | ||
using HarmonyLib; | ||
using TownOfUs.Roles; | ||
using UnityEngine; | ||
|
||
namespace TownOfUs.ImpostorRoles.UnderdogMod | ||
{ | ||
[HarmonyPatch(typeof(Object), nameof(Object.Destroy), typeof(Object))] | ||
[HarmonyPatch(typeof(ExileController), nameof(ExileController.WrapUp))] | ||
public static class HUDClose | ||
{ | ||
public static void Postfix(Object obj) | ||
public static void Postfix() | ||
{ | ||
if (ExileController.Instance == null || obj != ExileController.Instance.gameObject) return; | ||
if (PlayerControl.LocalPlayer.Is(RoleEnum.Underdog)) | ||
PlayerControl.LocalPlayer.SetKillTimer(PlayerControl.GameOptions.KillCooldown * | ||
(PerformKill.LastImp() ? 0.5f : 1.5f)); | ||
var role = Role.GetRole(PlayerControl.LocalPlayer); | ||
if (role?.RoleType == RoleEnum.Underdog) | ||
((Underdog)role).SetKillTimer(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters