using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Plugin.Gen7.Scripts.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "secret_power")]
public class SecretPower : Script
{
///
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var environmentCategory = move.Battle.GetEnvironmentCategory();
switch (environmentCategory)
{
case EnvironmentHelper.EnvironmentCategory.Electric:
case EnvironmentHelper.EnvironmentCategory.Normal:
target.SetStatus(ScriptUtils.ResolveName(), move.User);
break;
case EnvironmentHelper.EnvironmentCategory.Rock:
target.Volatile.Add(new FlinchEffect());
break;
case EnvironmentHelper.EnvironmentCategory.Ground:
target.ChangeStatBoost(Statistic.Accuracy, -1, false, false);
break;
case EnvironmentHelper.EnvironmentCategory.Water:
target.ChangeStatBoost(Statistic.Attack, -1, false, false);
break;
case EnvironmentHelper.EnvironmentCategory.Ice:
target.SetStatus(ScriptUtils.ResolveName(), move.User);
break;
case EnvironmentHelper.EnvironmentCategory.Grass:
target.SetStatus(ScriptUtils.ResolveName(), move.User);
break;
case EnvironmentHelper.EnvironmentCategory.Fairy:
target.ChangeStatBoost(Statistic.SpecialAttack, -1, false, false);
break;
case EnvironmentHelper.EnvironmentCategory.Psychic:
target.ChangeStatBoost(Statistic.Speed, -1, false, false);
break;
// ReSharper disable once RedundantEmptySwitchSection
default:
// No effect for unrecognized environments
break;
}
}
}