29 lines
954 B
C#
29 lines
954 B
C#
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|
|
|
/// <summary>
|
|
/// Sand Rush is an ability that doubles the Pokémon's Speed during a sandstorm.
|
|
///
|
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Sand_Rush_(Ability)">Bulbapedia - Sand Rush</see>
|
|
/// </summary>
|
|
[Script(ScriptCategory.Ability, "sand_rush")]
|
|
public class SandRush : Script, IScriptChangeSpeed
|
|
{
|
|
/// <inheritdoc />
|
|
public void ChangeSpeed(ITurnChoice choice, ref uint speed)
|
|
{
|
|
if (choice.User.BattleData?.Battle.WeatherName == ScriptUtils.ResolveName<Weather.Sandstorm>())
|
|
{
|
|
speed = speed.MultiplyOrMax(2);
|
|
}
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public override void CustomTrigger(StringKey eventName, ICustomTriggerArgs args)
|
|
{
|
|
if (eventName == CustomTriggers.BypassSandstormDamage &&
|
|
args is CustomTriggers.BypassSandstormDamageArgs bypassArgs)
|
|
{
|
|
bypassArgs.Bypass = true;
|
|
}
|
|
}
|
|
} |