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

50 lines
1.7 KiB
Python
Raw Normal View History

2021-04-18 15:15:50 +00:00
import royalnet.engineer as engi
import royalspells
2021-04-30 13:22:58 +00:00
import royalpack.bolts as rb
2021-04-18 15:15:50 +00:00
2021-04-30 13:22:58 +00:00
@rb.capture_errors
2021-04-18 15:15:50 +00:00
@engi.TeleportingConversation
async def spell(*, _msg: engi.Message, spellname: str, **__):
"""
Genera una spell casuale!
"""
2021-04-18 16:33:51 +00:00
s = royalspells.Spell(spellname)
2021-04-18 15:15:50 +00:00
2022-06-06 21:13:46 +00:00
rows: list[str] = [f"\uE012\uE01B{s.name}\uE00B\uE002"]
2021-04-18 15:15:50 +00:00
2021-04-18 16:33:51 +00:00
if s.damage_component:
dmg: royalspells.DamageComponent = s.damage_component
2021-04-18 15:15:50 +00:00
constant_str: str = f"{dmg.constant:+d}" if dmg.constant != 0 else ""
2022-06-06 21:13:46 +00:00
rows.append(f"Danni: \uE01B{dmg.dice_number}d{dmg.dice_type}{constant_str}\uE00B"
2021-04-18 15:15:50 +00:00
f" {', '.join(dmg.damage_types)}")
2022-06-06 21:13:46 +00:00
rows.append(f"Precisione: \uE01B{dmg.miss_chance}%\uE00B")
2021-04-18 15:15:50 +00:00
if dmg.repeat > 1:
2022-06-06 21:13:46 +00:00
rows.append(f"Multiattacco: \uE01B×{dmg.repeat}\uE00B")
2021-04-18 15:15:50 +00:00
rows.append("")
2021-04-18 16:33:51 +00:00
if s.healing_component:
heal: royalspells.HealingComponent = s.healing_component
2021-04-18 15:15:50 +00:00
constant_str: str = f"{heal.constant:+d}" if heal.constant != 0 else ""
2022-06-06 21:13:46 +00:00
rows.append(f"Cura: \uE01B{heal.dice_number}d{heal.dice_type}{constant_str}\uE00B")
2021-04-18 15:15:50 +00:00
rows.append("")
2021-04-18 16:33:51 +00:00
if s.stats_component:
stats: royalspells.StatsComponent = s.stats_component
2021-04-18 15:15:50 +00:00
rows.append("Il caster riceve: ")
for stat_name in stats.stat_changes:
2022-06-06 21:13:46 +00:00
rows.append(f"\uE01B{stat_name}{stats.stat_changes[stat_name]}\uE00B")
2021-04-18 15:15:50 +00:00
rows.append("")
2021-04-18 16:33:51 +00:00
if s.status_effect_component:
se: royalspells.StatusEffectComponent = s.status_effect_component
2021-04-18 15:15:50 +00:00
rows.append("Infligge al bersaglio: ")
2022-06-06 21:13:46 +00:00
rows.append(f"\uE01B{se.effect}\uE00B ({se.chance}%)")
2021-04-18 15:15:50 +00:00
rows.append("")
await _msg.reply(text="\n".join(rows))
__all__ = ("spell",)