27 lines
995 B
C#
27 lines
995 B
C#
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|
|
|
/// <summary>
|
|
/// Snow Cloak is an ability that raises the Pokémon's evasion during hail.
|
|
///
|
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Snow_Cloak_(Ability)">Bulbapedia - Snow Cloak</see>
|
|
/// </summary>
|
|
[Script(ScriptCategory.Ability, "snow_cloak")]
|
|
public class SnowCloak : Script
|
|
{
|
|
/// <inheritdoc />
|
|
public override void ChangeIncomingAccuracy(IExecutingMove executingMove, IPokemon target, byte hitIndex,
|
|
ref int modifiedAccuracy)
|
|
{
|
|
// If the weather is hail, increase evasion by 20%
|
|
if (executingMove.Battle.WeatherName == ScriptUtils.ResolveName<Weather.Hail>())
|
|
{
|
|
modifiedAccuracy = (int)(modifiedAccuracy * 0.8f);
|
|
}
|
|
}
|
|
|
|
public override void CustomTrigger(StringKey eventName, ICustomTriggerArgs args)
|
|
{
|
|
if (eventName == CustomTriggers.IgnoreHail && args is CustomTriggers.IgnoreHailArgs hailArgs)
|
|
hailArgs.Ignore = true;
|
|
}
|
|
} |