From e3f8e7e71ca17194a607d3c54b2961e9f1be6ef7 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sun, 15 May 2022 13:12:02 +0200 Subject: [PATCH] Make PokemonParty an IReadOnlyList instead of IEnumerable --- PkmnLibSharp/Battling/PokemonParty.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/PkmnLibSharp/Battling/PokemonParty.cs b/PkmnLibSharp/Battling/PokemonParty.cs index 96901e0..b030f6c 100644 --- a/PkmnLibSharp/Battling/PokemonParty.cs +++ b/PkmnLibSharp/Battling/PokemonParty.cs @@ -6,7 +6,7 @@ using PkmnLibSharp.Utilities; namespace PkmnLibSharp.Battling { - public class PokemonParty : PointerWrapper, IEnumerable + public class PokemonParty : PointerWrapper, IReadOnlyList { public delegate void OnSwitchDelegate(ulong a, ulong b); public event OnSwitchDelegate? OnSwitch; @@ -114,8 +114,11 @@ namespace PkmnLibSharp.Battling _cache = null; } + public int Count => (int)Length; - - + public int IndexOf(Pokemon? pokemon) + { + return Party.IndexOf(pokemon); + } } } \ No newline at end of file