Hey everyone, it has been quiet for quite some time since University took a heavy load on me, I'm slowly recovering and was able to fix some things in our code in the last week.
Until now all our barbarians spawned randomly depending on a value.
Therefore, if you wanted to have them spawn averagely every 3rd night they might also spawn 3 nights in a row (Not with a high probability, but possible).
Therefore, I added a minimum config option.
And then, inside the colony, I store the amount of nights.
Increment it each night.
And added some getters and setters.
Then, I check when we calculate the raid, if the minimum nights have passed already.
And, obviously, when we raid will reset this variable.
Additionally, our barbarian spawn code was a bad mess.
One of our coders calculated the amount of barbarians in one method, stored it in a static variable and accessed it in the other method.
While this is possible, it is error prone and extremely bad style.
Therefore, I created a Horde class which represents a raid.
Then, I create this Horde when we calculate the numbers and do not store it in a static variable. I return the horde (Object Oriented Programming ftw).
After that, when we call it, I just check for the Horde and store it in a local variable.
And afterwards just access the data where I need it.
Cleaner and less error prone for sure.
Besides that, I colored the horde arrival messages so players notice them in a full chat and decreased the drop rates of the items.
I also fixed the delete command after a recent command update.
I changed some comment variables to optional and took configuration values for it and added feedback on colony claiming (command execution).
Posted on Utopian.io - Rewarding Open Source Contributors