namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;

/// <summary>
/// Surge Surfer is an ability that doubles the Pokémon's Speed while Electric Terrain is active.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Surge_Surfer_(Ability)">Bulbapedia - Surge Surfer</see>
/// </summary>
[Script(ScriptCategory.Ability, "surge_surfer")]
public class SurgeSurfer : Script, IScriptChangeSpeed
{
    /// <inheritdoc />
    public void ChangeSpeed(ITurnChoice choice, ref uint speed)
    {
        if (choice.User.BattleData?.Battle.TerrainName == ScriptUtils.ResolveName<Terrain.ElectricTerrain>())
        {
            speed = speed.MultiplyOrMax(2);
        }
    }
}