This commit is contained in:
29
Plugins/PkmnLib.Plugin.Gen7/Scripts/Weather/PrimordialSea.cs
Normal file
29
Plugins/PkmnLib.Plugin.Gen7/Scripts/Weather/PrimordialSea.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Weather;
|
||||
|
||||
[Script(ScriptCategory.Weather, "primordial_sea")]
|
||||
public class PrimordialSea : Script
|
||||
{
|
||||
private HashSet<IPokemon> _placers = new();
|
||||
|
||||
public void MarkAsPlaced(IPokemon pokemon)
|
||||
{
|
||||
_placers.Add(pokemon);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchOut(IPokemon oldPokemon, byte position)
|
||||
{
|
||||
_placers.Remove(oldPokemon);
|
||||
if (_placers.Count == 0)
|
||||
oldPokemon.BattleData?.Battle.SetWeather(null, 0);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void PreventWeatherChange(StringKey? weatherName, ref bool preventWeatherChange)
|
||||
{
|
||||
if (weatherName == ScriptUtils.ResolveName<DesolateLands>() ||
|
||||
weatherName == ScriptUtils.ResolveName<StrongWinds>())
|
||||
return;
|
||||
preventWeatherChange = true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user