Make moveflags of gen 7 plugin shared statically

This commit is contained in:
2025-07-26 14:36:47 +02:00
parent 77d7b86a3c
commit 6eba332096
33 changed files with 223 additions and 146 deletions

View File

@@ -23,14 +23,14 @@ public class ChargeBounceEffect : Script, IScriptForceTurnSelection, IScriptChan
/// <inheritdoc />
public void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
{
if (!executingMove.UseMove.HasFlag("hit_flying"))
if (!executingMove.UseMove.HasFlag(MoveFlags.HitFlying))
block = true;
}
/// <inheritdoc />
public void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
{
if (!move.UseMove.HasFlag("effective_against_fly"))
if (!move.UseMove.HasFlag(MoveFlags.EffectiveAgainstFly))
damage *= 2;
}

View File

@@ -23,14 +23,14 @@ public class ChargeFlyEffect : Script, IScriptForceTurnSelection, IScriptChangeI
/// <inheritdoc />
public void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
{
if (!executingMove.UseMove.HasFlag("hit_flying"))
if (!executingMove.UseMove.HasFlag(MoveFlags.HitFlying))
block = true;
}
/// <inheritdoc />
public void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
{
if (!move.UseMove.HasFlag("effective_against_fly"))
if (!move.UseMove.HasFlag(MoveFlags.EffectiveAgainstFly))
damage *= 2;
}

View File

@@ -23,14 +23,14 @@ public class ChargeSkyDropEffect : Script, IScriptForceTurnSelection, IScriptCha
/// <inheritdoc />
public void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
{
if (!executingMove.UseMove.HasFlag("hit_flying"))
if (!executingMove.UseMove.HasFlag(MoveFlags.HitFlying))
block = true;
}
/// <inheritdoc />
public void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
{
if (!move.UseMove.HasFlag("effective_against_fly"))
if (!move.UseMove.HasFlag(MoveFlags.EffectiveAgainstFly))
damage *= 2;
}

View File

@@ -23,14 +23,14 @@ public class DigEffect : Script, IScriptForceTurnSelection, IScriptChangeIncomin
/// <inheritdoc />
public void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
{
if (!executingMove.UseMove.HasFlag("hit_underground"))
if (!executingMove.UseMove.HasFlag(MoveFlags.HitUnderground))
block = true;
}
/// <inheritdoc />
public void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
{
if (!move.UseMove.HasFlag("effective_against_underground"))
if (!move.UseMove.HasFlag(MoveFlags.EffectiveAgainstUnderground))
damage *= 2;
}

View File

@@ -23,14 +23,14 @@ public class DiveEffect : Script, IScriptForceTurnSelection, IScriptChangeIncomi
/// <inheritdoc />
public void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
{
if (!executingMove.UseMove.HasFlag("hit_underwater"))
if (!executingMove.UseMove.HasFlag(MoveFlags.HitUnderwater))
block = true;
}
/// <inheritdoc />
public void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
{
if (!move.UseMove.HasFlag("effective_against_underwater"))
if (!move.UseMove.HasFlag(MoveFlags.EffectiveAgainstUnderwater))
damage *= 2;
}

View File

@@ -22,14 +22,14 @@ public class HealBlockEffect : Script, IScriptPreventMoveSelection, IScriptPreve
/// <inheritdoc />
public void PreventMoveSelection(IMoveChoice choice, ref bool prevent)
{
if (choice.ChosenMove.MoveData.HasFlag("heal"))
if (choice.ChosenMove.MoveData.HasFlag(MoveFlags.Heal))
prevent = true;
}
/// <inheritdoc />
public void PreventMove(IExecutingMove move, ref bool prevent)
{
if (move.ChosenMove.MoveData.HasFlag("heal"))
if (move.ChosenMove.MoveData.HasFlag(MoveFlags.Heal))
prevent = true;
}

View File

@@ -1,3 +1,5 @@
using PkmnLib.Plugin.Gen7.Common;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "protect")]
@@ -9,7 +11,7 @@ public class ProtectionEffectScript : Script, IScriptBlockIncomingHit
if (target.BattleData == null)
return;
if (!executingMove.UseMove.HasFlag("protect"))
if (!executingMove.UseMove.HasFlag(MoveFlags.Protect))
return;
var args = new CustomTriggers.BypassProtectionArgs(executingMove, target, hitIndex, false);
executingMove.User.RunScriptHook<IScriptCustomTrigger>(x =>

View File

@@ -8,7 +8,7 @@ public class SubstituteEffect(uint health) : Script, IScriptBlockIncomingHit
/// <inheritdoc />
public void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
{
if (executingMove.UseMove.HasFlag("ignore-substitute"))
if (executingMove.UseMove.HasFlag(MoveFlags.IgnoreSubstitute))
return;
var args = new CustomTriggers.BypassSubstituteArgs(executingMove, target, hitIndex, false);

View File

@@ -8,14 +8,14 @@ public class ThroatChopEffect : Script, IScriptPreventMoveSelection, IScriptFail
/// <inheritdoc />
public void PreventMoveSelection(IMoveChoice choice, ref bool prevent)
{
if (choice.ChosenMove.MoveData.HasFlag("sound"))
if (choice.ChosenMove.MoveData.HasFlag(MoveFlags.Sound))
prevent = true;
}
/// <inheritdoc />
public void FailMove(IExecutingMove move, ref bool fail)
{
if (move.UseMove.HasFlag("sound"))
if (move.UseMove.HasFlag(MoveFlags.Sound))
fail = true;
}