More abilities
All checks were successful
Build / Build (push) Successful in 50s

This commit is contained in:
Deukhoofd 2025-06-13 12:56:47 +02:00
parent 8363b955af
commit 4385f0afaa
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
10 changed files with 207 additions and 9 deletions

View File

@ -397,15 +397,33 @@
"no_guard": {
"effect": "no_guard"
},
"normalize": {},
"oblivious": {},
"overcoat": {},
"overgrow": {},
"own_tempo": {},
"parental_bond": {},
"pickpocket": {},
"pickup": {},
"pixilate": {},
"normalize": {
"effect": "normalize"
},
"oblivious": {
"effect": "oblivious"
},
"overcoat": {
"effect": "overcoat"
},
"overgrow": {
"effect": "overgrow"
},
"own_tempo": {
"effect": "own_tempo"
},
"parental_bond": {
"effect": "parental_bond"
},
"pickpocket": {
"effect": "pickpocket"
},
"pickup": {
"effect": "pickup"
},
"pixilate": {
"effect": "pixilate"
},
"plus": {},
"poison_heal": {},
"poison_point": {},

View File

@ -0,0 +1,25 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <summary>
/// Normalize is an ability that changes all moves used by the Pokémon to Normal type.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Normalize_(Ability)">Bulbapedia - Normalize</see>
/// </summary>
[Script(ScriptCategory.Ability, "normalize")]
public class Normalize : Script
{
/// <inheritdoc />
public override void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit,
ref TypeIdentifier? typeIdentifier)
{
if (move.Battle.Library.StaticLibrary.Types.TryGetTypeIdentifier("normal", out var normalType))
typeIdentifier = normalType;
}
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
if (move.GetHitData(target, hit).Type?.Name == "normal")
basePower = (ushort)(basePower * 1.2f); // Boost Normal-type moves by 30%
}
}

View File

@ -0,0 +1,22 @@
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <summary>
/// Oblivious is an ability that prevents the Pokémon from being infatuated or taunted.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Oblivious_(Ability)">Bulbapedia - Oblivious</see>
/// </summary>
[Script(ScriptCategory.Ability, "oblivious")]
public class Oblivious : Script
{
/// <inheritdoc />
public override void PreventVolatileAdd(Script script, ref bool preventVolatileAdd)
{
preventVolatileAdd = script switch
{
Infatuated or TauntEffect => true,
_ => preventVolatileAdd,
};
}
}

View File

@ -0,0 +1,29 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <summary>
/// Overcoat is an ability that protects the Pokémon from weather damage and powder moves.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Overcoat_(Ability)">Bulbapedia - Overcoat</see>
/// </summary>
[Script(ScriptCategory.Ability, "overcoat")]
public class Overcoat : Script
{
/// <inheritdoc />
public override void CustomTrigger(StringKey eventName, ICustomTriggerArgs args)
{
if (eventName == CustomTriggers.IgnoreHail && args is CustomTriggers.IgnoreHailArgs hailArgs)
{
hailArgs.Ignore = true;
}
// TODO: Ignore sandstorm damage
}
/// <inheritdoc />
public override void IsInvulnerableToMove(IExecutingMove move, IPokemon target, ref bool invulnerable)
{
if (move.UseMove.HasFlag("powder"))
{
invulnerable = true;
}
}
}

View File

@ -0,0 +1,17 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <summary>
/// Overgrow is an ability that boosts the power of Grass-type moves when the Pokémon's HP is low.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Overgrow_(Ability)">Bulbapedia - Overgrow</see>
/// </summary>
[Script(ScriptCategory.Ability, "overgrow")]
public class Overgrow : Script
{
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
if (move.GetHitData(target, hit).Type?.Name == "grass" && target.CurrentHealth <= target.BoostedStats.Hp / 3)
basePower = basePower.MultiplyOrMax(1.5f);
}
}

View File

@ -0,0 +1,17 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <summary>
/// Own Tempo is an ability that prevents the Pokémon from becoming confused.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Own_Tempo_(Ability)">Bulbapedia - Own Tempo</see>
/// </summary>
[Script(ScriptCategory.Ability, "own_tempo")]
public class OwnTempo : Script
{
/// <inheritdoc />
public override void PreventVolatileAdd(Script script, ref bool preventVolatileAdd)
{
if (script is Pokemon.Confusion)
preventVolatileAdd = true;
}
}

View File

@ -0,0 +1,12 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <summary>
/// Parental Bond is an ability that allows the Pokémon to hit twice with most moves.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Parental_Bond_(Ability)">Bulbapedia - Parental Bond</see>
/// </summary>
[Script(ScriptCategory.Ability, "parental_bond")]
public class ParentalBond : Script
{
// TODO: Implement Parental Bond effect.
}

View File

@ -0,0 +1,20 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <summary>
/// Pickpocket is an ability that steals an item from a Pokémon that makes contact.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Pickpocket_(Ability)">Bulbapedia - Pickpocket</see>
/// </summary>
[Script(ScriptCategory.Ability, "pickpocket")]
public class Pickpocket : Script
{
/// <inheritdoc />
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{
if (move.GetHitData(target, hit).IsContact && target.HeldItem is null && move.User.HeldItem is not null)
{
move.Battle.EventHook.Invoke(new AbilityTriggerEvent(target));
_ = target.SetHeldItem(move.User.RemoveHeldItemForBattle());
}
}
}

View File

@ -0,0 +1,12 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <summary>
/// Pickup is an ability that allows the Pokémon to pick up items after battle.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Pickup_(Ability)">Bulbapedia - Pickup</see>
/// </summary>
[Script(ScriptCategory.Ability, "pickup")]
public class Pickup : Script
{
// TODO: Implement Pickup effect.
}

View File

@ -0,0 +1,26 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <summary>
/// Pixilate is an ability that turns Normal-type moves into Fairy-type moves and boosts their power.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Pixilate_(Ability)">Bulbapedia - Pixilate</see>
/// </summary>
[Script(ScriptCategory.Ability, "pixilate")]
public class Pixilate : Script
{
/// <inheritdoc />
public override void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit,
ref TypeIdentifier? typeIdentifier)
{
if (typeIdentifier?.Name == "normal" &&
move.Battle.Library.StaticLibrary.Types.TryGetTypeIdentifier("fairy", out var fairyType))
typeIdentifier = fairyType;
}
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
if (move.GetHitData(target, hit).Type?.Name == "fairy")
basePower = (ushort)(basePower * 1.2f); // Boost Normal-type moves by 30%
}
}