30 lines
793 B
C#
30 lines
793 B
C#
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
|
|
|
[Script(ScriptCategory.Pokemon, "lock_on")]
|
|
public class LockOnEffect : Script, IScriptOnEndTurn, IScriptChangeIncomingAccuracy
|
|
{
|
|
private readonly IBattlePokemon _placer;
|
|
private bool _hasHadEndTurn;
|
|
|
|
public LockOnEffect(IBattlePokemon placer)
|
|
{
|
|
_placer = placer;
|
|
}
|
|
|
|
public void ChangeIncomingAccuracy(IExecutingMove executingMove, IBattlePokemon target, byte hitIndex,
|
|
ref int modifiedAccuracy)
|
|
{
|
|
if (_placer != executingMove.User)
|
|
return;
|
|
modifiedAccuracy = 255;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
|
{
|
|
if (_hasHadEndTurn)
|
|
RemoveSelf();
|
|
else
|
|
_hasHadEndTurn = true;
|
|
}
|
|
} |