using PkmnLib.Static.Species;

namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;

/// <summary>
/// Rivalry is an ability that increases damage to Pokémon of the same gender and decreases it to the opposite gender.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Rivalry_(Ability)">Bulbapedia - Rivalry</see>
/// </summary>
[Script(ScriptCategory.Ability, "rivalry")]
public class Rivalry : Script, IScriptChangeBasePower
{
    /// <inheritdoc />
    public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
    {
        if (move.User.Gender == Gender.Genderless || target.Gender == Gender.Genderless)
            return;
        if (move.User.Gender == target.Gender)
            basePower = basePower.MultiplyOrMax(1.25f);
        else
            basePower = (ushort)(basePower * 0.75f);
    }
}