Skip to content

Commit

Permalink
a bunch of quizmaster things
Browse files Browse the repository at this point in the history
hopefully fixed the bug where the rolebasis and rolefaction questions were actually swapped
fix strings showing incorrectly
fix faction related questions actually using rolebasis not customteams
added three new questions for the hell of it
realistically this should have been done in a seperate PR however i only intended to fix it for coven and i just kept seeing issues that i had to fix
  • Loading branch information
MargaretTheFool committed Dec 26, 2024
1 parent 54a5b08 commit 6276161
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 15 deletions.
16 changes: 14 additions & 2 deletions Resources/Lang/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -3992,7 +3992,8 @@
"QuizmasterChat.AnswerNotValid": "Your answer must be A, B, or C",
"QuizmasterChat.SyntaxNotValid": "<b>Usage:</b>\n/answer [A/B/C]",

"QuizmasterSettings.QuestionDifficulty": "Question Difficulty",
"QuizmasterSettings.MinQuestionDifficulty": "Min Question Difficulty",
"QuizmasterSettings.MaxQuestionDifficulty": "Max Question Difficulty",
"QuizmasterSettings.CanVentAfterMark": "Can Vent After Marked Somebody For Quiz",
"QuizmasterSettings.CanKillAfterMark": "Can Kill After Marked Somebody For Quiz",
"QuizmasterSettings.NumOfKillAfterMark": "How Many Kills Per Round",
Expand Down Expand Up @@ -4025,6 +4026,14 @@
"QuizmasterAnswers.Experimental": "Experimental",
"QuizmasterAnswers.Enhanced": "Enhanced",
"QuizmasterAnswers.Edited": "Edited",
"QuizmasterAnswers.Impostor": "Impostor",
"QuizmasterAnswers.Neutral": "Neutral",
"QuizmasterAnswers.Crewmate": "Crewmate",
"QuizmasterAnswers.Addon": "Addon",
"QuizmasterAnswers.Shapeshifter": "Shapeshifter",
"QuizmasterAnswers.Scientist": "Scientist",
"QuizmasterAnswers.Engineer": "Engineer",
"QuizmasterAnswers.GuardianAngel": "GuardianAngel",

"QuizmasterQuestions.LastSabotage": "What was the sabotage was called last?",
"QuizmasterQuestions.FirstRoundSabotage": "What was the first sabotage called this round?",
Expand All @@ -4041,8 +4050,11 @@
"QuizmasterQuestions.WhatDoesEOgMeansInName": "What did the E in TOHE originally stand for?",
"QuizmasterQuestions.PlrDieReason": "What was {PLR}'s cause of death?",
"QuizmasterQuestions.PlrDieMethod": "How did {PLR} die?",
"LastAddedRoleForKarped": "What was the last role added to TOHE before KARPED1EM stepped down?",
"QuizmasterQuestions.LastAddedRoleForKarped": "What was the last role added to TOHE before KARPED1EM stepped down?",
"QuizmasterQuestions.PlrDieFaction": "What kind of faction killed {PLR}?",
"QuizmasterQuestions.QuizmasterCooldown": "What will Quizmaster's cooldown always be? (excluding first kill override and changes from other roles/addons)",
"QuizmasterQuestions.WhoCoded": "Who coded Quizmaster?",
"QuizmasterQuestions.WhoOwns": "Who owns The Enhanced Network?",

"DeathReason.WrongAnswer": "Wrong Quiz Answer",

Expand Down
2 changes: 1 addition & 1 deletion Roles/Neutral/Arsonist.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal class Arsonist : RoleBase
private const int id = 15900;
public override bool IsDesyncRole => true;
public override CustomRoles ThisRoleBase => CustomRoles.Impostor;
public override Custom_RoleType ThisRoleType => CanIgniteAnytime() ? Custom_RoleType.NeutralKilling : Custom_RoleType.NeutralBenign;
public override Custom_RoleType ThisRoleType => CanIgniteAnytime() ? Custom_RoleType.NeutralKilling : Custom_RoleType.NeutralEvil;
//==================================================================\\

