/// <summary> /// Populates orbits around a star, according to GURPS 4e rules. (Does not create them) /// </summary> /// <param name="s">The star we're populating around</param> /// <param name="myDice">Our dice object.</param> public static void populateOrbits(Star s, Dice myDice) { double maxRatio = 2.0; double minRatio = 1.4; double minDistance = .15; bool firstGasGiant = true; if (s.containsGasGiants()) firstGasGiant = false; for (int i = 0; i < s.sysPlanets.Count; i++) { int roll = myDice.gurpsRoll(); //set gas giants first. if (s.gasGiantFlag != Star.GASGIANT_NONE) { //BEFORE SNOW LINE: Only Eccentric, Epistellar if (s.sysPlanets[i].orbitalRadius < Star.snowLine(s.initLumin)) { if (roll <= 8 && s.gasGiantFlag == Star.GASGIANT_ECCENTRIC) { s.sysPlanets[i].updateType(Satellite.BASETYPE_GASGIANT); libStarGen.updateGasGiantSize(s.sysPlanets[i],myDice.gurpsRoll() + 4); } if (roll <= 6 && s.gasGiantFlag == Star.GASGIANT_EPISTELLAR) { s.sysPlanets[i].updateType(Satellite.BASETYPE_GASGIANT); libStarGen.updateGasGiantSize(s.sysPlanets[i], myDice.gurpsRoll() + 4); } } //AFTER SNOW LINE: All three if (s.sysPlanets[i].orbitalRadius >= Star.snowLine(s.initLumin)) { if (roll <= 15 && s.gasGiantFlag == Star.GASGIANT_CONVENTIONAL) { s.sysPlanets[i].updateType(Satellite.BASETYPE_GASGIANT); if (firstGasGiant) { libStarGen.updateGasGiantSize(s.sysPlanets[i], myDice.gurpsRoll() + 4); firstGasGiant = false; } else libStarGen.updateGasGiantSize(s.sysPlanets[i], myDice.gurpsRoll()); } if (roll <= 14 && (s.gasGiantFlag == Star.GASGIANT_ECCENTRIC || s.gasGiantFlag == Star.GASGIANT_EPISTELLAR)) { s.sysPlanets[i].updateType(Satellite.BASETYPE_GASGIANT); if (firstGasGiant) { libStarGen.updateGasGiantSize(s.sysPlanets[i], myDice.gurpsRoll() + 4); firstGasGiant = false; } else libStarGen.updateGasGiantSize(s.sysPlanets[i], myDice.gurpsRoll()); } } } //Done with the gas giant. Let's go start seeign what else it could be. //We can get mods now. if (s.sysPlanets[i].baseType != Satellite.BASETYPE_GASGIANT) { //INNER AND OUTER RADIUS int mod = 0; if (s.sysPlanets[i].orbitalRadius - minDistance <= Star.innerRadius(s.initLumin,s.initMass) || s.sysPlanets[i].orbitalRadius / Star.innerRadius(s.initLumin, s.initMass) <= maxRatio) { mod = mod - 3; } if (s.sysPlanets[i].orbitalRadius + minDistance >= Star.outerRadius(s.initMass) || Star.outerRadius(s.initMass) / s.sysPlanets[i].orbitalRadius <= maxRatio) { mod = mod - 3; } //FORBIDDDEN ZONE if (s.getClosestDistToForbiddenZone(s.sysPlanets[i].orbitalRadius) <= minDistance || (s.getClosestForbiddenZoneRatio(s.sysPlanets[i].orbitalRadius) < maxRatio && s.getClosestForbiddenZoneRatio(s.sysPlanets[i].orbitalRadius) > minRatio)) { //MessageBox.Show("THE FORBIDDEN ZONE!!!!"); mod = mod - 6; } //GAS GIANT LOCATION if (s.isPrevSatelliteGasGiant(s.sysPlanets[i].orbitalRadius)) { mod = mod - 6; } if (s.isNextSatelliteGasGiant(s.sysPlanets[i].orbitalRadius)) { mod = mod - 3; } //now let's get the orbit type. // MessageBox.Show("Mod is " + mod); mod = mod + myDice.gurpsRoll(); //MessageBox.Show("Mod + Roll is " + mod); if (mod <= 3) s.sysPlanets[i].updateType(Satellite.BASETYPE_EMPTY); if (mod >= 4 && mod <= 6) { s.sysPlanets[i].updateType(Satellite.BASETYPE_ASTEROIDBELT); //Expanded Asteroid Belt options if (OptionCont.expandAsteroidBelt) { roll = myDice.gurpsRoll(); if (roll <= 6) s.sysPlanets[i].updateSize(Satellite.SIZE_TINY); if (roll >= 7 && roll <= 13) s.sysPlanets[i].updateSize(Satellite.SIZE_SMALL); if (roll >= 14 && roll <= 15) s.sysPlanets[i].updateSize(Satellite.SIZE_MEDIUM); if (roll >= 16) s.sysPlanets[i].updateSize(Satellite.SIZE_LARGE); } else s.sysPlanets[i].updateSize(Satellite.SIZE_SMALL); //fixes a recursion bug. } if (mod >= 7 && mod <= 8) s.sysPlanets[i].updateTypeSize(Satellite.BASETYPE_TERRESTIAL, Satellite.SIZE_TINY); if (mod >= 9 && mod <= 11) s.sysPlanets[i].updateTypeSize(Satellite.BASETYPE_TERRESTIAL, Satellite.SIZE_SMALL); if (mod >= 12 && mod <= 15) s.sysPlanets[i].updateTypeSize(Satellite.BASETYPE_TERRESTIAL, Satellite.SIZE_MEDIUM); if (mod >= 16) s.sysPlanets[i].updateTypeSize(Satellite.BASETYPE_TERRESTIAL, Satellite.SIZE_LARGE); } } }