Deukhoofd 7c270a6d52
All checks were successful
Build / Build (push) Successful in 1m1s
Finish script interface refactor
2025-07-06 10:27:56 +02:00

30 lines
1.1 KiB
C#

using PkmnLib.Static.Moves;
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <summary>
/// Hustle is an ability that increases the Pokémon's Attack by 50% but lowers the accuracy of its physical moves.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Hustle_(Ability)">Bulbapedia - Hustle</see>
/// </summary>
[Script(ScriptCategory.Ability, "hustle")]
public class Hustle : Script, IScriptChangeOffensiveStatValue, IScriptChangeAccuracy
{
/// <inheritdoc />
public void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
ImmutableStatisticSet<uint> targetStats, Statistic stat, ref uint value)
{
if (stat != Statistic.Attack)
return;
value = value.MultiplyOrMax(1.5f);
}
/// <inheritdoc />
public void ChangeAccuracy(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref int modifiedAccuracy)
{
if (executingMove.UseMove.Category == MoveCategory.Physical)
{
modifiedAccuracy = (int)(modifiedAccuracy * 0.8f);
}
}
}