Finishes the last few moves
All checks were successful
Build / Build (push) Successful in 49s

This commit is contained in:
2025-05-18 12:20:21 +02:00
parent 3a9123b5ba
commit 9ff4745c0a
19 changed files with 585 additions and 27 deletions

View File

@@ -0,0 +1,39 @@
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.Sunny>() &&
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;
}
}