1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Spell is back bois

This commit is contained in:
Steffo 2019-12-03 14:57:08 +01:00
parent a6a12f60a9
commit 98ccb0afee
4 changed files with 66 additions and 1 deletions

13
poetry.lock generated
View file

@ -425,6 +425,14 @@ reference = "d82b824a3447b6aef9e5d6997033852d53089127"
type = "git" type = "git"
url = "https://github.com/Steffo99/royalnet/" 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]] [[package]]
category = "main" category = "main"
description = "Python client for Sentry (https://getsentry.com)" description = "Python client for Sentry (https://getsentry.com)"
@ -583,7 +591,7 @@ python-versions = "*"
version = "2019.11.28" version = "2019.11.28"
[metadata] [metadata]
content-hash = "869279b7212d24287566f5b073831fa19f68f9e099177d96b78af0897e99489b" content-hash = "be7ee7b683f3e789a759f25a03730bf98152e6c5f47219d9ee5030f8f66d9d6f"
python-versions = "^3.8" python-versions = "^3.8"
[metadata.files] [metadata.files]
@ -837,6 +845,9 @@ riotwatcher = [
{file = "riotwatcher-2.7.1.tar.gz", hash = "sha256:5349271c7e00637b7619491a6070e66603705db60558ea2a690e7016f6e6d9a4"}, {file = "riotwatcher-2.7.1.tar.gz", hash = "sha256:5349271c7e00637b7619491a6070e66603705db60558ea2a690e7016f6e6d9a4"},
] ]
royalnet = [] royalnet = []
royalspells = [
{file = "royalspells-3.2.tar.gz", hash = "sha256:2bd4a9a66514532e35c02c3907425af48c7cb292364c4843c795719a82b25dfe"},
]
sentry-sdk = [ sentry-sdk = [
{file = "sentry-sdk-0.13.4.tar.gz", hash = "sha256:bfc486af718c268cf49ff43d6334ed4db7333ace420240b630acdd8f8a3a8f60"}, {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"}, {file = "sentry_sdk-0.13.4-py2.py3-none-any.whl", hash = "sha256:a7c2c8d3f53b6b57454830cd6a4b73d272f1ba91952f59e6545b3cf885f3c22f"},

View file

@ -21,6 +21,7 @@
python = "^3.8" python = "^3.8"
riotwatcher = "^2.7.1" riotwatcher = "^2.7.1"
royalspells = "^3.2"
[tool.poetry.dependencies.royalnet] [tool.poetry.dependencies.royalnet]
git = "https://github.com/Steffo99/royalnet/" git = "https://github.com/Steffo99/royalnet/"

View file

@ -27,6 +27,7 @@ from .peertube import PeertubeCommand
from .googlevideo import GooglevideoCommand from .googlevideo import GooglevideoCommand
from .yahoovideo import YahoovideoCommand from .yahoovideo import YahoovideoCommand
from .userinfo import UserinfoCommand from .userinfo import UserinfoCommand
from .spell import SpellCommand
# Enter the commands of your Pack here! # Enter the commands of your Pack here!
available_commands = [ available_commands = [
@ -58,6 +59,7 @@ available_commands = [
GooglevideoCommand, GooglevideoCommand,
YahoovideoCommand, YahoovideoCommand,
UserinfoCommand, UserinfoCommand,
SpellCommand,
] ]
# Don't change this, it should automatically generate __all__ # Don't change this, it should automatically generate __all__

View file

@ -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))