Move itemscript back to using IPokemon instead of IBattlePokemon
All checks were successful
Build / Build (push) Successful in 3m24s
All checks were successful
Build / Build (push) Successful in 3m24s
This commit is contained in:
@@ -32,15 +32,17 @@ public abstract class PokeballScript : ItemScript
|
||||
public override ItemTargetType TargetType => ItemTargetType.FoePokemon;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool IsTargetValid(IBattlePokemon target) => target.Battle.IsWildBattle;
|
||||
public override bool IsTargetValid(IPokemon target) => target is IBattlePokemon { Battle: { IsWildBattle: true } };
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnUseWithTarget(IBattlePokemon target, EventHook eventHook)
|
||||
public override void OnUseWithTarget(IPokemon target, EventHook eventHook)
|
||||
{
|
||||
var result = target.Battle.AttempCapture(target.SideIndex, target.Position, Item);
|
||||
if (target is not IBattlePokemon battlePokemon)
|
||||
return;
|
||||
var result = battlePokemon.Battle.AttempCapture(battlePokemon.SideIndex, battlePokemon.Position, Item);
|
||||
if (result.IsCaught)
|
||||
{
|
||||
OnAfterSuccessfulCapture(target);
|
||||
OnAfterSuccessfulCapture(battlePokemon);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user