This commit is contained in:
@@ -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();
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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;
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user