31 lines
1007 B
C#
31 lines
1007 B
C#
|
using System.Linq;
|
||
|
using PkmnLib.Plugin.Gen7.Scripts.Side;
|
||
|
|
||
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||
|
|
||
|
[Script(ScriptCategory.Move, "doom_desire")]
|
||
|
public class DoomDesire : Script
|
||
|
{
|
||
|
/// <inheritdoc />
|
||
|
public override void BlockOutgoingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
||
|
{
|
||
|
var battleData = target.BattleData;
|
||
|
if (battleData == null)
|
||
|
return;
|
||
|
var side = battleData.Battle.Sides[battleData.SideIndex];
|
||
|
var effect = side.VolatileScripts.Get<DoomDesireEffect>();
|
||
|
if (effect != null && effect.HasTarget(battleData.Position))
|
||
|
{
|
||
|
executingMove.GetHitData(target, hitIndex).Fail();
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if (effect == null)
|
||
|
{
|
||
|
effect = new DoomDesireEffect(side);
|
||
|
side.VolatileScripts.Add(effect);
|
||
|
}
|
||
|
effect.AddTarget(battleData.Position, executingMove.GetHitData(target, hitIndex).Damage);
|
||
|
block = true;
|
||
|
}
|
||
|
}
|