private static OptionItem ArsonistDouseTime;
Expand Down
35 changes: 23 additions & 12 deletions Roles/Neutral/Quizmaster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ internal class Quizmaster : RoleBase
public override Custom_RoleType ThisRoleType => CanKillsAfterMark() ? Custom_RoleType.NeutralKilling : Custom_RoleType.NeutralChaos;
//==================================================================\\

private static OptionItem QuestionDifficulty;
private static OptionItem MinQuestionDifficulty;
private static OptionItem MaxQuestionDifficulty;
public static OptionItem CanKillAfterMarkOpt;
private static OptionItem CanVentAfterMark;
private static OptionItem NumOfKillAfterMark;
Expand Down Expand Up @@ -54,7 +55,9 @@ public override void SetupCustomOption()
TabGroup tab = TabGroup.NeutralRoles;

SetupSingleRoleOptions(Id, tab, CustomRoles.Quizmaster, 1);
QuestionDifficulty = IntegerOptionItem.Create(Id + 10, "QuizmasterSettings.QuestionDifficulty", new(1, 4, 1), 1, tab, false)
MinQuestionDifficulty = IntegerOptionItem.Create(Id + 15, "QuizmasterSettings.MinQuestionDifficulty", new(1, 4, 1), 1, tab, false)
.SetParent(CustomRoleSpawnChances[CustomRoles.Quizmaster]);
MaxQuestionDifficulty = IntegerOptionItem.Create(Id + 10, "QuizmasterSettings.MaxQuestionDifficulty", new(1, 4, 1), 1, tab, false)
.SetParent(CustomRoleSpawnChances[CustomRoles.Quizmaster]);
CanVentAfterMark = BooleanOptionItem.Create(Id + 11, "QuizmasterSettings.CanVentAfterMark", true, tab, false)
.SetParent(CustomRoleSpawnChances[CustomRoles.Quizmaster]);
Expand Down Expand Up @@ -167,7 +170,7 @@ public override bool OnCheckMurderAsKiller(PlayerControl killer, PlayerControl t

private static QuizQuestionBase GetRandomQuestion(List<QuizQuestionBase> qt)
{
List<QuizQuestionBase> questions = qt.Where(a => a.Stage <= QuestionDifficulty.GetInt()).ToList();
List<QuizQuestionBase> questions = qt.Where(a => a.Stage <= MaxQuestionDifficulty.GetInt() && a.Stage >= MinQuestionDifficulty.GetInt()).ToList();
var rnd = IRandom.Instance;
QuizQuestionBase question = questions[rnd.Next(0, questions.Count)];
if (question == previousQuestion)
Expand Down Expand Up @@ -238,19 +241,23 @@ private void DoQuestion()
new PlrColorQuestion { Stage = 1, Question = "LastButtonPressedPlayerColor", QuizmasterQuestionType = QuizmasterQuestionType.LastMeetingColorQuestion },

new CountQuestion { Stage = 2, Question = "MeetingPassed", QuizmasterQuestionType = QuizmasterQuestionType.MeetingCountQuestion },
new SetAnswersQuestion { Stage = 2, Question = "HowManyFactions", Answer = "Three", PossibleAnswers = { "One", "Two", "Three", "Four", "Five" }, QuizmasterQuestionType = QuizmasterQuestionType.FactionQuestion },
new SetAnswersQuestion { Stage = 2, Question = GetString("QuizmasterQuestions.BasisOfRole").Replace("{QMROLE}", randomRoleWithAddon.ToString()), HasQuestionTranslation = false, Answer = CustomRolesHelper.GetCustomRoleTeam(randomRoleWithAddon).ToString(), PossibleAnswers = { "Crewmate", "Impostor", "Neutral", "Addon" }, QuizmasterQuestionType = QuizmasterQuestionType.RoleBasisQuestion },
new SetAnswersQuestion { Stage = 2, Question = GetString("QuizmasterQuestions.FactionOfRole").Replace("{QMROLE}", randomRole.ToString()), HasQuestionTranslation = false, Answer = CustomRolesHelper.GetRoleTypes(randomRole).ToString(), PossibleAnswers = { "Crewmate", "Impostor", "Neutral" }, QuizmasterQuestionType = QuizmasterQuestionType.RoleFactionQuestion },
new SetAnswersQuestion { Stage = 2, Question = "HowManyFactions", Answer = "Four", PossibleAnswers = { "One", "Two", "Three", "Four", "Five" }, QuizmasterQuestionType = QuizmasterQuestionType.FactionQuestion },
new SetAnswersQuestion { Stage = 2, Question = GetString("QuizmasterQuestions.FactionOfRole").Replace("{QMRole}", randomRoleWithAddon.ToString()), HasQuestionTranslation = false, Answer = CustomRolesHelper.GetCustomRoleTeam(randomRoleWithAddon).ToString(), PossibleAnswers = { "Crewmate", "Impostor", "Neutral", "Coven", "Addon" }, QuizmasterQuestionType = QuizmasterQuestionType.RoleFactionQuestion },
new SetAnswersQuestion { Stage = 2, Question = GetString("QuizmasterQuestions.BasisOfRole").Replace("{QMRole}", randomRole.ToString()), HasQuestionTranslation = false, Answer = CustomRolesHelper.GetRoleTypes(randomRole).ToString(), PossibleAnswers = { "Crewmate", "Impostor", "Shapeshifter", "Scientist", "Engineer", "GuardianAngel" }, QuizmasterQuestionType = QuizmasterQuestionType.RoleBasisQuestion },

new SetAnswersQuestion { Stage = 3, Question = "FactionRemovedName", Answer = "Coven", PossibleAnswers = { "Sabotuer", "Sorcerers", "Coven", "Killer" }, QuizmasterQuestionType = QuizmasterQuestionType.RemovedFactionQuestion },
new SetAnswersQuestion { Stage = 3, Question = "FactionRemovedName", Answer = "None", PossibleAnswers = { "Sabotuer", "Sorcerers", "Coven", "Killer", "None" }, QuizmasterQuestionType = QuizmasterQuestionType.RemovedFactionQuestion },
// ^ I added Coven back so this question no longer applies :) - Marg
new SetAnswersQuestion { Stage = 3, Question = "WhatDoesEOgMeansInName", Answer = "Edited", PossibleAnswers = { "Edition", "Experimental", "Enhanced", "Edited" }, QuizmasterQuestionType = QuizmasterQuestionType.NameOriginQuestion },
new CountQuestion { Stage = 3, Question = "HowManyDiedFirstRound", QuizmasterQuestionType = QuizmasterQuestionType.DiedFirstRoundCountQuestion },
new CountQuestion { Stage = 3, Question = "ButtonPressedBefore", QuizmasterQuestionType = QuizmasterQuestionType.ButtonPressedBeforeThisQuestion },
new SetAnswersQuestion { Stage = 4, Question = "WhoOwns", Answer = "Moe", PossibleAnswers = { "Lauryn", "Jackler", "Moe", "Marg", "Sarha", "laikrai", "Niko", "D1GQ", "KARPED1EM", "Matt" }, QuizmasterQuestionType = QuizmasterQuestionType.WhoOwns },

new DeathReasonQuestion { Stage = 4, Question = "PlrDieReason", QuizmasterQuestionType = QuizmasterQuestionType.PlrDeathReasonQuestion},
new DeathReasonQuestion { Stage = 4, Question = "PlrDieMethod", QuizmasterQuestionType = QuizmasterQuestionType.PlrDeathMethodQuestion},
new SetAnswersQuestion { Stage = 4, Question = "LastAddedRoleForKarped", Answer = "Pacifist", PossibleAnswers = { "Pacifist", "Vampire", "Snitch", "Vigilante", "Jackal", "Mole", "Sniper" }, QuizmasterQuestionType = QuizmasterQuestionType.RoleAddedQuestion },
new DeathReasonQuestion { Stage = 4, Question = "PlrDieFaction", QuizmasterQuestionType = QuizmasterQuestionType.PlrDeathKillerFactionQuestion},
new SetAnswersQuestion { Stage = 4, Question = "QuizmasterCooldown", Answer = "15", PossibleAnswers = { "15", "30", "0", "999", AURoleOptions.KillCooldown.ToString() }, QuizmasterQuestionType = QuizmasterQuestionType.QuizmasterCooldownQuestion }, // this is a level 4 because the only way to know this would be to look at the code for Quizmaster
new SetAnswersQuestion { Stage = 4, Question = "WhoCoded", Answer = "Multiple People", PossibleAnswers = { "Furo", "Drakos", "Moe", "Marg", "Multiple People", "TommyXL", "Niko", "Pyro", "KARPED1EM", "Ryuk" }, QuizmasterQuestionType = QuizmasterQuestionType.WhoCoded },
];

Question = GetRandomQuestion(Questions);
Expand Down Expand Up @@ -543,13 +550,15 @@ public override void FixUnsetAnswers()
}
else if (QuizmasterQuestionType == QuizmasterQuestionType.PlrDeathKillerFactionQuestion)
{
PossibleAnswers.Add("");
PossibleAnswers.Add(GetString("DeathReason.Vote"));
PossibleAnswers.Add(GetString("DeathReason.Kill"));
PossibleAnswers.Add(GetString("QuizmasterAnswers.Impostor"));
PossibleAnswers.Add(GetString("QuizmasterAnswers.Crewmate"));
PossibleAnswers.Add(GetString("QuizmasterAnswers.Neutral"));
PossibleAnswers.Add(GetString("QuizmasterAnswers.Coven"));
}

