Items can be used on Pokemon outside of battle, and we want the user of the library to be able to check for what changed. This allows for example a heal event to be sent back to the user of the library after using an item.
This commit is contained in:
7 files changed
+21
-17
No files matched your search
@@ -1,3 +1,4 @@
|
||||
using PkmnLib.Dynamic.Events;
|
||||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Static;
|
||||
|
||||
@@ -19,12 +20,10 @@ public abstract class PokeballScript : ItemScript
|
||||
public abstract byte GetCatchRate(IPokemon target);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnUseWithTarget(IPokemon target)
|
||||
public override void OnUseWithTarget(IPokemon target, EventHook eventHook)
|
||||
{
|
||||
var battleData = target.BattleData;
|
||||
if (battleData == null)
|
||||
return;
|
||||
|
||||
battleData.Battle.AttempCapture(battleData.SideIndex, battleData.Position, Item);
|
||||
battleData?.Battle.AttempCapture(battleData.SideIndex, battleData.Position, Item);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user