2025-01-10 09:34:11 +00:00
|
|
|
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()
|
|
|
|
{
|
|
|
|
}
|
2025-03-02 16:19:57 +00:00
|
|
|
|
2025-01-10 09:34:11 +00:00
|
|
|
public HealEachEndOfTurnEffect(float healPercentage, IPokemon pokemon)
|
|
|
|
{
|
|
|
|
_healPercentage = healPercentage;
|
|
|
|
_pokemon = pokemon;
|
|
|
|
}
|
|
|
|
|
2025-01-10 11:16:29 +00:00
|
|
|
/// <param name="battle"></param>
|
2025-01-10 09:34:11 +00:00
|
|
|
/// <inheritdoc />
|
2025-01-10 11:16:29 +00:00
|
|
|
public override void OnEndTurn(IBattle battle)
|
2025-01-10 09:34:11 +00:00
|
|
|
{
|
|
|
|
if (_pokemon is null)
|
|
|
|
return;
|
|
|
|
if (_pokemon.BattleData?.IsOnBattlefield != true)
|
|
|
|
return;
|
2025-03-02 16:19:57 +00:00
|
|
|
|
2025-01-10 09:34:11 +00:00
|
|
|
var amount = _pokemon.BoostedStats.Hp * _healPercentage;
|
|
|
|
if (_pokemon.HasHeldItem("big_root"))
|
|
|
|
amount *= 1.3f;
|
|
|
|
_pokemon.Heal((uint)amount);
|
|
|
|
}
|
|
|
|
}
|