Make another pass through moves file
All checks were successful
Build / Build (push) Successful in 47s
All checks were successful
Build / Build (push) Successful in 47s
This commit is contained in:
53
Plugins/PkmnLib.Plugin.Gen7/Scripts/Battle/UproarEffect.cs
Normal file
53
Plugins/PkmnLib.Plugin.Gen7/Scripts/Battle/UproarEffect.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
|
||||
|
||||
[Script(ScriptCategory.Battle, "uproar_effect")]
|
||||
public class UproarEffect : Script
|
||||
{
|
||||
private IPokemon? _placer;
|
||||
private bool _hasUsedUproar;
|
||||
private int _turns = 3;
|
||||
|
||||
public void SetPlacer(IPokemon placer)
|
||||
{
|
||||
_placer = placer;
|
||||
_hasUsedUproar = true;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void PreventStatusChange(IPokemon pokemonImpl, StringKey status, ref bool preventStatus)
|
||||
{
|
||||
if (status == ScriptUtils.ResolveName<Status.Sleep>())
|
||||
{
|
||||
preventStatus = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnBeforeTurnStart(ITurnChoice choice)
|
||||
{
|
||||
_hasUsedUproar = false;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
if (move.User == _placer && move.UseMove.Name == "uproar")
|
||||
_hasUsedUproar = true;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IBattle battle)
|
||||
{
|
||||
if (!_hasUsedUproar)
|
||||
{
|
||||
RemoveSelf();
|
||||
}
|
||||
_turns--;
|
||||
if (_turns <= 0)
|
||||
{
|
||||
RemoveSelf();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user