This commit is contained in:
@@ -3,5 +3,34 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Terrain;
|
||||
[Script(ScriptCategory.Terrain, "psychic_terrain")]
|
||||
public class PsychicTerrain : 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;
|
||||
|
||||
// It boosts the power of Psychic-type moves used by affected Pokémon by 50% (regardless of whether the target of
|
||||
// the move is affected by Psychic Terrain).
|
||||
var type = move.GetHitData(target, hit).Type;
|
||||
if (type?.Name == "psychic")
|
||||
{
|
||||
basePower = basePower.MultiplyOrMax(1.5f);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void IsInvulnerableToMove(IExecutingMove move, IPokemon target, ref bool invulnerable)
|
||||
{
|
||||
if (!IsAffectedByTerrain(target))
|
||||
return;
|
||||
|
||||
// Psychic Terrain prevents priority moves from affecting affected Pokémon.
|
||||
if (move.MoveChoice.Priority > 0)
|
||||
{
|
||||
invulnerable = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user