More moves
This commit is contained in:
28
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/PartingShot.cs
Normal file
28
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/PartingShot.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using PkmnLib.Static;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
/// <summary>
|
||||
/// Implements the secondary effect of Parting Shot, which lowers the target's Attack and Special Attack by one stage each,
|
||||
/// then forces the user to switch out if at least one stat change was successful.
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Move, "parting_shot")]
|
||||
public class PartingShot : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
var battleData = move.User.BattleData;
|
||||
if (battleData == null)
|
||||
return;
|
||||
|
||||
var evtBatch = new EventBatchId();
|
||||
var attackChanged = target.ChangeStatBoost(Statistic.Attack, -1, false, evtBatch);
|
||||
var specialAttackChanged = target.ChangeStatBoost(Statistic.SpecialAttack, -1, false, evtBatch);
|
||||
|
||||
if (attackChanged || specialAttackChanged)
|
||||
{
|
||||
battleData.BattleSide.SwapPokemon(battleData.Position, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user