namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;

/// <summary>
/// Swift Swim is an ability that doubles the Pokémon's Speed in rain.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Swift_Swim_(Ability)">Bulbapedia - Swift Swim</see>
/// </summary>
[Script(ScriptCategory.Ability, "swift_swim")]
public class SwiftSwim : Script, IScriptChangeSpeed
{
    /// <inheritdoc />
    public void ChangeSpeed(ITurnChoice choice, ref uint speed)
    {
        if (choice.User.BattleData?.Battle.WeatherName == ScriptUtils.ResolveName<Weather.Rain>())
        {
            speed = speed.MultiplyOrMax(2);
        }
    }
}