Deukhoofd 2533512eda
All checks were successful
Build / Build (push) Successful in 51s
Slight cleanup, do some TODOs
2025-06-22 10:42:25 +02:00

37 lines
1.4 KiB
C#

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;
}
}