/// <summary> /// This function fills in the details of the star. /// </summary> /// <param name="s">The star to be filled in</param> /// <param name="ourDice">The dice object used</param> /// <param name="maxMass">Max mass of the system</param> /// <param name="sysName">The name of the system</param> public static void generateAStar(Star s, Dice ourDice, double maxMass, string sysName) { //check mass first - if unset, set it. if (s.currMass == 0) { if (s.orderID == Star.IS_PRIMARY) { s.updateMass(libStarGen.rollStellarMass(ourDice, s.orderID)); maxMass = s.currMass; } else s.updateMass(libStarGen.rollStellarMass(ourDice, s.orderID, maxMass)); } //if we are in the white dwarf branch, reroll mass. if (s.evoLine.findCurrentAgeGroup(s.starAge) == StarAgeLine.RET_COLLASPEDSTAR) s.updateMass(ourDice.rollInRange(0.9, 1.4),true); //set the generic name s.name = Star.genGenericName(sysName, s.orderID); //initalize the luminosity first, then update it given the current age, status and mass. s.setLumin(); s.currLumin = Star.getCurrLumin(s.evoLine, s.starAge, s.currMass); //determine the temperature s.effTemp = Star.getInitTemp(s.currMass); s.effTemp = Star.getCurrentTemp(s.evoLine, s.currLumin, s.starAge, s.currMass, ourDice); //DERIVED STATS: RADIUS, Spectral Type s.radius = Star.getRadius(s.currMass, s.effTemp, s.currLumin, s.evoLine.findCurrentAgeGroup(s.starAge)); s.setSpectralType(); s.starColor = Star.setColor(ourDice, s.effTemp); //set flare status. libStarGen.setFlareStatus(s, ourDice); //end this here. We will hand orbital mechanics elsewhere. }
/// <summary> /// This function rolls for mass on a star. /// </summary> /// <param name="velvetBag">The dice object</param> /// <param name="orderID">The order ID of the star</param> /// <param name="maxMass">the maximum mass. Has a default value of 0.0, indicating no max mass (may be left out)</param> /// <returns>The rolled mass of a star</returns> public static double rollStellarMass(Dice velvetBag, int orderID, double maxMass = 0.0) { int rollA, rollB; //roll integers double tmpRoll; //test value. if (maxMass == 0.0) { if (!OptionCont.stellarMassRangeSet) { if (orderID == Star.IS_PRIMARY && OptionCont.forceGardenFavorable) { rollA = velvetBag.rng(6); if (rollA == 1) rollA = 5; if (rollA == 2) rollA = 6; if (rollA == 3 || rollA == 4) rollA = 7; if (rollA == 5 || rollA == 6) rollA = 8; return Star.getMassByRoll(rollA, velvetBag.gurpsRoll()); } else { return Star.getMassByRoll(velvetBag.gurpsRoll(), velvetBag.gurpsRoll()); } } else { return velvetBag.rollInRange(OptionCont.minStellarMass, OptionCont.maxStellarMass); } } else { int currPos = Star.getStellarMassPos(maxMass); //error bound checking. The entire program is kinda predicated aroudn the idea you won't have this happen. //IF IT DOES, then do the simple method. if (currPos == -1) { do { tmpRoll = Star.getMassByRoll(velvetBag.gurpsRoll(), velvetBag.gurpsRoll()); } while (tmpRoll > maxMass); return tmpRoll; } //else, roll for the new index. rollA = velvetBag.gurpsRoll(); rollB = velvetBag.rng(rollA, 6); //get the new index if (currPos - rollB <= 0) currPos = 0; else currPos = currPos - rollB; return Star.getMassByIndex(currPos); } }