Make another pass through moves file
All checks were successful
Build / Build (push) Successful in 47s

This commit is contained in:
2025-05-18 14:15:37 +02:00
parent 9ff4745c0a
commit cbd4340b13
11 changed files with 322 additions and 17 deletions

View 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();
}
}
}

View File

@@ -0,0 +1,16 @@
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "feint")]
public class Feint : Script
{
/// <inheritdoc />
public override void OnBeforeHit(IExecutingMove move, IPokemon target, byte hitIndex)
{
if (target.Volatile.Contains<ProtectionEffectScript>())
{
target.Volatile.Remove<ProtectionEffectScript>();
}
}
}

View File

@@ -0,0 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "happy_hour")]
public class HappyHour : Script
{
// TODO: Implement Happy Hour
}

View File

@@ -8,10 +8,7 @@ public class IncreasedCriticalStage : Script
{
// Extreme edge case, should never happen
if (stage == byte.MaxValue)
{
move.GetHitData(target, hit).Fail();
return;
}
stage += 1;
}
}

View File

@@ -0,0 +1,25 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "magnetic_flux")]
public class MagneticFlux : Script
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var battleData = move.User.BattleData;
if (battleData is null)
return;
foreach (var pokemon in battleData.BattleSide.Pokemon.WhereNotNull())
{
if (pokemon.ActiveAbility?.Name != "plus" && pokemon.ActiveAbility?.Name != "minus")
continue;
EventBatchId batch = new();
pokemon.ChangeStatBoost(Statistic.Defense, 1, pokemon == move.User, batch);
pokemon.ChangeStatBoost(Statistic.SpecialDefense, 1, pokemon == move.User, batch);
}
}
}

View File

@@ -0,0 +1,27 @@
using PkmnLib.Plugin.Gen7.Scripts.Battle;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "uproar")]
public class Uproar : Script
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var battle = move.Battle;
foreach (var pokemon in battle.Sides.SelectMany(x => x.Pokemon).WhereNotNull())
{
if (pokemon.HasStatus(ScriptUtils.ResolveName<Status.Sleep>()))
{
pokemon.ClearStatus();
}
}
var script = battle.Volatile.Add(new UproarEffect());
if (script?.Script is UproarEffect uproarEffect)
{
uproarEffect.SetPlacer(move.User);
}
}
}

View File

@@ -2,6 +2,7 @@ using PkmnLib.Static.Moves;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "baneful_bunker")]
public class BanefulBunkerEffect : ProtectionEffectScript
{
/// <inheritdoc />

View File

@@ -1,5 +1,6 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "protect")]
public class ProtectionEffectScript : Script
{
/// <inheritdoc />

View File

@@ -1,5 +1,6 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "spiky_shield")]
public class SpikyShieldEffect : ProtectionEffectScript
{
/// <inheritdoc />