Deukhoofd 7c270a6d52
All checks were successful
Build / Build (push) Successful in 1m1s
Finish script interface refactor
2025-07-06 10:27:56 +02:00

27 lines
840 B
C#

namespace PkmnLib.Plugin.Gen7.Scripts.Terrain;
[Script(ScriptCategory.Terrain, "misty_terrain")]
public class MistyTerrain : Script, IScriptChangeBasePower, IScriptPreventStatusChange
{
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;
}
}