# AbilityService

Example usage:

```lua
AbilityService.createAbility("script_speed", "MiscPrimary", {
    maxProgress = 10,
    progressPerUse = 5,
})

AbilityService.enableAbility(MatchService.getHost(), "script_speed")

Events.UseAbility(function (event)
    if (event.abilityName == "script_speed") then
        StatusEffectService.giveEffect(event.entity, StatusEffectType.SPEED, 2)
    end
end)
```

### Functions

#### createAbility(abilityName: string, abilityInputType: [AbilityInputType](https://docs.easy.gg/scripting/bedwars-scripting/types/abilityinputtype), config: [AbilityConfig](https://docs.easy.gg/scripting/bedwars-scripting/objects/abilityconfig))

Creates a new custom ability that can be enabled for players.

#### enableAbility(player: [Player](https://docs.easy.gg/scripting/bedwars-scripting/objects/player), abilityName: string, progressRate: number | nil)

Enables the custom ability for the player. Use the optional progressRate parameter to set the rate (in seconds) at which progress is restored to the custom ability.

#### removeAbility(player: [Player](https://docs.easy.gg/scripting/bedwars-scripting/objects/player), abilityName: string)

Removes the custom ability from the player.

#### setProgressRate(player: [Player](https://docs.easy.gg/scripting/bedwars-scripting/objects/player), abilityName: string, progressRate: number | nil)

Sets the rate (in seconds) at which progress is restored to the cstom ability.

#### getProgress(player: [Player](https://docs.easy.gg/scripting/bedwars-scripting/objects/player), abilityName: string): number

Returns the current progress of the ability.

#### addProgress(player: [Player](https://docs.easy.gg/scripting/bedwars-scripting/objects/player), abilityName: string, amount: number)

Adds the given amount of progress to the current progress on the ability.

#### subProgress(player: [Player](https://docs.easy.gg/scripting/bedwars-scripting/objects/player), abilityName: string, amount: number)

Subtracts the given amount of progress from the current progress on the ability.

#### setProgress(player: [Player](https://docs.easy.gg/scripting/bedwars-scripting/objects/player), abilityName: string, amount: number)

Sets the progress for the ability to the given amount.

#### getAbilities(player: [Player](https://docs.easy.gg/scripting/bedwars-scripting/objects/player)): string\[]

Returns a list of custom abilities that the player currently has enabled.