chosenPlayer = Main.AllPlayerControls[rnd.Next(Main.AllPlayerControls.Length)];


foreach (PlayerControl plr in Main.AllPlayerControls)
{
if (QuizmasterQuestionType == QuizmasterQuestionType.PlrDeathReasonQuestion)
Expand All @@ -570,15 +579,14 @@ public override void FixUnsetAnswers()
{
QuizmasterQuestionType.PlrDeathReasonQuestion => chosenPlayer.Data.IsDead ? Main.PlayerStates[chosenPlayer.PlayerId].deathReason.ToString() : "None",
QuizmasterQuestionType.PlrDeathMethodQuestion => chosenPlayer.Data.Disconnected ? GetString("Disconnected") : (Main.PlayerStates[chosenPlayer.PlayerId].deathReason == PlayerState.DeathReason.Vote ? GetString("DeathReason.Vote") : GetString("DeathReason.Kill")),
QuizmasterQuestionType.PlrDeathKillerFactionQuestion => CustomRolesHelper.GetRoleTypes(chosenPlayer.GetRealKiller().GetCustomRole()).ToString(),
QuizmasterQuestionType.PlrDeathKillerFactionQuestion => CustomRolesHelper.GetCustomRoleTeam(chosenPlayer.GetRealKiller().GetCustomRole()).ToString(),
_ => "None"
};

PossibleAnswers.Remove(Answer);
for (int numOfQuestionsDone = 0; numOfQuestionsDone < 3; numOfQuestionsDone++)
{
var prefix = "";
if (QuizmasterQuestionType == QuizmasterQuestionType.PlrDeathKillerFactionQuestion) prefix = "Type.";
if (numOfQuestionsDone == positionForRightAnswer)
{
AnswerLetter = new List<string> { "A", "B", "C" }[positionForRightAnswer];
Expand Down Expand Up @@ -762,6 +770,9 @@ public enum QuizmasterQuestionType
PlrDeathMethodQuestion,
RoleAddedQuestion,
PlrDeathKillerFactionQuestion,
QuizmasterCooldownQuestion,
WhoCoded,
WhoOwns,
}

[Obfuscation(Exclude = true)]
Expand Down

0 comments on commit 6276161

Please sign in to comment.