Implements burn
This commit is contained in:
parent
eea5697109
commit
0d03a8f28d
@ -30,4 +30,9 @@ public enum DamageSource
|
||||
/// The damage is done because of the weather.
|
||||
/// </summary>
|
||||
Weather = 4,
|
||||
|
||||
/// <summary>
|
||||
/// The damage is done because of a status condition.
|
||||
/// </summary>
|
||||
Status = 5,
|
||||
}
|
@ -7,6 +7,11 @@ namespace PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
/// </summary>
|
||||
public interface IPlugin
|
||||
{
|
||||
/// <summary>
|
||||
/// The configuration for the plugin. This is used to pass in any configuration options.
|
||||
/// </summary>
|
||||
IPluginConfiguration Configuration { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the plugin. Mostly used for debugging purposes.
|
||||
/// </summary>
|
||||
@ -28,9 +33,10 @@ public interface IPlugin
|
||||
[UsedImplicitly(ImplicitUseTargetFlags.WithInheritors)]
|
||||
public abstract class Plugin<TConfiguration> : IPlugin where TConfiguration : IPluginConfiguration
|
||||
{
|
||||
/// <summary>
|
||||
/// The configuration for the plugin. This is used to pass in any configuration options.
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
IPluginConfiguration IPlugin.Configuration => Configuration;
|
||||
|
||||
/// <inheritdoc cref="IPlugin.Configuration"/>
|
||||
public TConfiguration Configuration { get; }
|
||||
|
||||
/// <inheritdoc cref="Plugin{TConfiguration}"/>
|
||||
|
@ -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;
|
||||
|
||||
/// <inheritdoc />
|
||||
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;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
if (move.UseMove.Category == MoveCategory.Physical)
|
||||
{
|
||||
damage = (uint)(damage / 2f);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IBattle battle)
|
||||
{
|
||||
if (_target == null)
|
||||
return;
|
||||
var damage = (uint)(_target.MaxHealth / 16f);
|
||||
_target.Damage(damage, DamageSource.Status);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user