36 lines
962 B
C#
36 lines
962 B
C#
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);
|
|
}
|
|
} |