Small improvements

This commit is contained in:
Gurge44 committed 2024-03-18 18:10:21 +01:00
1 parent 54237e1eda
commit 9e8048972a
7 files changed
+14 -21

No files matched your search

+5 -11
View File
@@ -1,15 +1,12 @@
using System;
using AmongUs.GameOptions;
using HarmonyLib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using AmongUs.GameOptions;
using HarmonyLib;
using TOHE.GameMode.HideAndSeekRoles;
using TOHE.Modules;
using UnityEngine;
using UnityEngine.PlayerLoop;
namespace TOHE
{
@@ -83,7 +80,7 @@ namespace TOHE
if (stop) break;
}
if (allPlayers.Count == 0) return;
if (stop) return;
foreach (var pc in allPlayers)
{
@@ -155,7 +152,6 @@ namespace TOHE
{
reason = GameOverReason.HumansByTask;
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Hider);
CustomWinnerHolder.WinnerRoles.Add(CustomRoles.Hider);
CustomWinnerHolder.WinnerIds.UnionWith(Main.PlayerStates.Where(x => x.Value.MainRole == CustomRoles.Hider).Select(x => x.Key));
AddFoxesToWinners();
return true;
@@ -165,7 +161,6 @@ namespace TOHE
if (alivePlayers.All(x => x.GetCustomRole() != CustomRoles.Hider))
{
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Seeker);
CustomWinnerHolder.WinnerRoles.Add(CustomRoles.Seeker);
CustomWinnerHolder.WinnerIds.UnionWith(Main.PlayerStates.Where(x => x.Value.MainRole == CustomRoles.Seeker).Select(x => x.Key));
AddFoxesToWinners();
return true;
@@ -184,7 +179,6 @@ namespace TOHE
});
if (foxes.Count == 0) return;
CustomWinnerHolder.AdditionalWinnerTeams.Add(AdditionalWinners.Fox);
CustomWinnerHolder.WinnerRoles.Add(CustomRoles.Fox);
CustomWinnerHolder.WinnerIds.UnionWith(foxes);
}
@@ -208,7 +202,7 @@ namespace TOHE
public static void OnCheckMurder(PlayerControl killer, PlayerControl target)
{
if (killer == null || target == null) return;
if (killer == null || target == null || !killer.Is(CustomRoles.Seeker)) return;
killer.Kill(target);
+1
View File
@@ -49,6 +49,7 @@ namespace TOHE.GameMode.HideAndSeekRoles
{
CustomHideAndSeekManager.TimeLeft -= 5;
pc.Notify(Translator.GetString("TimeDecreased"));
if (60 - (CustomHideAndSeekManager.TimeLeft % 60) <= 5 /* Same as the time 2 lines above */) Utils.NotifyRoles();
}
}
}
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TOHE.GameMode.HideAndSeekRoles
namespace TOHE.GameMode.HideAndSeekRoles
{
internal interface IHideAndSeekRole
{
+1 -1
View File
@@ -578,7 +578,7 @@ public static class Utils
case CustomRoles.Doppelganger:
case CustomRoles.PlagueDoctor:
case CustomRoles.Postman:
case CustomRoles.Impartial:
case CustomRoles.Impartial:
case CustomRoles.Predator:
case CustomRoles.Reckless:
case CustomRoles.WeaponMaster:
+2 -1
View File
@@ -425,8 +425,9 @@ class GameEndChecker
var aliveCounts = roleCounts.Values.Where(x => x > 0).ToList();
switch (aliveCounts.Count)
{
// There are multiple types of NKs alive, game must continue
case > 1:
return false; // There are multiple types of NKs alive, game must continue
return false;
// There is only one type of NK alive, they've won
case 1:
{
+2 -1
View File
@@ -5,8 +5,9 @@ namespace TOHE.Patches;
[HarmonyPatch(typeof(TextBoxTMP), nameof(TextBoxTMP.IsCharAllowed))]
class TextBoxTMPCharAllowedPatch
{
public static bool Prefix([HarmonyArgument(0)] char i, ref bool __result)
public static bool Prefix(TextBoxTMP __instance, [HarmonyArgument(0)] char i, ref bool __result)
{
if (__instance.IpMode ? i is >= '0' and <= '9' or '.' : i == ' ' || i is >= 'A' and <= 'Z' || i is >= 'a' and <= 'z' || i is >= '0' and <= '9' || i is >= 'À' and <= 'ÿ' || i is >= 'Ѐ' and <= 'џ' || i is >= '\u3040' and <= '㆟' || i is >= 'ⱡ' and <= '힣' || __instance.AllowSymbols && TextBoxTMP.SymbolChars.Contains(i) || __instance.AllowEmail && TextBoxTMP.EmailChars.Contains(i)) return true;
if (i is not ('+' or '<' or '>' or '"' or '*' or '#' or '@' or '$' or '%' or '^' or '&' or '(' or ')' or '-' or '=' or '_' or '{' or '}' or '[' or ']' or ':' or ';' or ',' or '.' or '?' or '/' or '|' or '\\' or '`' or '~' or 'Н' or 'Г' or 'З' or 'В' or 'А' or 'П' or 'О' or 'Л' or 'Д' or 'Ж' or 'М' or 'И' or 'Б' or 'å' or 'ø' or 'æ' or 'ñ' or 'ä' or 'ö' or 'ü' or 'ß')) return true;
__result = true;
+2
View File
@@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=TMP/@EntryIndexedValue">TMP</s:String></wpf:ResourceDictionary>