Files
PkmnLib.NET/Plugins/PkmnLib.Plugin.Gen7/Scripts/Terrain/MistyTerrain.cs
Deukhoofd d2a82b5fe3
All checks were successful
Build / Build (push) Successful in 3m12s
Many more tests and fixes
2026-08-27 17:11:12 +02:00

35 lines
1.1 KiB
C#

using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Terrain;
[Script(ScriptCategory.Terrain, "misty_terrain")]
public class MistyTerrain : Script, IScriptChangeBasePower, IScriptPreventStatusChange, IScriptPreventVolatileAdd
{
private static bool IsAffectedByTerrain(IPokemon pokemon) =>
!pokemon.IsFloating;
/// <inheritdoc />
public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
if (!IsAffectedByTerrain(target))
return;
if (move.GetHitData(target, hit).Type?.Name == "dragon")
{
basePower /= 2;
}
}
/// <inheritdoc />
public void PreventStatusChange(IPokemon pokemon, StringKey status, bool selfInflicted, ref bool preventStatus)
{
if (!IsAffectedByTerrain(pokemon))
return;
preventStatus = true;
}
public void PreventVolatileAdd(IScriptSource parent, Script script, ref bool preventVolatileAdd)
{
if (script.Name == ScriptUtils.ResolveName<Confusion>())
preventVolatileAdd = true;
}
}