using PkmnLib.Plugin.Gen7.Scripts.Weather;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "moonlight")]
public class Moonlight : Script, IScriptOnSecondaryEffect
{
///
public 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())
fraction = 2f / 3f;
else if (weather == ScriptUtils.ResolveName() || weather == ScriptUtils.ResolveName() ||
weather == ScriptUtils.ResolveName())
fraction = 0.25f;
var maxHp = target.BoostedStats.Hp;
var healAmount = maxHp.MultiplyOrMax(fraction);
move.User.Heal(healAmount);
}
}