Kirk Trombley %!s(int64=4) %!d(string=hai) anos
pai
achega
bd01d5f292
Modificáronse 1 ficheiros con 43 adicións e 60 borrados
  1. 43 60
      commands/commands/hangguy.py

+ 43 - 60
commands/commands/hangguy.py

@@ -10,132 +10,114 @@ from rollbot.injection import Data, Config, Subcommand, Lazy, Args, Origin, Send
 
 KEY = "HANG_GUY_SINGLETON"
 GUY_STAGES = [
-""
-,
-"""\
+    "",
+    """\
 😎
-"""
-,
-"""\
+""",
+    """\
 😎
 👔
-"""
-,
-"""\
+""",
+    """\
 😎
 👔
-"""
-,
-"""\
+""",
+    """\
 😎
 👔
-"""
-,
-"""\
+""",
+    """\
 👍     😎
           👔
-"""
-,
-"""\
+""",
+    """\
 👍     😎
 🐛     👔
-"""
-,
-"""\
+""",
+    """\
 🖕     😎
 🐛💤👔
-"""
-,
-"""\
+""",
+    """\
 🖕     😎
 🐛💤👔🐛
-"""
-,
-"""\
+""",
+    """\
 🖕     😟
 🐛💤👔🐛
           ⛽ 👢
-"""
-,
-"""\
+""",
+    """\
 🖕     😟
 🐛💤👔🐛
           ⛽ 👢
           ⚡👊
-"""
-,
-"""\
+""",
+    """\
 🖕     😨
 🐛💤👔🐛
           ⛽  👢
           ⚡8=👊
-"""
-,
-"""\
+""",
+    """\
 🖕     😨
 🐛💤👔🐛
           ⛽  👢
           ⚡8=👊
       🎸
-"""
-,
-"""\
+""",
+    """\
 🖕     😰
 🐛💤👔🐛
           ⛽  👢
           ⚡8=👊
       🎸
   👢
-"""
-,
-"""\
+""",
+    """\
 🖕     😰
 🐛💤👔🐛
           ⛽  👢
           ⚡8=👊
       🎸    🌽
   👢
-"""
-,
-"""\
+""",
+    """\
 🖕     😰
 🐛💤👔🐛
           ⛽  👢
           ⚡8=👊
       🎸    🌽
   👢             👢
-"""
-,
-"""\
+""",
+    """\
 🖕     😫
 🐛💤👔🐛
           ⛽  👢
           ⚡8=👊=D
       🎸    🌽
   👢             👢
-"""
-,
-"""\
+""",
+    """\
 🖕     😵
 🐛💤👔🐛
           ⛽  👢
           ⚡8=👊=D💦
       🎸    🌽
   👢             👢
-"""
-,
+""",
 ]
 
 
@@ -181,7 +163,7 @@ class HangGuy:
 
         if not self.is_active():
             return guy
-        
+
         return f"{guy}\n{' '.join(self.game_state)}\nBad Guesses: {', '.join(self.bad_guesses)}"
 
 
@@ -211,11 +193,11 @@ async def hangguy(
 ):
     if len(cmd.args) == 0:
         RollbotFailure.INVALID_ARGUMENTS.raise_exc(detail="Must provide subcommand or guess")
-    
+
     game = await store.load_or(KEY)
     is_active = game.is_active()
 
-    subc = cmd.get_subcommand(inherit_bang=False) # get subcommand, requiring bang
+    subc = cmd.get_subcommand(inherit_bang=False)  # get subcommand, requiring bang
 
     if subc is None or cmd.bang != subc.bang:
         if game.is_active():
@@ -233,7 +215,9 @@ async def hangguy(
                         game.guy_state += 1
                         prefix = "Bad guess!"
                     else:
-                        game.game_state = "".join(guess if i in find else s for i, s in enumerate(game.game_state))
+                        game.game_state = "".join(
+                            guess if i in find else s for i, s in enumerate(game.game_state)
+                        )
                         prefix = f"Great! '{guess}' appears {len(find)} time{'' if len(find) == 1 else 's'}!"
             elif game.puzzle.split() == guess.split():
                 prefix = "You've guessed the full phrase!"
@@ -248,14 +232,14 @@ async def hangguy(
                 game.end_game()
                 game.guy_lifetime += 1
                 txt += f"\nThe game is over, and the guy lives on!\n{game.survival_msg()}"
-            
+
             if game.is_dead():
                 game.end_game()
                 dead = DeadGuy.from_guy(game)
                 game.reset_guy()
                 await dead_store.save(f"{uuid4().hex}-{datetime.now().isoformat()}", dead_guy)
                 txt += f"\noh god oh fuck, the guy is dead!\nYou failed to guess {game.puzzle}\nThe guy has been buried."
-            
+
             await store.save(KEY, game)
             return txt
         RollbotFailure.MISSING_SUBCOMMAND.raise_exc(
@@ -290,7 +274,6 @@ async def hangguy(
     if subc.name == "view" and not is_active:
         return f"{game.survival_msg()}\n" + game.render()
 
-
     if is_active:
         RollbotFailure.INVALID_SUBCOMMAND.raise_exc(
             detail="The only in-game subcommands are !cancel to end the game and !alert to alert the main chat."