Skip to content

Commit

Permalink
Merge pull request #822 from tukasa0001/develop
Browse files Browse the repository at this point in the history
mainへマージ
  • Loading branch information
soukunsandesu authored Jul 2, 2022
2 parents 270a30b + 89ddccd commit f327692
Show file tree
Hide file tree
Showing 30 changed files with 296 additions and 329 deletions.
1 change: 1 addition & 0 deletions Modules/CustomRolesHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ CustomRoles.EgoSchrodingerCat or
CustomRoles.HASTroll or
CustomRoles.HASFox;
}
public static bool IsCrewmate(this CustomRoles role) => !role.IsImpostorTeam() && !role.IsNeutral();
public static bool IsVanilla(this CustomRoles role)
{
return
Expand Down
17 changes: 15 additions & 2 deletions Modules/ExtendedPlayerControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ public static CustomRoles GetCustomRole(this PlayerControl player)
var cRole = CustomRoles.Crewmate;
if (player == null)
{
Logger.Warn("CustomRoleを取得しようとしましたが、対象がnullでした。", "getCustomRole");
var caller = new System.Diagnostics.StackFrame(1, false);
var callerMethod = caller.GetMethod();
string callerMethodName = callerMethod.Name;
string callerClassName = callerMethod.DeclaringType.FullName;
Logger.Warn(callerClassName + "." + callerMethodName + "がCustomRoleを取得しようとしましたが、対象がnullでした。", "GetCustomRole");
return cRole;
}
var cRoleFound = Main.AllPlayerCustomRoles.TryGetValue(player.PlayerId, out cRole);
Expand Down Expand Up @@ -403,8 +407,11 @@ public static void CustomSyncSettings(this PlayerControl player)
opt.AnonymousVotes = false;
if (Options.SyncButtonMode.GetBool() && Options.SyncedButtonCount.GetSelection() <= Options.UsedButtonCount)
opt.EmergencyCooldown = 3600;
if (Options.CurrentGameMode == CustomGameMode.HideAndSeek && Options.HideAndSeekKillDelayTimer > 0)
if ((Options.CurrentGameMode == CustomGameMode.HideAndSeek || Options.IsStandardHAS) && Options.HideAndSeekKillDelayTimer > 0)
{
opt.ImpostorLightMod = 0f;
if (player.GetCustomRole().IsImpostor() || player.Is(CustomRoles.Egoist)) opt.PlayerSpeedMod = 0.0001f;
}
opt.DiscussionTime = Mathf.Clamp(Main.DiscussionTime, 0, 300);
opt.VotingTime = Mathf.Clamp(Main.VotingTime, Options.TimeThiefLowerLimitVotingTime.GetInt(), 300);

Expand Down Expand Up @@ -449,6 +456,10 @@ public static string GetRoleColorCode(this PlayerControl player)
{
return Utils.GetRoleColorCode(player.GetCustomRole());
}
public static Color GetRoleColor(this PlayerControl player)
{
return Utils.GetRoleColor(player.GetCustomRole());
}
public static void ResetPlayerCam(this PlayerControl pc, float delay = 0f)
{
if (pc == null || !AmongUsClient.Instance.AmHost || pc.AmOwner) return;
Expand Down Expand Up @@ -688,6 +699,8 @@ public static bool CanMakeMadmate(this PlayerControl player)
}
public static void ResetThiefVotingTime(this PlayerControl thief)
{
if (!Options.TimeThiefReturnStolenTimeUponDeath.GetBool()) return;

for (var i = 0; i < Main.TimeThiefKillCount[thief.PlayerId]; i++)
Main.VotingTime += Options.TimeThiefDecreaseMeetingTime.GetInt();
Main.TimeThiefKillCount[thief.PlayerId] = 0; //初期化
Expand Down
1 change: 1 addition & 0 deletions Modules/GameState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public enum DeathReason
Sniped,
Execution,
Disconnected,
Fell,
etc = -1
}
}
Expand Down
23 changes: 18 additions & 5 deletions Modules/OptionHolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public static CustomGameMode CurrentGameMode
public static CustomOption SerialKillerLimit;
public static CustomOption TimeThiefDecreaseMeetingTime;
public static CustomOption TimeThiefLowerLimitVotingTime;
public static CustomOption TimeThiefReturnStolenTimeUponDeath;
public static CustomOption VampireKillDelay;
public static CustomOption BlackOutMareSpeed;
public static CustomOption ShapeMasterShapeshiftDuration;
Expand Down Expand Up @@ -122,7 +123,6 @@ public static CustomGameMode CurrentGameMode
public static CustomOption IgnoreCosmetics;
public static CustomOption IgnoreVent;
public static float HideAndSeekKillDelayTimer = 0f;
public static float HideAndSeekImpVisionMin = 0.25f;

// ボタン回数
public static CustomOption SyncButtonMode;
Expand Down Expand Up @@ -157,8 +157,14 @@ public static CustomGameMode CurrentGameMode
public static VoteMode GetWhenSkipVote() => (VoteMode)WhenSkipVote.GetSelection();
public static VoteMode GetWhenNonVote() => (VoteMode)WhenNonVote.GetSelection();

