]> git.deb.at Git - rhonda/impostor.git/commitdiff
fixed AprilFools2024 Deserialize error
authorykundesu <4476tv@gmail.com>
Mon, 1 Apr 2024 08:33:38 +0000 (17:33 +0900)
committerykundesu <4476tv@gmail.com>
Mon, 1 Apr 2024 08:33:38 +0000 (17:33 +0900)
src/Impostor.Api/Innersloth/GameModes.cs
src/Impostor.Api/Innersloth/GameOptions/GameOptionsFactory.cs
src/Impostor.Server/Net/Inner/Objects/InnerMeetingHud.cs
src/Impostor.Server/Net/Inner/Objects/InnerPlayerInfo.cs

index 0c55518e97a8e382a1e6acb18024dc23660243ee..e133e00a827dcd8d9ac007dbb0046b8450f7e9d4 100644 (file)
@@ -5,5 +5,7 @@ namespace Impostor.Api.Innersloth
         None,
         Normal,
         HideNSeek,
+        NormalFools,
+        SeekFools
     }
 }
index a7625aad472f3f022201f6acfd2c634a8f4074cc..be306ec72bfe93862d53b6fabf37731e66c75ce8 100644 (file)
@@ -39,8 +39,8 @@ public static class GameOptionsFactory
 
         return gameMode switch
         {
-            GameModes.Normal => NormalGameOptions.Deserialize(optionsReader, version),
-            GameModes.HideNSeek => HideNSeekGameOptions.Deserialize(optionsReader, version),
+            GameModes.Normal or GameModes.NormalFools => NormalGameOptions.Deserialize(optionsReader, version),
+            GameModes.HideNSeek or GameModes.SeekFools => HideNSeekGameOptions.Deserialize(optionsReader, version),
             _ => throw new ArgumentOutOfRangeException(),
         };
     }
@@ -62,9 +62,11 @@ public static class GameOptionsFactory
         switch (gameMode)
         {
             case GameModes.Normal:
+            case GameModes.NormalFools:
                 ((NormalGameOptions)gameOptions).Deserialize(optionsReader);
                 break;
             case GameModes.HideNSeek:
+            case GameModes.SeekFools:
                 ((HideNSeekGameOptions)gameOptions).Deserialize(optionsReader);
                 break;
             default:
index 207f131e5f8daea7bcf8c5ad2d68a71458c26d6f..4ca647aeacccc08fac99a0ea92c63ae1163220cd 100644 (file)
@@ -1,4 +1,4 @@
-using System;
+using System;
 using System.Collections.Generic;
 using System.Diagnostics.CodeAnalysis;
 using System.Linq;
@@ -44,7 +44,7 @@ namespace Impostor.Server.Net.Inner.Objects
                 try
                 {
                     const float AnimationTime = 0.25f + 0.5f + 0.4f + 3f + 0.75f + 5f;
-                    if (Game.Options.GameMode == GameModes.Normal)
+                    if (Game.Options.GameMode is GameModes.Normal or GameModes.NormalFools)
                     {
                         var options = (NormalGameOptions)Game.Options;
                         await Task.Delay(TimeSpan.FromSeconds(AnimationTime + options.DiscussionTime + options.VotingTime), _timerToken.Token);
index 8a484d87ea0b952125c407efb8b1c31f10789d8e..320cb5b06d43a34c3dcfdf9e05bf96e6dfffe38c 100644 (file)
@@ -1,4 +1,4 @@
-using System;
+using System;
 using System.Collections.Generic;
 using Impostor.Api.Games;
 using Impostor.Api.Innersloth;
@@ -60,7 +60,7 @@ namespace Impostor.Server.Net.Inner.Objects
             // the impostor has a cooldown of half the usual duration. As a workaround we always assume the kill was
             // prevented and the impostor only has half of its cooldown.
             // FIXME when the base game improved their implementation.
-            if (game.Options.GameMode == GameModes.Normal)
+            if (game.Options.GameMode is GameModes.Normal or GameModes.NormalFools)
             {
                 var options = (NormalGameOptions)game.Options;
                 return dateTimeProvider.UtcNow.Subtract(LastMurder).TotalSeconds >= options.KillCooldown / 2;