Implement most pokeballs
All checks were successful
Build / Build (push) Successful in 1m2s

This commit is contained in:
2025-07-20 11:15:45 +02:00
parent db3f7f2403
commit 77d7b86a3c
19 changed files with 452 additions and 38 deletions

View File

@@ -106,7 +106,7 @@ public interface IPokemon : IScriptSource, IDeepCloneable
/// <summary>
/// The happiness of the Pokemon. Also known as friendship.
/// </summary>
byte Happiness { get; }
byte Happiness { get; set; }
/// <summary>
/// The stats of the Pokemon when disregarding any stat boosts.
@@ -708,7 +708,7 @@ public class PokemonImpl : ScriptSource, IPokemon
public float HeightInMeters { get; set; }
/// <inheritdoc />
public byte Happiness { get; }
public byte Happiness { get; set; }
/// <inheritdoc />
public StatisticSet<uint> FlatStats { get; } = new();

View File

@@ -17,13 +17,23 @@ public abstract class PokeballScript : ItemScript
/// <summary>
/// Returns the catch rate of the Pokéball against the given target Pokémon.
/// </summary>
public abstract byte GetCatchRate(IPokemon target);
public abstract void ChangeCatchRate(IPokemon target, ref byte catchRate);
public virtual void OnAfterSuccessfulCapture(IPokemon target)
{
// Default implementation does nothing.
// Override this method in derived classes to add custom behavior after a successful capture.
}
/// <inheritdoc />
public override void OnUseWithTarget(IPokemon target, EventHook eventHook)
{
var battleData = target.BattleData;
battleData?.Battle.AttempCapture(battleData.SideIndex, battleData.Position, Item);
var result = battleData?.Battle.AttempCapture(battleData.SideIndex, battleData.Position, Item);
if (result is { IsCaught: true })
{
OnAfterSuccessfulCapture(target);
}
}
}