More move scripts

This commit is contained in:
2025-01-10 10:34:11 +01:00
parent 4584185a42
commit 85ea31f7cd
7 changed files with 165 additions and 1 deletions

View File

@@ -0,0 +1,36 @@
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "heal_each_end_of_turn_effect")]
public class HealEachEndOfTurnEffect : Script
{
private readonly float _healPercentage;
private readonly IPokemon? _pokemon;
private HealEachEndOfTurnEffect()
{
}
public HealEachEndOfTurnEffect(float healPercentage, IPokemon pokemon)
{
_healPercentage = healPercentage;
_pokemon = pokemon;
}
/// <inheritdoc />
public override void OnEndTurn()
{
if (_pokemon is null)
return;
if (_pokemon.BattleData?.IsOnBattlefield != true)
return;
var amount = _pokemon.BoostedStats.Hp * _healPercentage;
if (_pokemon.HasHeldItem("big_root"))
amount *= 1.3f;
_pokemon.Heal((uint)amount);
}
}