30 lines
1.0 KiB
C#
30 lines
1.0 KiB
C#
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|
|
|
/// <summary>
|
|
/// Sand Veil is an ability that raises the Pokémon's evasion during a sandstorm.
|
|
///
|
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Sand_Veil_(Ability)">Bulbapedia - Sand Veil</see>
|
|
/// </summary>
|
|
[Script(ScriptCategory.Ability, "sand_veil")]
|
|
public class SandVeil : Script
|
|
{
|
|
/// <inheritdoc />
|
|
public override void ChangeIncomingAccuracy(IExecutingMove executingMove, IPokemon target, byte hitIndex,
|
|
ref int modifiedAccuracy)
|
|
{
|
|
if (executingMove.Battle.WeatherName != ScriptUtils.ResolveName<Weather.Sandstorm>())
|
|
return;
|
|
|
|
modifiedAccuracy = (int)(modifiedAccuracy * (3277f / 4096f));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public override void CustomTrigger(StringKey eventName, ICustomTriggerArgs args)
|
|
{
|
|
if (eventName == CustomTriggers.BypassSandstormDamage &&
|
|
args is CustomTriggers.BypassSandstormDamageArgs bypassArgs)
|
|
{
|
|
bypassArgs.Bypass = true;
|
|
}
|
|
}
|
|
} |