From 76a98907a0fb1304d3dfb9375993393c45ce8228 Mon Sep 17 00:00:00 2001 From: DigiDuncan Date: Sun, 3 Dec 2023 03:07:03 -0500 Subject: [PATCH] add heartbeat to quake --- sizebot/cogs/quake.py | 17 ++++++++++------- sizebot/lib/quake.py | 4 ++++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/sizebot/cogs/quake.py b/sizebot/cogs/quake.py index cd2b8f0f..8170eeb3 100644 --- a/sizebot/cogs/quake.py +++ b/sizebot/cogs/quake.py @@ -6,14 +6,14 @@ from sizebot.lib.constants import colors, emojis from sizebot.lib.fakeplayer import FakePlayer -from sizebot.lib.quake import breath_joules, joules_to_mag, jump_joules, mag_to_name, mag_to_radius, poke_joules, step_joules, stomp_joules +from sizebot.lib.quake import breath_joules, heartbeat_joules, joules_to_mag, jump_joules, mag_to_name, mag_to_radius, poke_joules, step_joules, stomp_joules from sizebot.lib.units import SV from sizebot.lib.userdb import load_or_fake from sizebot.lib.errors import UserMessedUpException EARTH_RAD = Decimal(10_018_570) UNI_RAD = Decimal(4.4E26) -QuakeType = typing.Literal["step", "stomp", "jump", "poke", "breath", "breathe"] +QuakeType = typing.Literal["step", "stomp", "jump", "poke", "breath", "breathe", "heartbeat"] class QuakeCog(commands.Cog): """Quake commands.""" @@ -30,20 +30,23 @@ async def earthquake(self, ctx, quake_type: typing.Optional[QuakeType] = "step", user = ctx.author userdata = load_or_fake(user) if quake_type == "step": - verb = "stepping" + verb = " stepping" joules = step_joules(userdata) elif quake_type == "stomp": - verb = "stomping" + verb = " stomping" joules = stomp_joules(userdata) elif quake_type == "jump": - verb = "jumping" + verb = " jumping" joules = jump_joules(userdata) elif quake_type == "poke": - verb = "poking" + verb = " poking" joules = poke_joules(userdata) elif quake_type == "breath" or quake_type == "breathe": - verb = "breathing" + verb = " breathing" joules = breath_joules(userdata) + elif quake_type == "heartbeat": + verb = "'s heart beating" + joules = heartbeat_joules(userdata) else: raise UserMessedUpException(f"{quake_type} is not a valid quake type.") mag = joules_to_mag(joules) diff --git a/sizebot/lib/quake.py b/sizebot/lib/quake.py index 4d7362ca..891da38a 100644 --- a/sizebot/lib/quake.py +++ b/sizebot/lib/quake.py @@ -13,6 +13,7 @@ BREATH_JOULES = 0.025 POKE_JOULES = 8 +HEARTBEAT_JOULES = 5.38E-9 def joules_to_mag(joules: float) -> Decimal: # This might not be super accurate. @@ -72,3 +73,6 @@ def breath_joules(user: User) -> Decimal: def poke_joules(user: User) -> Decimal: return Decimal(POKE_JOULES) * (user.scale ** 3) + +def heartbeat_joules(user: User) -> Decimal: + return Decimal(HEARTBEAT_JOULES) * (user.scale ** 3)