PkmnLib.NET/Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/FlyingPress.cs

20 lines
735 B
C#
Raw Normal View History

2025-03-02 13:03:51 +00:00
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "flying_press")]
public class FlyingPress : Script
{
/// <inheritdoc />
public override void ChangeEffectiveness(IExecutingMove move, IPokemon target, byte hit, ref float effectiveness)
{
var battleData = move.User.BattleData;
if (battleData == null)
return;
var typeLibrary = battleData.Battle.Library.StaticLibrary.Types;
// If flying type is not found, return
if (!typeLibrary.TryGetTypeIdentifier("flying", out var flyingType))
return;
var flyingEffectiveness = typeLibrary.GetEffectiveness(flyingType, target.Types);
effectiveness *= flyingEffectiveness;
}
}