28 lines
935 B
C#
28 lines
935 B
C#
using PkmnLib.Plugin.Gen7.Scripts.Weather;
|
|
using PkmnLib.Static.Utils;
|
|
|
|
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<Sunny>())
|
|
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);
|
|
}
|
|
} |