26 lines
1007 B
C#
26 lines
1007 B
C#
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, IScriptOnSecondaryEffect
|
|
{
|
|
/// <inheritdoc />
|
|
public 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, false, evtBatch);
|
|
var specialAttackChanged = target.ChangeStatBoost(Statistic.SpecialAttack, -1, false, false, evtBatch);
|
|
|
|
if (attackChanged || specialAttackChanged)
|
|
{
|
|
battleData.BattleSide.SwapPokemon(battleData.Position, null);
|
|
}
|
|
}
|
|
} |