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

27 lines
915 B
C#

using PkmnLib.Plugin.Gen7.Scripts.Weather;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "moonlight")]
public class Moonlight : Script
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var battleData = move.User.BattleData;
if (battleData == null)
return;
var fraction = 0.5f;
var weather = battleData.Battle.WeatherName;
if (weather == ScriptUtils.ResolveName<HarshSunlight>())
fraction = 2f / 3f;
else if (weather == ScriptUtils.ResolveName<Rain>() || weather == ScriptUtils.ResolveName<Hail>() ||
weather == ScriptUtils.ResolveName<Sandstorm>())
fraction = 0.25f;
var maxHp = target.BoostedStats.Hp;
var healAmount = maxHp.MultiplyOrMax(fraction);
move.User.Heal(healAmount);
}
}