28 lines
829 B
C#
28 lines
829 B
C#
namespace PkmnLib.Plugin.Gen7.Scripts.Terrain;
|
|
|
|
[Script(ScriptCategory.Terrain, "misty_terrain")]
|
|
public class MistyTerrain : Script, IScriptChangeBasePower
|
|
{
|
|
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 override void PreventStatusChange(IPokemon pokemon, StringKey status, bool selfInflicted,
|
|
ref bool preventStatus)
|
|
{
|
|
if (!IsAffectedByTerrain(pokemon))
|
|
return;
|
|
preventStatus = true;
|
|
}
|
|
} |