//転落死
public static CustomOption LadderDeath;
public static CustomOption LadderDeathChance;

// 通常モードでかくれんぼ
public static bool IsStandardHAS => StandardHAS.GetBool() && CurrentGameMode == CustomGameMode.Standard;
public static CustomOption StandardHAS;
public static CustomOption StandardHASWaitingTime;

// リアクターの時間制御
public static CustomOption SabotageTimeControl;
Expand Down Expand Up @@ -277,6 +283,7 @@ public static void Load()
SetupRoleOptions(2400, CustomRoles.TimeThief);
TimeThiefDecreaseMeetingTime = CustomOption.Create(2410, Color.white, "TimeThiefDecreaseMeetingTime", 20, 0, 100, 1, CustomRoleSpawnChances[CustomRoles.TimeThief]);
TimeThiefLowerLimitVotingTime = CustomOption.Create(2411, Color.white, "TimeThiefLowerLimitVotingTime", 10, 1, 300, 1, CustomRoleSpawnChances[CustomRoles.TimeThief]);
TimeThiefReturnStolenTimeUponDeath = CustomOption.Create(2412, Color.white, "TimeThiefReturnStolenTimeUponDeath", true, CustomRoleSpawnChances[CustomRoles.TimeThief]);

DefaultShapeshiftCooldown = CustomOption.Create(5011, Color.white, "DefaultShapeshiftCooldown", 15, 5, 999, 5, null, true);
CanMakeMadmateCount = CustomOption.Create(5012, Color.white, "CanMakeMadmateCount", 0, 0, 15, 1, null, true);
Expand All @@ -285,12 +292,12 @@ public static void Load()
SetupRoleOptions(10000, CustomRoles.Madmate);
SetupRoleOptions(10100, CustomRoles.MadGuardian);
MadGuardianCanSeeWhoTriedToKill = CustomOption.Create(10110, Color.white, "MadGuardianCanSeeWhoTriedToKill", false, CustomRoleSpawnChances[CustomRoles.MadGuardian]);
MadGuardianTasks = OverrideTasksData.Create(10120, CustomRoles.MadGuardian);
//ID10120~10123を使用
MadGuardianTasks = OverrideTasksData.Create(10120, CustomRoles.MadGuardian);
SetupRoleOptions(10200, CustomRoles.MadSnitch);
MadSnitchCanVent = CustomOption.Create(10210, Color.white, "MadSnitchCanVent", false, CustomRoleSpawnChances[CustomRoles.MadSnitch]);
MadSnitchTasks = OverrideTasksData.Create(10220, CustomRoles.MadSnitch);
//ID10220~10223を使用
MadSnitchTasks = OverrideTasksData.Create(10220, CustomRoles.MadSnitch);
// Madmate Common Options
MadmateCanFixLightsOut = CustomOption.Create(15010, Color.white, "MadmateCanFixLightsOut", false, null, true, false);
MadmateCanFixComms = CustomOption.Create(15011, Color.white, "MadmateCanFixComms", false);
Expand Down Expand Up @@ -332,8 +339,8 @@ public static void Load()
SnitchEnableTargetArrow = CustomOption.Create(20510, Color.white, "SnitchEnableTargetArrow", false, CustomRoleSpawnChances[CustomRoles.Snitch]);
SnitchCanGetArrowColor = CustomOption.Create(20511, Color.white, "SnitchCanGetArrowColor", false, CustomRoleSpawnChances[CustomRoles.Snitch]);
SnitchCanFindNeutralKiller = CustomOption.Create(20512, Color.white, "SnitchCanFindNeutralKiller", false, CustomRoleSpawnChances[CustomRoles.Snitch]);
SnitchTasks = OverrideTasksData.Create(20520, CustomRoles.Snitch);
//20520~20523を使用
SnitchTasks = OverrideTasksData.Create(20520, CustomRoles.Snitch);
SetupRoleOptions(20600, CustomRoles.SpeedBooster);
SpeedBoosterUpSpeed = CustomOption.Create(20610, Color.white, "SpeedBoosterUpSpeed", 2f, 0.25f, 3f, 0.25f, CustomRoleSpawnChances[CustomRoles.SpeedBooster]);
SetupRoleOptions(20700, CustomRoles.Doctor);
Expand All @@ -350,8 +357,8 @@ public static void Load()
SetupRoleOptions(50200, CustomRoles.Terrorist);
CanTerroristSuicideWin = CustomOption.Create(50210, Color.white, "CanTerroristSuicideWin", false, CustomRoleSpawnChances[CustomRoles.Terrorist], false)
.SetGameMode(CustomGameMode.Standard);
SnitchTasks = OverrideTasksData.Create(50220, CustomRoles.Terrorist);
//50220~50223を使用
TerroristTasks = OverrideTasksData.Create(50220, CustomRoles.Terrorist);
SetupLoversRoleOptionsToggle(50300);

SetupRoleOptions(50400, CustomRoles.SchrodingerCat);
Expand Down Expand Up @@ -433,9 +440,15 @@ public static void Load()
WhenNonVote = CustomOption.Create(100502, Color.white, "WhenNonVote", voteModes, voteModes[0], VoteMode)
.SetGameMode(CustomGameMode.Standard);

