This commit is contained in:
39
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/WeatherBall.cs
Normal file
39
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/WeatherBall.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user