Support for Bide
This commit is contained in:
30
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Bide.cs
Normal file
30
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Bide.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System.Linq;
|
||||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "bide")]
|
||||
public class Bide : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
var bideEffect = move.User.Volatile.Get<BideEffect>();
|
||||
if (bideEffect == null)
|
||||
{
|
||||
bideEffect = new BideEffect(move.User);
|
||||
move.User.Volatile.Add(bideEffect);
|
||||
}
|
||||
|
||||
bideEffect.Turns += 1;
|
||||
if (bideEffect.Turns < 2)
|
||||
return;
|
||||
var lastPokemon = bideEffect.HitBy.LastOrDefault(x => x.BattleData?.IsOnBattlefield == true);
|
||||
lastPokemon?.Damage(bideEffect.DamageTaken, DamageSource.MoveDamage);
|
||||
|
||||
RemoveSelf();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user