Implement highest damage AI, further work on AI runner, random fixes
All checks were successful
Build / Build (push) Successful in 51s

This commit is contained in:
2025-07-05 14:56:25 +02:00
parent 32aaa5150a
commit c795f20e54
30 changed files with 261 additions and 26 deletions

View File

@@ -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;
}
}