Implements a bunch more moves
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2025-05-17 17:44:15 +02:00
parent ecabe2fd10
commit a17cb92c5a
62 changed files with 1180 additions and 81 deletions

View File

@@ -1,11 +1,12 @@
using PkmnLib.Dynamic.Events;
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.Models.Choices;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Static;
using PkmnLib.Static.Moves;
using PkmnLib.Static.Utils;
namespace PkmnLib.Dynamic.Models.BattleFlow;
namespace PkmnLib.Dynamic.BattleFlow;
/// <summary>
/// Helper class for executing moves.
@@ -50,6 +51,12 @@ public static class MoveTurnExecutor
var targets =
TargetResolver.ResolveTargets(battle, moveChoice.TargetSide, moveChoice.TargetPosition, targetType);
moveChoice.RunScriptHook(x => x.ChangeTargets(moveChoice, ref targets));
if (targets.Count == 0)
{
moveChoice.Fail();
return;
}
var targetSide = battle.Sides[moveChoice.TargetSide];
targetSide.RunScriptHook(x => x.ChangeIncomingTargets(moveChoice, ref targets));
@@ -142,12 +149,14 @@ public static class MoveTurnExecutor
var hitIndex = i;
executingMove.RunScriptHook(x => x.OnBeforeHit(executingMove, target, hitIndex));
var hitData = (HitData)executingMove.GetDataFromRawIndex(targetHitStat + i);
if (hitData.HasFailed)
break;
var useMove = executingMove.UseMove;
var hitType = (TypeIdentifier?)useMove.MoveType;
executingMove.RunScriptHook(x => x.ChangeMoveType(executingMove, target, hitIndex, ref hitType));
var hitData = (HitData)executingMove.GetDataFromRawIndex(targetHitStat + i);
hitData.Type = hitType;
var types = target.Types.ToList();

View File

@@ -1,6 +1,7 @@
using PkmnLib.Dynamic.Models;
using PkmnLib.Static.Moves;
namespace PkmnLib.Dynamic.Models.BattleFlow;
namespace PkmnLib.Dynamic.BattleFlow;
/// <summary>
/// Helper class for resolving the targets of a move.

View File

@@ -1,8 +1,9 @@
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.Models.Choices;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Static.Utils;
namespace PkmnLib.Dynamic.Models.BattleFlow;
namespace PkmnLib.Dynamic.BattleFlow;
/// <summary>
/// Helper class for handling the running of a turn in a battle.

View File

@@ -1,7 +1,7 @@
using System.Diagnostics.CodeAnalysis;
using PkmnLib.Dynamic.BattleFlow;
using PkmnLib.Dynamic.Events;
using PkmnLib.Dynamic.Libraries;
using PkmnLib.Dynamic.Models.BattleFlow;
using PkmnLib.Dynamic.Models.Choices;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Static;

View File

@@ -646,6 +646,16 @@ public abstract class Script : IDeepCloneable
{
}
/// <summary>
/// This function allows a script to change the accuracy of a move that is incoming. The value for accuracy is in percentage.
/// A custom case goes when 255 is returned, in which case the entire accuracy check is skipped, and the move
/// will always hit.
/// </summary>
public virtual void ChangeIncomingAccuracy(IExecutingMove executingMove, IPokemon target, byte hitIndex,
ref int modifiedAccuracy)
{
}
/// <summary>
/// This function allows a script to change the weather duration of a weather effect.
/// </summary>