Implement highest damage AI, further work on AI runner, random fixes
All checks were successful
Build / Build (push) Successful in 51s
All checks were successful
Build / Build (push) Successful in 51s
This commit is contained in:
@@ -38,6 +38,8 @@ public interface IMoveChoice : ITurnChoice
|
||||
/// </summary>
|
||||
Dictionary<StringKey, object?>? AdditionalData { get; }
|
||||
|
||||
void SetAdditionalData(StringKey key, object? value);
|
||||
|
||||
/// <summary>
|
||||
/// Volatile effects that are applied to the move choice.
|
||||
/// </summary>
|
||||
@@ -84,7 +86,14 @@ public class MoveChoice : TurnChoice, IMoveChoice
|
||||
public ScriptContainer Script { get; set; } = new();
|
||||
|
||||
/// <inheritdoc />
|
||||
public Dictionary<StringKey, object?>? AdditionalData { get; }
|
||||
public Dictionary<StringKey, object?>? AdditionalData { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void SetAdditionalData(StringKey key, object? value)
|
||||
{
|
||||
AdditionalData ??= new Dictionary<StringKey, object?>();
|
||||
AdditionalData[key] = value;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IScriptSet Volatile { get; }
|
||||
|
||||
@@ -936,6 +936,8 @@ public class PokemonImpl : ScriptSource, IPokemon
|
||||
AbilityScript.Clear();
|
||||
}
|
||||
|
||||
private (IAbility, AbilityIndex)? _abilityCache;
|
||||
|
||||
/// <inheritdoc />
|
||||
public IAbility? ActiveAbility
|
||||
{
|
||||
@@ -945,9 +947,12 @@ public class PokemonImpl : ScriptSource, IPokemon
|
||||
return null;
|
||||
if (OverrideAbility != null)
|
||||
return OverrideAbility;
|
||||
if (_abilityCache is not null && _abilityCache.Value.Item2 == AbilityIndex)
|
||||
return _abilityCache.Value.Item1;
|
||||
var ability = Form.GetAbility(AbilityIndex);
|
||||
if (!Library.StaticLibrary.Abilities.TryGet(ability, out var abilityObj))
|
||||
throw new KeyNotFoundException($"Ability {ability} not found.");
|
||||
_abilityCache = (abilityObj, AbilityIndex);
|
||||
return abilityObj;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user