Library students not gaining intelligence when housed in a tavern
KKomrade opened this issue ยท 3 comments
Prerequisites
- I am running the latest alpha version of MineColonies and Structurize for my Minecraft version.
- I checked the MineColonies/Structurize wiki and made sure my issue is not covered there.
- I made sure that this issue is not a duplicate of any existing issue.
Context
- Minecraft Version: 1.16.5
- MineColonies Version: 0.14.129-ALPHA
- Structurize Version: 0.13.167-ALPHA
- Related Mods and their Versions: N/A
Expected behavior
Library students should be able to level up past Intelligence lv 6 if they are housed in a level 3 tavern.
Actual behavior
Library students are stuck at the same intelligence level forever despite using up paper and books and living in a level 3 tavern.
Steps to reproduce the issue
- Build a level 3 tavern and a level 2 library
- Assign a colonist with low intelligence level (but greater than 5) to the library and tavern
- Give the colonist plenty of books and paper
- Wait several in game days as intelligence level remains the same low level
Logs
- latest.log:
- crashlog:
Notes
I am using manual assignment for housing and jobs in my colony. Not sure if this influences calculation of housing level or not, but I'm pretty sure it's just an issue with the library. Also the actual library block was placed by a builder as part of the True Dwarven University complex. Doubt this is part of the problem though.
Viewers
- Add a thumbs-up to the bug report if you are also affected. This helps the bug report become more visible to the team and doesn't clutter the comments.
- Add a comment if you have any insights or background information that isn't already part of the conversation.
I wanted to add to this conversation since I have been having trouble with the Library myself. I have two student housed in a tier 5, and it has not risen a single level past 27 int and 16 int respectively in about 30 hours of game (with a character in the colony). I have been reviewing the code, and found a couple of things:
- the division 100/ chosenItem.getSkillIncreasePct() is an int division. getSkillIncreasePct is a value between 100 and 1000, and for values larger than 100, this results in a value of 0 (because it's an int division, not a double). Thus, for the called function, the second parameter is 1 or 0.
- This means that, when studying with an item with study value >100, this if (which if true, makes the student not learn, it returns) may only trigger due to the second part of the or (customChance < 1), which will trigger in a 1 in 50 chance (random.nextInt(CHANCE_TO_LEVEL) > 0). The variable name also looks a bit weird, since the larger CHANCE_TO_LEVEL is, the more likely the student is to NOT leveling up. In addition, for studentItem value of 100 (lowest possible), the part that could trigger is the first of the rule, given customChance > 0 , and given that random.nextInt(1) will always return 0, the student will 'always learn'.
- In case the previous conditions were cleared and the student learns, the system computes the level cap and enforces that it does not go past it. However, the level cap (I think) should be defined over levels, and in this line, what gets checked is Intelligence's getB (which, from other usages in the code, I'm pretty sure it's the experience within the level).
I believe that, in my case, what is happening is that the intelligence's exp in at least one of my workers is over 90 (my current cap given happiness is 10), and the level is thus capped at the current one.
I hope this helps, I'd try a MR but I have very little experience contributing to public repositories, and I think this may also require some discussion since it is bound to change how Library works depending on the outcome of fixing these errors.