mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-26 13:04:20 +00:00
✨ #1 Add /spell
This commit is contained in:
parent
2b8a4e6520
commit
465ea31221
5 changed files with 61 additions and 1 deletions
13
poetry.lock
generated
13
poetry.lock
generated
|
@ -342,6 +342,14 @@ click = ">=7.1.2,<8.0.0"
|
||||||
royalnet = ">=6.4.0,<6.5.0"
|
royalnet = ">=6.4.0,<6.5.0"
|
||||||
Telethon = ">=1.21.1,<2.0.0"
|
Telethon = ">=1.21.1,<2.0.0"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "royalspells"
|
||||||
|
version = "3.2"
|
||||||
|
description = "A package to procedurally generate useless spells!"
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = "~=3.6"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rsa"
|
name = "rsa"
|
||||||
version = "4.7.2"
|
version = "4.7.2"
|
||||||
|
@ -504,7 +512,7 @@ multidict = ">=4.0"
|
||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "1.1"
|
lock-version = "1.1"
|
||||||
python-versions = "^3.8"
|
python-versions = "^3.8"
|
||||||
content-hash = "cb11116be1dc62024392fa97315da722acf0f700b8142d32047b03ee19625977"
|
content-hash = "83cf43c506e9d5e452c90d52620743ac27e7f40405b5bae1da20b181612879c3"
|
||||||
|
|
||||||
[metadata.files]
|
[metadata.files]
|
||||||
aiohttp = [
|
aiohttp = [
|
||||||
|
@ -897,6 +905,9 @@ royalnet-telethon = [
|
||||||
{file = "royalnet-telethon-1.0.2.tar.gz", hash = "sha256:cf2dd0394576bbf9e3b9a9355273e898af85acbdbbe2efc20c36a697fb093d61"},
|
{file = "royalnet-telethon-1.0.2.tar.gz", hash = "sha256:cf2dd0394576bbf9e3b9a9355273e898af85acbdbbe2efc20c36a697fb093d61"},
|
||||||
{file = "royalnet_telethon-1.0.2-py3-none-any.whl", hash = "sha256:64503dde289e71c3faa3b7b0e005b66081a6a86645d0d811d4c4b671db3267e8"},
|
{file = "royalnet_telethon-1.0.2-py3-none-any.whl", hash = "sha256:64503dde289e71c3faa3b7b0e005b66081a6a86645d0d811d4c4b671db3267e8"},
|
||||||
]
|
]
|
||||||
|
royalspells = [
|
||||||
|
{file = "royalspells-3.2.tar.gz", hash = "sha256:2bd4a9a66514532e35c02c3907425af48c7cb292364c4843c795719a82b25dfe"},
|
||||||
|
]
|
||||||
rsa = [
|
rsa = [
|
||||||
{file = "rsa-4.7.2-py3-none-any.whl", hash = "sha256:78f9a9bf4e7be0c5ded4583326e7461e3a3c5aae24073648b4bdfa797d78c9d2"},
|
{file = "rsa-4.7.2-py3-none-any.whl", hash = "sha256:78f9a9bf4e7be0c5ded4583326e7461e3a3c5aae24073648b4bdfa797d78c9d2"},
|
||||||
{file = "rsa-4.7.2.tar.gz", hash = "sha256:9d689e6ca1b3038bc82bf8d23e944b6b6037bc02301a574935b2dd946e0353b9"},
|
{file = "rsa-4.7.2.tar.gz", hash = "sha256:9d689e6ca1b3038bc82bf8d23e944b6b6037bc02301a574935b2dd946e0353b9"},
|
||||||
|
|
|
@ -27,6 +27,7 @@ steam = "^1.2.0"
|
||||||
SQLAlchemy-Utils = "^0.37.0"
|
SQLAlchemy-Utils = "^0.37.0"
|
||||||
arrow = "^1.0.3"
|
arrow = "^1.0.3"
|
||||||
colour = "^0.1.5"
|
colour = "^0.1.5"
|
||||||
|
royalspells = "^3.2"
|
||||||
|
|
||||||
[tool.poetry.dev-dependencies]
|
[tool.poetry.dev-dependencies]
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,7 @@ register_telegram(commands.dog_breedlist, ["dog"], "(?:list|help|aiuto)")
|
||||||
register_telegram(commands.dog_breed, ["dog"], "(?P<breed>[A-Za-z/]+)")
|
register_telegram(commands.dog_breed, ["dog"], "(?P<breed>[A-Za-z/]+)")
|
||||||
register_telegram(commands.fortune, ["fortune"])
|
register_telegram(commands.fortune, ["fortune"])
|
||||||
register_telegram(commands.pmots, ["pmots"])
|
register_telegram(commands.pmots, ["pmots"])
|
||||||
|
register_telegram(commands.spell, ["spell"], "(?P<spellname>.+)")
|
||||||
|
|
||||||
|
|
||||||
pda.implementations["telethon.1"].register_conversation(r)
|
pda.implementations["telethon.1"].register_conversation(r)
|
||||||
|
|
|
@ -9,3 +9,4 @@ from .emojify import *
|
||||||
from .dog import *
|
from .dog import *
|
||||||
from .fortune import *
|
from .fortune import *
|
||||||
from .pmots import *
|
from .pmots import *
|
||||||
|
from .spell import *
|
||||||
|
|
46
royalpack/commands/spell.py
Normal file
46
royalpack/commands/spell.py
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
import royalnet.engineer as engi
|
||||||
|
import royalspells
|
||||||
|
|
||||||
|
|
||||||
|
@engi.TeleportingConversation
|
||||||
|
async def spell(*, _msg: engi.Message, spellname: str, **__):
|
||||||
|
"""
|
||||||
|
Genera una spell casuale!
|
||||||
|
"""
|
||||||
|
spell = royalspells.Spell(spellname)
|
||||||
|
|
||||||
|
rows: list[str] = [f"✨ {spell.name}"]
|
||||||
|
|
||||||
|
if spell.damage_component:
|
||||||
|
dmg: royalspells.DamageComponent = spell.damage_component
|
||||||
|
constant_str: str = f"{dmg.constant:+d}" if dmg.constant != 0 else ""
|
||||||
|
rows.append(f"Danni: {dmg.dice_number}d{dmg.dice_type}{constant_str}"
|
||||||
|
f" {', '.join(dmg.damage_types)}")
|
||||||
|
rows.append(f"Precisione: {dmg.miss_chance}%")
|
||||||
|
if dmg.repeat > 1:
|
||||||
|
rows.append(f"Multiattacco: ×{dmg.repeat}")
|
||||||
|
rows.append("")
|
||||||
|
|
||||||
|
if spell.healing_component:
|
||||||
|
heal: royalspells.HealingComponent = spell.healing_component
|
||||||
|
constant_str: str = f"{heal.constant:+d}" if heal.constant != 0 else ""
|
||||||
|
rows.append(f"Cura: {heal.dice_number}d{heal.dice_type}{constant_str} HP")
|
||||||
|
rows.append("")
|
||||||
|
|
||||||
|
if spell.stats_component:
|
||||||
|
stats: royalspells.StatsComponent = spell.stats_component
|
||||||
|
rows.append("Il caster riceve: ")
|
||||||
|
for stat_name in stats.stat_changes:
|
||||||
|
rows.append(f"{stat_name}{stats.stat_changes[stat_name]}")
|
||||||
|
rows.append("")
|
||||||
|
|
||||||
|
if spell.status_effect_component:
|
||||||
|
se: royalspells.StatusEffectComponent = spell.status_effect_component
|
||||||
|
rows.append("Infligge al bersaglio: ")
|
||||||
|
rows.append(f"{se.effect} ({se.chance}%)")
|
||||||
|
rows.append("")
|
||||||
|
|
||||||
|
await _msg.reply(text="\n".join(rows))
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ("spell",)
|
Loading…
Reference in a new issue