28 lines
897 B
C#
28 lines
897 B
C#
using System.Collections.Generic;
|
|
|
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
|
|
|
[Script(ScriptCategory.Pokemon, "powder")]
|
|
public class PowderEffect : Script
|
|
{
|
|
/// <inheritdoc />
|
|
/// <inheritdoc />
|
|
public override void BlockOutgoingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
|
{
|
|
var hit = executingMove.GetHitData(target, hitIndex);
|
|
if (hit.Type?.Name == "fire")
|
|
{
|
|
executingMove.User.BattleData?.Battle.EventHook.Invoke(new DialogEvent("powder_explodes",
|
|
new Dictionary<string, object>
|
|
{
|
|
{ "user", executingMove.User },
|
|
{ "target", target },
|
|
}));
|
|
|
|
var health = executingMove.User.MaxHealth / 4;
|
|
executingMove.User.Damage(health, DamageSource.Misc);
|
|
|
|
block = true;
|
|
}
|
|
}
|
|
} |