"""Contains the StarWarsCog, which deals with Star Wars commands."""
from discord.ext import commands
from interactions import cog_ext

from gwendolyn_old.utils import get_params  # pylint: disable=import-error

params = get_params()


class StarWarsCog(commands.Cog):
  """Contains the Star Wars commands."""

  def __init__(self, bot):
    """Initialize the cog."""
    self.bot = bot

  @cog_ext.cog_slash(**params["star_wars_roll"])
  async def star_wars_roll(self, ctx, dice=""):
    """Roll Star Wars dice."""
    await self.bot.star_wars.roll.parseRoll(ctx, dice)

  @cog_ext.cog_slash(**params["star_wars_destiny"])
  async def star_wars_destiny(self, ctx, parameters=""):
    """Control Star Wars destiny points."""
    await self.bot.star_wars.destiny.parseDestiny(ctx, parameters)

  @cog_ext.cog_slash(**params["star_wars_crit"])
  async def star_wars_crit(self, ctx, severity: int = 0):
    """Roll for critical injuries."""
    await self.bot.star_wars.roll.critRoll(ctx, severity)

  @cog_ext.cog_slash(**params["star_wars_character"])
  async def star_wars_character(self, ctx, parameters=""):
    """Access and change Star Wars character sheet data."""
    await self.bot.star_wars.character.parseChar(ctx, parameters)


def setup(bot):
  """Add the cog to the bot."""
  bot.add_cog(StarWarsCog(bot))
