|
@@ -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."
|