After getting all the issues with the updates to .NET 10, and adding the captured & empty orbits table, I went ahead and added the function to get the empty orbits. Which is just a count of the empty orbits I think, so will need to figure out by reading the book how you place the empty orbits. We know that the main world, if the system is generated from a main world, is in the habitable zone. Though I also need to check to see if that is the case for the main world when a planetoid belt, such as Glisten.
Anyway - I got that working with one logic flaw I need to correct. But also realized I probably should extend my die roll method. What I currently do is find the min and max die rolls and roll on that. Some tables are 2d6 in the book, some are 1d6. I am passing in the number of dice to roll for the various tables, but now wondering if we really want to make this even more flexible, do we want to add the number and type of dice to the tables? Of course, then it is not Traveller in my head, so that may be a step too far.
But: the die rolls have to be within the range of values that the user has given (and I really need to make sure there are no duplicate rolls as well when adding to the tables. But that is another thing to worry about later). Anyway - we do not want a die roll outside the range in the table. While Book 6 has a range of 1 through 6 for the captured planets and empty orbits, what if someone wants a smaller, or a larger, range? Currently I get the lowest and highest die rolls and adjust the results from the die roll to fit the range. Now I am repeating this code in a lot of places. The fix is to pass in the minimum and maximum ranges in the die roll function itself so I don't have to repeat that code.
The current code for empty orbits:
private async Task<int> findEmptyOrbits()
{
int results = 0;
List<TCapturedAndEmpty?> capturedAndEmpty = await _capturedAndEmptyRepository.GetAll();
if (capturedAndEmpty == null || capturedAndEmpty.Count == 0) { return results; }
int minD6 = capturedAndEmpty.Min(c => c != null ? c.DieRoll : 0);
int maxD6 = capturedAndEmpty.Max(c => c != null ? c.DieRoll : 0);
if (minD6 == 0 && maxD6 == 0) { return results; }
int d6 = _utility.DieRoll(maxD6, 1);
if (d6 < minD6) { d6 = minD6; }
TCapturedAndEmpty? match = capturedAndEmpty.FirstOrDefault(c => c != null && c.DieRoll == d6);
if (match == null || !match.EmptyOrbits) { return results;};
// we have empty orbits; how many?
d6 = _utility.DieRoll(maxD6, 1);
if (d6 < minD6) { d6 = minD6; }
return capturedAndEmpty.First(c => c != null && c.DieRoll == d6)?.EmptyOrbitsQty ?? 0;
}
You can see where I am getting the min and max range based on the loaded table. Thinking the check for min and max will be moved to the utility.DieRoll function, so we have something like utilityDieRoll(numberOfSides, numberOfDice, minRange, maxRange). and then do the "if results < minRange results = minRange" sort of thing.
Anyway - one may wonder why I am doing this the way I am. As there are a lot of Traveller system generators out there. But most of them do not allow you to set the tables yourself. And while most people probably won't want to anyway, it is the way my mind works and how I've always approached software. Let the user have more control over things. This system is basically a giant software settings thing in a way: you can set all the tables up how you want. Will it ever get used? Very doubtful, but regardless, it is something I want to do, and it is usually pretty fun.
And let's see, I need a picture.
The ill-fated Blacklist Games Fantasy Figures 2 project, though bringing in a LOT of money, failed horribly. The assets got bought out a bit ago by Wildspire Minis. I've backed a few of their projects as they make good cheap minis. They offered the backers of that Kickstarter a reduced rate for the minis. Yes, that we already paid for several years (years!) ago. But even with the additional cost, the price per mini is still really cheap. And there are some interesting ones in there, such as this Cthulhu demon thing. And a hippogryph. So the one I finally got around to painting can have a friend! Bag and bags of minis I need to paint. To go with the boxes and boxes of minis I need to paint.

No comments:
Post a Comment