// 転落死
LadderDeath = CustomOption.Create(101100, Color.white, "LadderDeath", false, null, true);
LadderDeathChance = CustomOption.Create(101110, Color.white, "LadderDeathChance", rates[1..], rates[2], LadderDeath);

// 通常モードでかくれんぼ用
StandardHAS = CustomOption.Create(100700, Color.white, "StandardHAS", false, null, true)
.SetGameMode(CustomGameMode.Standard);
StandardHASWaitingTime = CustomOption.Create(100701, Color.white, "StandardHASWaitingTime", 10f, 0f, 180f, 2.5f, StandardHAS)
.SetGameMode(CustomGameMode.Standard);

// その他
NoGameEnd = CustomOption.Create(100600, Color.white, "NoGameEnd", false, null, true)
Expand Down
11 changes: 6 additions & 5 deletions Modules/OptionShower.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ public static string GetText()
if (Options.CurrentGameMode == CustomGameMode.Standard)
{
//役職一覧
text += $"<color={Utils.GetRoleColorCode(CustomRoles.Impostor)}>{GetString("LastImpostor")}:</color> {Options.EnableLastImpostor.GetString()}\n\n";
text += $"{Helpers.ColorString(Utils.GetRoleColor(CustomRoles.Impostor), GetString("LastImpostor"))}: {Options.EnableLastImpostor.GetString()}\n\n";
foreach (var kvp in Options.CustomRoleSpawnChances)
if (kvp.Value.GameMode is CustomGameMode.Standard or CustomGameMode.All) //スタンダードか全てのゲームモードで表示する役職
text += $"<color={Utils.GetRoleColorCode(kvp.Key)}>{Utils.GetRoleName(kvp.Key)}:</color> {kvp.Value.GetString()}×{kvp.Key.GetCount()}\n";
text += $"{Helpers.ColorString(Utils.GetRoleColor(kvp.Key), Utils.GetRoleName(kvp.Key))}: {kvp.Value.GetString()}×{kvp.Key.GetCount()}\n";
pages.Add(text + "\n\n");
text = "";
}
Expand All @@ -38,15 +38,15 @@ public static string GetText()
{
if (Options.EnableLastImpostor.GetBool())
{
text += $"<color={Utils.GetRoleColorCode(CustomRoles.Impostor)}>{GetString("LastImpostor")}:</color> {Options.EnableLastImpostor.GetString()}\n";
text += $"{Helpers.ColorString(Utils.GetRoleColor(CustomRoles.Impostor), GetString("LastImpostor"))}: {Options.EnableLastImpostor.GetString()}\n";
text += $"\t{GetString("LastImpostorKillCooldown")}: {Options.LastImpostorKillCooldown.GetString()}\n\n";
}
}
foreach (var kvp in Options.CustomRoleSpawnChances)
{
if (!kvp.Key.IsEnable()) continue;
if (!(kvp.Value.GameMode == Options.CurrentGameMode || kvp.Value.GameMode == CustomGameMode.All)) continue; //現在のゲームモードでも全てのゲームモードでも表示しない役職なら飛ばす
text += $"<color={Utils.GetRoleColorCode(kvp.Key)}>{Utils.GetRoleName(kvp.Key)}:</color> {kvp.Value.GetString()}×{kvp.Key.GetCount()}\n";
text += $"{Helpers.ColorString(Utils.GetRoleColor(kvp.Key), Utils.GetRoleName(kvp.Key))}: {kvp.Value.GetString()}×{kvp.Key.GetCount()}\n";
foreach (var c in kvp.Value.Children) //詳細設定をループする
{
if (c.Name == "Maximum") continue; //Maximumの項目は飛ばす
Expand All @@ -60,7 +60,7 @@ public static string GetText()
text += $"\t{Options.MadmateVentCooldown.GetName()}: {Options.MadmateVentCooldown.GetString()}\n";
text += $"\t{Options.MadmateVentMaxTime.GetName()}: {Options.MadmateVentMaxTime.GetString()}\n";
}
if (kvp.Key is CustomRoles.Shapeshifter or CustomRoles.ShapeMaster or CustomRoles.Mafia or CustomRoles.BountyHunter or CustomRoles.SerialKiller) //シェイプシフター役職の時に追加する詳細設定
if (kvp.Key is CustomRoles.Shapeshifter or CustomRoles.ShapeMaster or CustomRoles.BountyHunter or CustomRoles.SerialKiller) //シェイプシフター役職の時に追加する詳細設定
{
text += $"\t{Options.CanMakeMadmateCount.GetName()}: {Options.CanMakeMadmateCount.GetString()}\n";
}
Expand Down Expand Up @@ -97,6 +97,7 @@ void listUp(CustomOption o)
nameAndValue(Options.IgnoreVent);
}
text += "\n";
listUp(Options.LadderDeath);
listUp(Options.DisableTasks);
listUp(Options.RandomMapsMode);
nameAndValue(Options.NoGameEnd);
Expand Down
Loading

0 comments on commit f327692

Please sign in to comment.