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

51 lines
1.9 KiB
Python
Raw Normal View History

2019-12-03 13:57:08 +00:00
from typing import *
2020-05-10 22:46:12 +00:00
import royalnet.commands as rc
import royalnet.utils as ru
2019-12-03 13:57:08 +00:00
import royalspells as rs
2020-09-22 02:01:22 +00:00
import datetime
2019-12-03 13:57:08 +00:00
2020-05-10 22:46:12 +00:00
class SpellCommand(rc.Command):
2019-12-03 13:57:08 +00:00
name: str = "spell"
description: str = "Genera casualmente una spell!"
syntax = "{nome_spell}"
2020-05-10 22:46:12 +00:00
async def run(self, args: rc.CommandArgs, data: rc.CommandData) -> None:
2019-12-03 13:57:08 +00:00
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]"
2020-05-10 22:46:12 +00:00
f" {ru.andformat(dmg.damage_types, final=' e ')}")
2019-12-03 13:57:08 +00:00
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:
2020-01-13 13:51:54 +00:00
rows.append(f"[b]{stat_name}{stats.stat_changes[stat_name]}[/b]")
2019-12-03 13:57:08 +00:00
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))