public ZVWrapper(InMemoryUser user, InMemoryZhouVariant zv) { ZV = zv; CharactersNoBorrow = new(ZV.CharacterIndexMap); var borrow = zv.UserData[user.Index].BorrowPlusOne - 1; if (borrow < 5) { CharactersNoBorrow.Remove(zv.CharacterIDs[borrow]); ActualBorrowIndex = borrow; } }
//TODO this check should be done before creating this wrapper public bool ApplyUsedCharacterList(HashSet <int> usedCharacters, HashSet <int> test) { test.Clear(); test.UnionWith(usedCharacters); test.IntersectWith(CharactersNoBorrow.Keys); if (test.Count == 0) { return(true); } if (ActualBorrowIndex.HasValue || test.Count > 1) { return(false); } CharactersNoBorrow.Remove(test.First(), out var borrow); ActualBorrowIndex = borrow; return(true); }