Implements burn
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user