This commit is contained in:
@@ -57,8 +57,7 @@ public static class MoveTurnExecutor
|
||||
return;
|
||||
}
|
||||
|
||||
var targetSide = battle.Sides[moveChoice.TargetSide];
|
||||
targetSide.RunScriptHook(x => x.ChangeIncomingTargets(moveChoice, ref targets));
|
||||
targets.WhereNotNull().RunScriptHook(x => x.ChangeIncomingTargets(moveChoice, ref targets));
|
||||
|
||||
byte numberOfHits = 1;
|
||||
moveChoice.RunScriptHook(x => x.ChangeNumberOfHits(moveChoice, ref numberOfHits));
|
||||
@@ -154,6 +153,11 @@ public static class MoveTurnExecutor
|
||||
break;
|
||||
|
||||
var useMove = executingMove.UseMove;
|
||||
|
||||
var isContact = useMove.HasFlag("contact");
|
||||
executingMove.RunScriptHook(x => x.ModifyIsContact(executingMove, target, hitIndex, ref isContact));
|
||||
hitData.IsContact = isContact;
|
||||
|
||||
var hitType = (TypeIdentifier?)useMove.MoveType;
|
||||
executingMove.RunScriptHook(x => x.ChangeMoveType(executingMove, target, hitIndex, ref hitType));
|
||||
|
||||
|
||||
@@ -37,6 +37,11 @@ public interface IHitData
|
||||
/// </summary>
|
||||
TypeIdentifier? Type { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the hit is a contact hit. This is used to determine whether abilities that trigger on contact should be activated.
|
||||
/// </summary>
|
||||
bool IsContact { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the hit has failed.
|
||||
/// </summary>
|
||||
@@ -76,6 +81,9 @@ public record HitData : IHitData
|
||||
/// <inheritdoc />
|
||||
public TypeIdentifier? Type { get; internal set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsContact { get; internal set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool HasFailed { get; private set; }
|
||||
|
||||
|
||||
@@ -769,4 +769,12 @@ public abstract class Script : IDeepCloneable
|
||||
public virtual void ModifyWeight(ref float weight)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Modifies whether a move is a contact move or not. This is used for abilities such as Long Reach.
|
||||
/// </summary>
|
||||
public virtual void ModifyIsContact(IExecutingMove executingMove, IPokemon target, byte hitIndex,
|
||||
ref bool isContact)
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user