This commit is contained in:
@@ -3,5 +3,36 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Terrain;
|
||||
[Script(ScriptCategory.Terrain, "electric_terrain")]
|
||||
public class ElectricTerrain : Script
|
||||
{
|
||||
// TODO: Implement Terrain
|
||||
private static bool IsAffectedByTerrain(IPokemon pokemon) =>
|
||||
!pokemon.IsFloating;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
|
||||
{
|
||||
if (!IsAffectedByTerrain(move.User))
|
||||
return;
|
||||
var type = move.GetHitData(target, hit).Type;
|
||||
if (type?.Name == "electric")
|
||||
basePower = basePower.MultiplyOrMax(1.5f);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void PreventStatusChange(IPokemon pokemon, StringKey status, bool selfInflicted,
|
||||
ref bool preventStatus)
|
||||
{
|
||||
if (!IsAffectedByTerrain(pokemon))
|
||||
return;
|
||||
if (status == ScriptUtils.ResolveName<Status.Sleep>())
|
||||
preventStatus = true;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void PreventVolatileAdd(IScriptSource parent, Script script, ref bool preventVolatileAdd)
|
||||
{
|
||||
if (parent is IPokemon pokemon && !IsAffectedByTerrain(pokemon))
|
||||
return;
|
||||
|
||||
if (script is Pokemon.YawnEffect)
|
||||
preventVolatileAdd = true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user