diff --git a/PkmnLib.Dynamic/Models/DamageSource.cs b/PkmnLib.Dynamic/Models/DamageSource.cs index 5ed2a0d..8435b62 100644 --- a/PkmnLib.Dynamic/Models/DamageSource.cs +++ b/PkmnLib.Dynamic/Models/DamageSource.cs @@ -30,4 +30,9 @@ public enum DamageSource /// The damage is done because of the weather. /// Weather = 4, + + /// + /// The damage is done because of a status condition. + /// + Status = 5, } \ No newline at end of file diff --git a/PkmnLib.Dynamic/ScriptHandling/Registry/Plugin.cs b/PkmnLib.Dynamic/ScriptHandling/Registry/Plugin.cs index 828ba29..f003b72 100644 --- a/PkmnLib.Dynamic/ScriptHandling/Registry/Plugin.cs +++ b/PkmnLib.Dynamic/ScriptHandling/Registry/Plugin.cs @@ -7,6 +7,11 @@ namespace PkmnLib.Dynamic.ScriptHandling.Registry; /// public interface IPlugin { + /// + /// The configuration for the plugin. This is used to pass in any configuration options. + /// + IPluginConfiguration Configuration { get; } + /// /// The name of the plugin. Mostly used for debugging purposes. /// @@ -28,9 +33,10 @@ public interface IPlugin [UsedImplicitly(ImplicitUseTargetFlags.WithInheritors)] public abstract class Plugin : IPlugin where TConfiguration : IPluginConfiguration { - /// - /// The configuration for the plugin. This is used to pass in any configuration options. - /// + /// + IPluginConfiguration IPlugin.Configuration => Configuration; + + /// public TConfiguration Configuration { get; } /// diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Status/Burned.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Status/Burned.cs index 095f13c..82ab36a 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Status/Burned.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Status/Burned.cs @@ -1,7 +1,35 @@ +using PkmnLib.Static.Moves; + namespace PkmnLib.Plugin.Gen7.Scripts.Status; [Script(ScriptCategory.Status, "burned")] public class Burned : Script { - // TODO: Implement the Burned status effect. + private IPokemon? _target; + + /// + public override void OnAddedToParent(IScriptSource source) + { + if (source is not IPokemon pokemon) + throw new ArgumentException("Burned script can only be added to a Pokemon"); + _target = pokemon; + } + + /// + public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage) + { + if (move.UseMove.Category == MoveCategory.Physical) + { + damage = (uint)(damage / 2f); + } + } + + /// + public override void OnEndTurn(IBattle battle) + { + if (_target == null) + return; + var damage = (uint)(_target.MaxHealth / 16f); + _target.Damage(damage, DamageSource.Status); + } } \ No newline at end of file