Deukhoofd 00005aa4bf
All checks were successful
Build / Build (push) Successful in 47s
Implements more abilities
2025-06-09 12:10:25 +02:00

39 lines
1.5 KiB
C#

using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "weather_ball")]
public class WeatherBall : Script
{
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
if (move.Battle.WeatherName is not null)
{
basePower = basePower.MultiplyOrMax(2);
}
}
/// <inheritdoc />
public override void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit,
ref TypeIdentifier? typeIdentifier)
{
var weather = move.Battle.WeatherName;
var typeLibrary = move.Battle.Library.StaticLibrary.Types;
if (weather is null)
return;
if (weather == ScriptUtils.ResolveName<Weather.HarshSunlight>() &&
typeLibrary.TryGetTypeIdentifier("fire", out var fireType))
typeIdentifier = fireType;
else if (weather == ScriptUtils.ResolveName<Weather.Rain>() &&
typeLibrary.TryGetTypeIdentifier("water", out var waterType))
typeIdentifier = waterType;
else if (weather == ScriptUtils.ResolveName<Weather.Hail>() &&
typeLibrary.TryGetTypeIdentifier("ice", out var iceType))
typeIdentifier = iceType;
else if (weather == ScriptUtils.ResolveName<Weather.Sandstorm>() &&
typeLibrary.TryGetTypeIdentifier("rock", out var rockType))
typeIdentifier = rockType;
}
}