Deukhoofd 02510fd1d0
All checks were successful
Build / Build (push) Successful in 50s
Implements sandstorm
2025-06-22 10:53:56 +02:00

34 lines
1.2 KiB
C#

namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <summary>
/// Sand Force is an ability that boosts the power of Rock, Ground, and Steel-type moves in a sandstorm.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Sand_Force_(Ability)">Bulbapedia - Sand Force</see>
/// </summary>
[Script(ScriptCategory.Ability, "sand_force")]
public class SandForce : Script
{
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
if (move.Battle.WeatherName == ScriptUtils.ResolveName<Weather.Sandstorm>())
{
var type = move.GetHitData(target, hit).Type;
if (type != null &&
(type.Value.Name == "rock" || type.Value.Name == "ground" || type.Value.Name == "steel"))
{
basePower = basePower.MultiplyOrMax(1.3f);
}
}
}
/// <inheritdoc />
public override void CustomTrigger(StringKey eventName, ICustomTriggerArgs args)
{
if (eventName == CustomTriggers.BypassSandstormDamage &&
args is CustomTriggers.BypassSandstormDamageArgs bypassArgs)
{
bypassArgs.Bypass = true;
}
}
}