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

25 lines
775 B
Python
Raw Permalink Normal View History

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