From 96ab60f478fe0aad2e2451beffee64cc2bd41f34 Mon Sep 17 00:00:00 2001 From: Night_Eagle56 Date: Fri, 10 Dec 2021 21:19:27 +0330 Subject: [PATCH] New Role, ScapeGoat --- Werewolf for Telegram/Shared/GameBalancing.cs | 3 ++- Werewolf for Telegram/Shared/Roles.cs | 3 +++ .../Werewolf Control/Commands/HelpCommands.cs | 1 + Werewolf for Telegram/Werewolf Node/Werewolf.cs | 13 +++++++++++++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Werewolf for Telegram/Shared/GameBalancing.cs b/Werewolf for Telegram/Shared/GameBalancing.cs index ad95e3e4b..c8b8f246d 100644 --- a/Werewolf for Telegram/Shared/GameBalancing.cs +++ b/Werewolf for Telegram/Shared/GameBalancing.cs @@ -186,7 +186,6 @@ public static List GetRoleList(int playerCount, List disabledRoles //for smaller games, all roles will be available and chosen randomly. For large games, it will be about the //same as it was before.... - if (rolesToAssign.Any(x => x == IRole.CultistHunter)) { rolesToAssign.Add(IRole.Cultist); @@ -294,6 +293,8 @@ public static int GetStrength(this IRole role, List allRoles) return 8; case IRole.Spumpkin: return 2; + case IRole.ScapeGoat: + return 1; default: throw new ArgumentOutOfRangeException(nameof(role), role, null); } diff --git a/Werewolf for Telegram/Shared/Roles.cs b/Werewolf for Telegram/Shared/Roles.cs index 4d31fb3f0..162549a52 100644 --- a/Werewolf for Telegram/Shared/Roles.cs +++ b/Werewolf for Telegram/Shared/Roles.cs @@ -141,6 +141,9 @@ public enum IRole : long // NOTE: IN ROLE CONFIGURATION, FALSE WILL MEAN ENABLED [Role("🎃", false)] Spumpkin = 8796093022208, + + [Role("😰")] + ScapeGoat = 17592186044416, } public class RoleAttribute : Attribute diff --git a/Werewolf for Telegram/Werewolf Control/Commands/HelpCommands.cs b/Werewolf for Telegram/Werewolf Control/Commands/HelpCommands.cs index 40145638e..b0f0efb5b 100644 --- a/Werewolf for Telegram/Werewolf Control/Commands/HelpCommands.cs +++ b/Werewolf for Telegram/Werewolf Control/Commands/HelpCommands.cs @@ -152,6 +152,7 @@ public static void RoleList(Update update, string[] args) reply = "/aboutGraveDigger - " + GetLocaleString("GraveDigger", lang) + "\n"; reply += "/aboutArsonist - " + GetLocaleString("Arsonist", lang) + "\n"; reply += "/aboutAugur - " + GetLocaleString("Augur", lang) + "\n"; + reply += "/aboutScapeGoat - " + GetLocaleString("ScapeGoat", lang) + "\n"; Send(reply, update.Message.From.Id); } } diff --git a/Werewolf for Telegram/Werewolf Node/Werewolf.cs b/Werewolf for Telegram/Werewolf Node/Werewolf.cs index 39f73e376..862d101fc 100644 --- a/Werewolf for Telegram/Werewolf Node/Werewolf.cs +++ b/Werewolf for Telegram/Werewolf Node/Werewolf.cs @@ -1574,6 +1574,7 @@ private static void SetTeam(IPlayer p) case IRole.Spumpkin: case IRole.Augur: case IRole.GraveDigger: + case IRole.ScapeGoat: p.Team = ITeam.Village; break; case IRole.Doppelgänger: @@ -2784,10 +2785,22 @@ private void LynchCycle() var t = choices.FirstOrDefault(x => x.PlayerRole == IRole.Tanner); if (t != null && t.Votes > 0) AddAchievement(t, AchievementsReworked.SoClose); + var scapeGoat = Players.FirstOrDefault(x => x.PlayerRole == IRole.ScapeGoat && !x.IsDead); + if (scapeGoat != null) //lets kill ScapeGoat + { + SendWithQueue(GetLocaleString("ScapeGoatLynched", scapeGoat.GetName())); + KillPlayer(scapeGoat, KillMthd.Lynch, killers: Players.Where(x => x.Choice > 0), isNight: false); + } } else // if (lynched.Votes == -2) // No lynch votes at all { SendWithQueue(GetLocaleString("NoLynchVotes")); + var scapeGoat = Players.FirstOrDefault(x => x.PlayerRole == IRole.ScapeGoat && !x.IsDead); + if (scapeGoat != null) //lets kill ScapeGoat + { + SendWithQueue(GetLocaleString("ScapeGoatLynched", scapeGoat.GetName())); + KillPlayer(scapeGoat, KillMthd.Lynch, killers: null, isNight: false); //nobody voted, so no killers! + } } if (CheckForGameEnd(true)) return;