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

24 lines
775 B
Python

from typing import *
import royalnet.commands as rc
from ..tables import DndBattleUnit
from .abstract import DndBattleTargetCommand
class DnddeathsaveCommand(DndBattleTargetCommand):
name: str = "dnddeathsave"
description: str = "Add a death save result to a target in the currently active battle."
syntax: str = "{target} {s|f}"
aliases = ["deathsave", "ddeathsave", "ds", "dds", "dndds"]
async def _change(self, unit: DndBattleUnit, args: List[str]):
health = unit.health
if args[0][0] == "s":
health.deathsave_success()
elif args[0][0] == "f":
health.deathsave_failure()
else:
raise rc.InvalidInputError(f"Unknown result type [c]{args[0][0]}[/c].")
unit.health = health