This commit is contained in:
36
Plugins/PkmnLib.Plugin.Gen7/Scripts/Weather/DesolateLands.cs
Normal file
36
Plugins/PkmnLib.Plugin.Gen7/Scripts/Weather/DesolateLands.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Weather;
|
||||
|
||||
[Script(ScriptCategory.Weather, "desolate_lands")]
|
||||
public class DesolateLands : HarshSunlight
|
||||
{
|
||||
private readonly HashSet<IPokemon> _placers = [];
|
||||
|
||||
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<PrimordialSea>() ||
|
||||
weatherName == ScriptUtils.ResolveName<StrongWinds>())
|
||||
return;
|
||||
preventWeatherChange = true;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void FailMove(IExecutingMove move, ref bool fail)
|
||||
{
|
||||
if (move.UseMove.MoveType.Name == "water")
|
||||
fail = true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user