using PkmnLib.Plugin.Gen7.Scripts.Utils; namespace PkmnLib.Plugin.Gen7.Scripts.Moves; [Script(ScriptCategory.Move, "nature_power")] public class NaturePower : Script, IScriptChangeMove { /// public void ChangeMove(IMoveChoice choice, ref StringKey moveName) { var battleData = choice.User; if (battleData is null) return; var newMoveName = GetMoveName(battleData.Battle); if (newMoveName is null) { choice.Fail(); return; } moveName = newMoveName.Value; } private static StringKey? GetMoveName(IBattle battle) { var movesLibrary = battle.Library.StaticLibrary.Moves; var environmentCategory = battle.GetEnvironmentCategory(); var moveName = environmentCategory switch { EnvironmentHelper.EnvironmentCategory.Electric when movesLibrary.TryGet(MoveNames.Thunderbolt, out var thunderboltMove) => (StringKey?)thunderboltMove.Name, EnvironmentHelper.EnvironmentCategory.Fairy when movesLibrary.TryGet(MoveNames.Moonblast, out var moonblastMove) => moonblastMove.Name, EnvironmentHelper.EnvironmentCategory.Grass when movesLibrary.TryGet(MoveNames.EnergyBall, out var energyballMove) => energyballMove.Name, EnvironmentHelper.EnvironmentCategory.Psychic when movesLibrary.TryGet(MoveNames.Psychic, out var psychicMove) => psychicMove.Name, EnvironmentHelper.EnvironmentCategory.Rock when movesLibrary.TryGet(MoveNames.PowerGem, out var rockMove) => rockMove.Name, EnvironmentHelper.EnvironmentCategory.Ground when movesLibrary.TryGet(MoveNames.EarthPower, out var groundMove) => groundMove.Name, EnvironmentHelper.EnvironmentCategory.Ice when movesLibrary.TryGet(MoveNames.IceBeam, out var iceMove) => iceMove.Name, EnvironmentHelper.EnvironmentCategory.Water when movesLibrary.TryGet(MoveNames.HydroPump, out var waterMove) => waterMove.Name, EnvironmentHelper.EnvironmentCategory.Normal when movesLibrary.TryGet(MoveNames.TriAttack, out var normalMove) => normalMove.Name, _ => null, }; return moveName; } }