using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
///
/// Implements the secondary effect of Thrash, which forces the user to continue using the move for 2-3 turns,
/// then confuses the user.
///
[Script(ScriptCategory.Move, "thrash")]
public class Thrash : Script
{
///
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
if (move.User.Volatile.Contains())
return;
var battleData = move.User.BattleData;
if (battleData == null)
return;
var turns = battleData.Battle.Random.GetBool() ? 2 : 3;
move.User.Volatile.Add(new ThrashEffect(move.User, turns, move.MoveChoice.TargetSide,
move.MoveChoice.TargetPosition));
}
}