Initializes move effect script

This commit is contained in:
Deukhoofd 2024-09-03 10:34:01 +02:00
parent 213dfdb69e
commit 257c04c98b
2 changed files with 17 additions and 7 deletions

View File

@ -42,6 +42,16 @@ public class MoveChoice : TurnChoice, IMoveChoice
ChosenMove = usedMove;
TargetSide = targetSide;
TargetPosition = targetPosition;
var secondaryEffect = usedMove.MoveData.SecondaryEffect;
if (secondaryEffect != null)
{
if (user.Library.ScriptResolver.TryResolve(ScriptCategory.Move, secondaryEffect.Name, out var script))
{
Script.Set(script);
script.OnInitialize(user.Library, secondaryEffect.Parameters);
}
}
}
/// <inheritdoc />

View File

@ -312,33 +312,33 @@ public interface IPokemon : IScriptSource
}
/// <summary>
/// The data of the Pokemon related to being in a battle.
/// This is only set when the Pokemon is on the field in a battle.
/// The data of the Pokémon related to being in a battle.
/// This is only set when the Pokémon is on the field in a battle.
/// </summary>
public interface IPokemonBattleData
{
/// <summary>
/// The battle the Pokemon is in.
/// The battle the Pokémon is in.
/// </summary>
IBattle Battle { get; internal set; }
/// <summary>
/// The index of the side of the Pokemon
/// The index of the side of the Pokémon
/// </summary>
byte SideIndex { get; internal set; }
/// <summary>
/// The index of the position of the Pokemon on the field
/// The index of the position of the Pokémon on the field
/// </summary>
byte Position { get; internal set; }
/// <summary>
/// A list of opponents the Pokemon has seen this battle.
/// A list of opponents the Pokémon has seen this battle.
/// </summary>
IReadOnlyList<IPokemon> SeenOpponents { get; }
/// <summary>
/// Whether the Pokemon is on the battlefield.
/// Whether the Pokémon is on the battlefield.
/// </summary>
bool IsOnBattlefield { get; set; }