mirror of
https://github.com/Impostor/Impostor.git
synced 2026-10-20 01:46:11 +00:00
Merge pull request #573 from ykundesu/fix/AprilFools2024
fixed AprilFools2024 Deserialize error
This commit is contained in:
4 files changed
+10
-6
No files matched your search
@@ -5,5 +5,7 @@ namespace Impostor.Api.Innersloth
|
||||
None,
|
||||
Normal,
|
||||
HideNSeek,
|
||||
NormalFools,
|
||||
SeekFools,
|
||||
}
|
||||
}
|
||||
@@ -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:
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user