From c485154afe0c7052a4bfb64eb1ec2cf3d3b45dc3 Mon Sep 17 00:00:00 2001 From: DigiDuncan Date: Sat, 2 Dec 2023 04:58:52 -0500 Subject: [PATCH] add more quake types --- sizebot/cogs/quake.py | 8 +++++++- sizebot/lib/quake.py | 9 +++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/sizebot/cogs/quake.py b/sizebot/cogs/quake.py index d4cb1e39..05fafc09 100644 --- a/sizebot/cogs/quake.py +++ b/sizebot/cogs/quake.py @@ -6,7 +6,7 @@ from sizebot.lib.constants import colors from sizebot.lib.fakeplayer import FakePlayer -from sizebot.lib.quake import joules_to_mag, jump_joules, mag_to_name, mag_to_radius, step_joules, stomp_joules +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.units import SV from sizebot.lib.userdb import load_or_fake from sizebot.lib.errors import UserMessedUpException @@ -37,6 +37,12 @@ async def earthquake(self, ctx, quake_type: typing.Optional[QuakeType] = "step", elif quake_type == "jump": verb = "jumping" joules = jump_joules(userdata) + elif quake_type == "poke": + verb = "poking" + joules = poke_joules(userdata) + elif quake_type == "breath": + verb = "breathing" + joules = breath_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 b7fb87c2..4653022d 100644 --- a/sizebot/lib/quake.py +++ b/sizebot/lib/quake.py @@ -11,6 +11,9 @@ STOMP_FACTOR = 0.5 JUMP_FACTOR = 1 +BREATH_JOULES = 0.25 +POKE_JOULES = 8 + def joules_to_mag(joules: float) -> Decimal: # This might not be super accurate. return Decimal(2/3) * Decimal(math.log10(joules)) - Decimal(3.2) @@ -63,3 +66,9 @@ def stomp_joules(user: User) -> int: def jump_joules(user: User) -> int: return scale_to_joules(user, G, JUMP_FACTOR) + +def breath_joules(user: User) -> int: + return int(BREATH_JOULES * (user.scale ** 4)) + +def poke_joules(user: User) -> int: + return int(POKE_JOULES * (user.scale ** 4))