Bunch more moves, changes in how additional information for items works.
This commit is contained in:
@@ -11,18 +11,18 @@ internal static class MoveTurnExecutor
|
||||
internal static void ExecuteMoveChoice(IBattle battle, IMoveChoice moveChoice)
|
||||
{
|
||||
var chosenMove = moveChoice.ChosenMove;
|
||||
var moveData = chosenMove.MoveData;
|
||||
var useMove = chosenMove.MoveData;
|
||||
|
||||
var moveDataName = moveData.Name;
|
||||
var moveDataName = useMove.Name;
|
||||
moveChoice.RunScriptHook(x => x.ChangeMove(moveChoice, ref moveDataName));
|
||||
if (moveData.Name != moveDataName)
|
||||
if (useMove.Name != moveDataName)
|
||||
{
|
||||
if (!battle.Library.StaticLibrary.Moves.TryGet(moveDataName, out moveData))
|
||||
if (!battle.Library.StaticLibrary.Moves.TryGet(moveDataName, out useMove))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
$"The move was changed to '{moveDataName}' by a script, but this move does not exist.");
|
||||
}
|
||||
var secondaryEffect = moveData.SecondaryEffect;
|
||||
var secondaryEffect = useMove.SecondaryEffect;
|
||||
if (secondaryEffect != null)
|
||||
{
|
||||
if (moveChoice.User.Library.ScriptResolver.TryResolve(ScriptCategory.Move, secondaryEffect.Name,
|
||||
@@ -30,10 +30,18 @@ internal static class MoveTurnExecutor
|
||||
{
|
||||
moveChoice.Script.Set(script);
|
||||
}
|
||||
else
|
||||
{
|
||||
moveChoice.Script.Clear();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
moveChoice.Script.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
var targetType = moveData.Target;
|
||||
var targetType = useMove.Target;
|
||||
var targets =
|
||||
TargetResolver.ResolveTargets(battle, moveChoice.TargetSide, moveChoice.TargetPosition, targetType);
|
||||
moveChoice.RunScriptHook(x => x.ChangeTargets(moveChoice, ref targets));
|
||||
@@ -45,7 +53,7 @@ internal static class MoveTurnExecutor
|
||||
return;
|
||||
}
|
||||
|
||||
var executingMove = new ExecutingMoveImpl(targets, numberOfHits, chosenMove, moveData, moveChoice);
|
||||
var executingMove = new ExecutingMoveImpl(targets, numberOfHits, chosenMove, useMove, moveChoice);
|
||||
|
||||
var prevented = false;
|
||||
executingMove.RunScriptHook(x => x.PreventMove(executingMove, ref prevented));
|
||||
@@ -117,8 +125,14 @@ internal static class MoveTurnExecutor
|
||||
var hitData = (HitData)executingMove.GetDataFromRawIndex(targetHitStat + i);
|
||||
hitData.Type = hitType;
|
||||
|
||||
var effectiveness = battle.Library.StaticLibrary.Types.GetEffectiveness(hitType, target.Types);
|
||||
var types = target.Types.ToList();
|
||||
executingMove.RunScriptHook(x => x.ChangeTypesForMove(executingMove, target, hitIndex, types));
|
||||
target.RunScriptHook(x => x.ChangeTypesForIncomingMove(executingMove, target, hitIndex, types));
|
||||
|
||||
var effectiveness = battle.Library.StaticLibrary.Types.GetEffectiveness(hitType, types);
|
||||
executingMove.RunScriptHook(x => x.ChangeEffectiveness(executingMove, target, hitIndex, ref effectiveness));
|
||||
target.RunScriptHook(x =>
|
||||
x.ChangeIncomingEffectiveness(executingMove, target, hitIndex, ref effectiveness));
|
||||
hitData.Effectiveness = effectiveness;
|
||||
|
||||
var blockCritical = false;
|
||||
|
||||
Reference in New Issue
Block a user