This commit is contained in:
27
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/SnowCloak.cs
Normal file
27
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/SnowCloak.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user