From 69f45cd5920f0296431a224f4aa9099ac43f39d7 Mon Sep 17 00:00:00 2001 From: Toastie <toastie@toastiet0ast.com> Date: Fri, 28 Mar 2025 21:21:31 +1300 Subject: [PATCH] fixed hangman look --- .../Modules/Games/Hangman/HangmanCommands.cs | 54 +++++++++++-------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/src/EllieBot/Modules/Games/Hangman/HangmanCommands.cs b/src/EllieBot/Modules/Games/Hangman/HangmanCommands.cs index acc0323..2c0ff7f 100644 --- a/src/EllieBot/Modules/Games/Hangman/HangmanCommands.cs +++ b/src/EllieBot/Modules/Games/Hangman/HangmanCommands.cs @@ -10,44 +10,54 @@ public partial class Games [Cmd] [RequireContext(ContextType.Guild)] public async Task Hangmanlist() - => await Response().Confirm(GetText(strs.hangman_types(prefix)), _service.GetHangmanTypes().Join('\n')).SendAsync(); + => await Response().Confirm(GetText(strs.hangman_types(prefix)), _service.GetHangmanTypes().Join('\n')) + .SendAsync(); private static string Draw(HangmanGame.State state) - => $""" - . ┌─────┐ - .┃...............┋ - .┃...............┋ - .┃{(state.Errors > 0 ? ".............😲" : "")} - .┃{(state.Errors > 1 ? "............./" : "")} {(state.Errors > 2 ? "|" : "")} {(state.Errors > 3 ? "\\" : "")} - .┃{(state.Errors > 4 ? "............../" : "")} {(state.Errors > 5 ? "\\" : "")} - /-\ - """; + { + var head = state.Errors >= 1 ? "O" : " "; + var torso = state.Errors >= 2 ? "|" : " "; + var leftArm = state.Errors >= 3 ? "/" : " "; + var rightArm = state.Errors >= 4 ? "\\" : " "; + var leftLeg = state.Errors >= 5 ? "/" : " "; + var rightLeg = state.Errors >= 6 ? "\\" : " "; + + return $""" + ``` + ┌─────┐ + │ {head} + │ {leftArm} {torso} {rightArm} + │ {leftLeg} {rightLeg} + ─┴─ + ``` + """; + } public static EmbedBuilder GetEmbed(IMessageSenderService sender, HangmanGame.State state) { if (state.Phase == HangmanGame.Phase.Running) { return sender.CreateEmbed() - .WithOkColor() - .AddField("Hangman", Draw(state)) - .AddField("Guess", Format.Code(state.Word)) - .WithFooter(state.MissedLetters.Join(' ')); + .WithOkColor() + .AddField("Hangman", Draw(state)) + .AddField("Guess", Format.Code(state.Word)) + .WithFooter(state.MissedLetters.Join(' ')); } if (state.Phase == HangmanGame.Phase.Ended && state.Failed) { return sender.CreateEmbed() - .WithErrorColor() - .AddField("Hangman", Draw(state)) - .AddField("Guess", Format.Code(state.Word)) - .WithFooter(state.MissedLetters.Join(' ')); + .WithErrorColor() + .AddField("Hangman", Draw(state)) + .AddField("Guess", Format.Code(state.Word)) + .WithFooter(state.MissedLetters.Join(' ')); } return sender.CreateEmbed() - .WithOkColor() - .AddField("Hangman", Draw(state)) - .AddField("Guess", Format.Code(state.Word)) - .WithFooter(state.MissedLetters.Join(' ')); + .WithOkColor() + .AddField("Hangman", Draw(state)) + .AddField("Guess", Format.Code(state.Word)) + .WithFooter(state.MissedLetters.Join(' ')); } [Cmd]