Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions GameModes/ShapeshiftWars.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using AmongUs.GameOptions;
using Hazel;
using InnerNet;
using System.Text;
using TOHE.Roles.Core;
using UnityEngine;
using static TOHE.Translator;
using static TOHE.Utils;

namespace TOHE;
public static class ShapeshiftWars
{
public static OptionItem SW_NeedToDoTasksToKill;
public static OptionItem SW_CommonTasks;
public static OptionItem SW_ShortTasks;
public static OptionItem SW_LongTasks;
public static OptionItem SW_GenerateSameTasks;

public static OptionItem SW_NormalSpeed;
public static OptionItem SW_ShapeShiftSpeed;
public static OptionItem SW_BoostWhenBeTarget;
public static OptionItem SW_BoostWhenKill;

public static OptionItem SW_FirstSSCoolDown;
public static OptionItem SW_ShapeshiftCooldown;
public static OptionItem SW_ShapeshiftDuration;
public static OptionItem SW_ShapeshiftAnimation;

public static OptionItem SW_NormalKcd;
public static OptionItem SW_MisClickResetKcd;
public static OptionItem SW_MisClickKcd;
public static OptionItem SW_AllowMiskill;
public static OptionItem SW_MissKillNextSSCoolDown;

public static OptionItem SW_SsSeeTargetArrow;
public static OptionItem SW_SsTargetSeeSArror;
}

public class Shifter : RoleBase
{
public override CustomRoles Role => CustomRoles.Shifter;

public override CustomRoles ThisRoleBase => CustomRoles.Engineer;

public override Custom_RoleType ThisRoleType => Custom_RoleType.None;
}
2 changes: 1 addition & 1 deletion Modules/CustomRolesHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static bool HasImpKillButton(this PlayerControl player, bool considerVani

if (player == null) return false;

if (Options.CurrentGameMode is CustomGameMode.SpeedRun) return true;
if (Options.CurrentGameMode is CustomGameMode.SpeedRun or CustomGameMode.ShapeshiftWars) return true;

var customRole = player.GetCustomRole();
return customRole.GetDYRole() is RoleTypes.Impostor or RoleTypes.Shapeshifter || customRole.GetVNRole() is CustomRoles.Impostor or CustomRoles.Shapeshifter or CustomRoles.Phantom;
Expand Down
5 changes: 4 additions & 1 deletion Modules/OptionHolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public enum CustomGameMode
FFA = 0x02,

SpeedRun = 0x04,
ShapeshiftWars = 0x05,

HidenSeekTOHE = 0x08, // HidenSeekTOHE must be after other game modes
All = int.MaxValue
Expand Down Expand Up @@ -53,7 +54,8 @@ public static CustomGameMode CurrentGameMode
1 => CustomGameMode.FFA,

2 => CustomGameMode.SpeedRun,
3 => CustomGameMode.HidenSeekTOHE, // HidenSeekTOHE must be after other game modes
3 => CustomGameMode.ShapeshiftWars,
4 => CustomGameMode.HidenSeekTOHE, // HidenSeekTOHE must be after other game modes
_ => CustomGameMode.Standard
};
public static readonly string[] gameModes =
Expand All @@ -62,6 +64,7 @@ public static CustomGameMode CurrentGameMode
"FFA",

"SpeedRun",
"ShapeshiftWars",

"Hide&SeekTOHE", // HidenSeekTOHE must be after other game modes
];
Expand Down
10 changes: 9 additions & 1 deletion Modules/OptionItem/OptionItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public abstract class OptionItem
public CustomGameMode HideOptionInFFA { get; protected set; }
public CustomGameMode HideOptionInHnS { get; protected set; }
public CustomGameMode HideOptionInSpeedRun { get; protected set; }
public CustomGameMode HideOptionInShapeshiftWars { get; protected set; }
public bool IsHeader { get; protected set; }
public bool IsHidden { get; protected set; }
public bool IsText { get; protected set; }
Expand Down Expand Up @@ -79,6 +80,7 @@ public OptionItem(int id, string name, int defaultValue, TabGroup tab, bool isSi
HideOptionInFFA = CustomGameMode.All;
HideOptionInHnS = CustomGameMode.All;
HideOptionInSpeedRun = CustomGameMode.All;
HideOptionInShapeshiftWars = CustomGameMode.All;
IsHeader = false;
IsHidden = false;
IsText = false;
Expand Down Expand Up @@ -134,6 +136,7 @@ public OptionItem Do(Action<OptionItem> action)
public OptionItem HideInFFA(CustomGameMode value = CustomGameMode.FFA) => Do(i => i.HideOptionInFFA = value);
public OptionItem HideInHnS(CustomGameMode value = CustomGameMode.HidenSeekTOHE) => Do(i => i.HideOptionInHnS = value);
public OptionItem HideInSpeedRun(CustomGameMode value = CustomGameMode.SpeedRun) => Do(i => i.HideOptionInSpeedRun = value);
public OptionItem HideInShapeshiftWars(CustomGameMode value = CustomGameMode.ShapeshiftWars) => Do(i => i.HideOptionInShapeshiftWars = value);

public OptionItem SetParent(OptionItem parent, bool OverrideRoleName = true) => Do(i =>
{
Expand Down Expand Up @@ -188,7 +191,12 @@ public virtual string GetString()
// Deprecated IsHidden function
public virtual bool IsHiddenOn(CustomGameMode mode)
{
return IsHidden || this.Parent?.IsHiddenOn(Options.CurrentGameMode) == true || (HideOptionInFFA != CustomGameMode.All && HideOptionInFFA == mode) || (HideOptionInHnS != CustomGameMode.All && HideOptionInHnS == mode) || (HideOptionInSpeedRun != CustomGameMode.All && HideOptionInSpeedRun == mode) || (GameMode != CustomGameMode.All && GameMode != mode);
return IsHidden || this.Parent?.IsHiddenOn(Options.CurrentGameMode) == true
|| (HideOptionInFFA != CustomGameMode.All && HideOptionInFFA == mode)
|| (HideOptionInHnS != CustomGameMode.All && HideOptionInHnS == mode)
|| (HideOptionInSpeedRun != CustomGameMode.All && HideOptionInSpeedRun == mode)
|| (HideOptionInShapeshiftWars != CustomGameMode.All && HideOptionInShapeshiftWars == mode)
|| (GameMode != CustomGameMode.All && GameMode != mode);
}
public string ApplyFormat(string value)
{
Expand Down
1 change: 1 addition & 0 deletions Patches/GameSettingMenuPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public static void StartPostfix(GameSettingMenu __instance)
CustomGameMode.HidenSeekTOHE => Enum.GetValues<TabGroup>().Skip(3).ToArray(),
CustomGameMode.FFA => Enum.GetValues<TabGroup>().Skip(2).ToArray(),
CustomGameMode.SpeedRun => Enum.GetValues<TabGroup>().Skip(2).ToArray(),
CustomGameMode.ShapeshiftWars => Enum.GetValues<TabGroup>().Skip(2).ToArray(),
_ => []
};

Expand Down
3 changes: 3 additions & 0 deletions main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,9 @@ public enum CustomRoles
// Speed run
Runner,

// Shapeshift War
Shifter,

// Sub-role after 500
NotAssigned = 500,

Expand Down