This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user