namespace PkmnLib.Plugin.Gen7.Scripts.Weather; [Script(ScriptCategory.Weather, "desolate_lands")] public class DesolateLands : HarshSunlight, IScriptFailMove, IScriptOnEndTurn { private readonly HashSet _placers = []; public void MarkAsPlaced(IPokemon pokemon) { _placers.Add(pokemon); } /// public override void OnSwitchOut(IPokemon oldPokemon, byte position) { _placers.Remove(oldPokemon); if (_placers.Count == 0) oldPokemon.BattleData?.Battle.SetWeather(null, 0); } /// public override void PreventWeatherChange(StringKey? weatherName, ref bool preventWeatherChange) { if (weatherName == ScriptUtils.ResolveName() || weatherName == ScriptUtils.ResolveName()) return; preventWeatherChange = true; } /// public void FailMove(IExecutingMove move, ref bool fail) { if (move.UseMove.MoveType.Name == "water") fail = true; } /// public void OnEndTurn(IScriptSource owner, IBattle battle) { // We don't want to call base.OnEndTurn here, as we want to prevent the weather from ending } }