diff --git a/poetry.lock b/poetry.lock index 2a842f82..0111cf34 100644 --- a/poetry.lock +++ b/poetry.lock @@ -425,6 +425,14 @@ reference = "d82b824a3447b6aef9e5d6997033852d53089127" type = "git" url = "https://github.com/Steffo99/royalnet/" +[[package]] +category = "main" +description = "A package to procedurally generate useless spells!" +name = "royalspells" +optional = false +python-versions = "~=3.6" +version = "3.2" + [[package]] category = "main" description = "Python client for Sentry (https://getsentry.com)" @@ -583,7 +591,7 @@ python-versions = "*" version = "2019.11.28" [metadata] -content-hash = "869279b7212d24287566f5b073831fa19f68f9e099177d96b78af0897e99489b" +content-hash = "be7ee7b683f3e789a759f25a03730bf98152e6c5f47219d9ee5030f8f66d9d6f" python-versions = "^3.8" [metadata.files] @@ -837,6 +845,9 @@ riotwatcher = [ {file = "riotwatcher-2.7.1.tar.gz", hash = "sha256:5349271c7e00637b7619491a6070e66603705db60558ea2a690e7016f6e6d9a4"}, ] royalnet = [] +royalspells = [ + {file = "royalspells-3.2.tar.gz", hash = "sha256:2bd4a9a66514532e35c02c3907425af48c7cb292364c4843c795719a82b25dfe"}, +] sentry-sdk = [ {file = "sentry-sdk-0.13.4.tar.gz", hash = "sha256:bfc486af718c268cf49ff43d6334ed4db7333ace420240b630acdd8f8a3a8f60"}, {file = "sentry_sdk-0.13.4-py2.py3-none-any.whl", hash = "sha256:a7c2c8d3f53b6b57454830cd6a4b73d272f1ba91952f59e6545b3cf885f3c22f"}, diff --git a/pyproject.toml b/pyproject.toml index 41e68a12..03565bf6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,6 +21,7 @@ python = "^3.8" riotwatcher = "^2.7.1" + royalspells = "^3.2" [tool.poetry.dependencies.royalnet] git = "https://github.com/Steffo99/royalnet/" diff --git a/royalpack/commands/__init__.py b/royalpack/commands/__init__.py index a469c2a5..c3615f34 100644 --- a/royalpack/commands/__init__.py +++ b/royalpack/commands/__init__.py @@ -27,6 +27,7 @@ from .peertube import PeertubeCommand from .googlevideo import GooglevideoCommand from .yahoovideo import YahoovideoCommand from .userinfo import UserinfoCommand +from .spell import SpellCommand # Enter the commands of your Pack here! available_commands = [ @@ -58,6 +59,7 @@ available_commands = [ GooglevideoCommand, YahoovideoCommand, UserinfoCommand, + SpellCommand, ] # Don't change this, it should automatically generate __all__ diff --git a/royalpack/commands/spell.py b/royalpack/commands/spell.py new file mode 100644 index 00000000..6d68bf00 --- /dev/null +++ b/royalpack/commands/spell.py @@ -0,0 +1,51 @@ +from typing import * +from royalnet.commands import * +from royalnet.utils import * +from royalnet.backpack.tables import User +from sqlalchemy import func +import royalspells as rs + + +class SpellCommand(Command): + name: str = "spell" + + description: str = "Genera casualmente una spell!" + + syntax = "{nome_spell}" + + async def run(self, args: CommandArgs, data: CommandData) -> None: + spell_name = args.joined(require_at_least=1) + spell = rs.Spell(spell_name) + + rows: List[str] = [f"✨ [b]{spell.name}[/b]"] + + if spell.damage_component: + dmg: rs.DamageComponent = spell.damage_component + constant_str: str = f"{dmg.constant:+d}" if dmg.constant != 0 else "" + rows.append(f"Danni: [b]{dmg.dice_number}d{dmg.dice_type}{constant_str}[/b]" + f" {andformat(dmg.damage_types, final=' e ')}") + rows.append(f"Precisione: [b]{dmg.miss_chance}%[/b]") + if dmg.repeat > 1: + rows.append(f"Multiattacco: [b]×{dmg.repeat}[/b]") + rows.append("") + + if spell.healing_component: + heal: rs.HealingComponent = spell.healing_component + constant_str: str = f"{heal.constant:+d}" if heal.constant != 0 else "" + rows.append(f"Cura: [b]{heal.dice_number}d{heal.dice_type}{constant_str}[/b] HP") + rows.append("") + + if spell.stats_component: + stats: rs.StatsComponent = spell.stats_component + rows.append("Il caster riceve: ") + for stat_name in stats.stat_changes: + rows.append(f"[b]{stats.stat_changes[stat_name]}{stat_name}[/b]") + rows.append("") + + if spell.status_effect_component: + se: rs.StatusEffectComponent = spell.status_effect_component + rows.append("Infligge al bersaglio: ") + rows.append(f"[b]{se.effect}[/b] ({se.chance}%)") + rows.append("") + + await data.reply("\n".join(rows))