Files
PkmnLib.NET/Plugins/PkmnLib.Plugin.Gen7/Scripts/Weather/PrimordialSea.cs
Deukhoofd cc091d5327
Some checks failed
Build / Build (push) Failing after 35s
Update TUnit, warning cleanup
2026-07-05 13:46:57 +02:00

41 lines
1.2 KiB
C#

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