More moves implemented
This commit is contained in:
31
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/DoomDesire.cs
Normal file
31
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/DoomDesire.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user