/// <summary> /// Constructor /// </summary> /// <param name="d">Dice object</param> /// <param name="maxSize">Maximum Size</param> /// <param name="prefix">The catalog prefix</param> public CatalogGenerator(Dice d, string prefix, long maxSize) { this.OurDice = d; this.CatalogPrefix = prefix; this.MaxSizeCatalog = maxSize; this.TakenNumbers = new List<long>(); }
static void Main(string[] args) { ///Variables string systemName, input; double systemAge; int numberOfStars = 0; bool habitableSystem = false; Dice d = new Dice(); //setup console output parameters int charWidth = Console.BufferWidth; int leftFill = 50; //yet another generator.. ::sigh:: Console.WriteLine("Welcome to the Generator!"); Console.Write("Please enter the name of the system: "); systemName = Console.ReadLine(); //Okay, so there's some interactivity. Console.Write("Enter Y or yes if you want to generate a habitable system: "); input = Console.ReadLine(); if (input == "Y" || input == "yes" || input == "y" || input == "YES") habitableSystem = true; //start console output Console.WriteLine(); Console.Write("Generating stars ".PadRight(leftFill)); //first bit, generate age of the system and number of stars numberOfStars = SystemGenerator.NumberOfStars(d); systemAge = SystemGenerator.RollRandomAge(d, habitableSystem); //now generate stars }
//************************************** CONSTRUCTIONS /// <summary> /// Basic constructor /// </summary> /// <param name="v">Dice object</param> internal SectorGenerator(Dice v, AetherumSettings p) { this.VelvetBag = v; this.PrgSettings = p; this.StellarCatalog = new CatalogGenerator(VelvetBag, PrgSettings.GetSystemPrefix(), PrgSettings.GetSystemMaxNum()); }
public static int NumberOfStars(Dice d) { int numStars = (int)Math.Floor((d.gurpsRoll() / 3.0) - 1); if (numStars < 1) return 1; else if (numStars > 3) return 3; else return numStars; }
public SectorGenerator() { ourDice = new Dice(); InitializeComponent(); // populate the galaxy listing string rawGalaxiesJson = File.ReadAllText("galaxies.json"); List<Galaxy> ourGalaxies = JsonConvert.DeserializeObject<List<Galaxy>>(rawGalaxiesJson); //populate the combo box foreach (Galaxy g in ourGalaxies) { cmbGalaxies.Items.Add(g); } //select the first galaxy and division cmbGalaxies.SelectedIndex = 0; cmbDivison.SelectedIndex = 0; cmbSectorSize.SelectedIndex = 0; //pull in options ourSettings = OptionsCont.loadSettings(settingFilePath); //MessageBox.Show(ourSettings.ToString()); }
/// <summary> /// This function handles establishing needed objects for the program /// </summary> /// <param name="sender">object starting this (not needed)</param> /// <param name="e">Event arguments (not needed)</param> private void AetherumExplorer_Load(object sender, EventArgs e) { //initalize the settings and the container this.prgSettings = new AetherumSettings(); this.ourDice = new Dice(); this.ourSystems = new BindingList<SystemView>(); this.ourGenerator = new SectorGenerator(this.ourDice, this.prgSettings); //load our settings up from the file this.prgSettings.SaveFilePath(@"settings.json"); this.prgSettings.LoadProperties(); //some work on drawing controls dgvStarListing.AllowUserToAddRows = false; dgvStarListing.AllowUserToDeleteRows = false; createSector(); }
/// <summary> /// Constructor /// </summary> public CatalogGenerator(Dice d) { this.ourDice = d; this.takenNumbers = new List<int>(); }
//************************************** CONSTRUCTIONS /// <summary> /// Basic constructor /// </summary> /// <param name="v">Dice object</param> internal SectorGenerator(Dice v, AetherumSettings p) { this.velvetBag = v; this.prgSettings = p; }
public static double RandomStellarMass(Dice d, bool habitableRoll) { int firstRoll = 0, secondRoll = 0; //first roll if (!habitableRoll) firstRoll = d.gurpsRoll(); else { switch (d.rng(1, 6)) { case 1: firstRoll = 5; break; case 2: firstRoll = 6; break; case 3: case 4: firstRoll = 7; break; case 5: case 6: firstRoll = 8; break; default: firstRoll = 6; break; } } //second roll secondRoll = d.gurpsRoll(); switch (firstRoll) { case 0: return 0; case 3: if (secondRoll >= 3 && secondRoll <= 10) return 2; else return 1.9; case 4: if (secondRoll >= 3 && secondRoll <= 8) return 1.8; else if (secondRoll >= 9 && secondRoll <= 11) return 1.7; else return 1.6; case 5: if (secondRoll >= 3 && secondRoll <= 7) return 1.5; else if (secondRoll >= 8 && secondRoll <= 10) return 1.45; else if (secondRoll >= 11 && secondRoll <= 12) return 1.4; else return 1.35; case 6: if (secondRoll >= 3 && secondRoll <= 7) return 1.3; else if (secondRoll >= 8 && secondRoll <= 9) return 1.25; else if (secondRoll == 10) return 1.2; else if (secondRoll == 11 || secondRoll == 12) return 1.15; else return 1.1; case 7: if (secondRoll >= 3 && secondRoll <= 7) return 1.05; else if (secondRoll == 8 && secondRoll == 9) return 1; else if (secondRoll == 10) return .95; else if (secondRoll == 11 && secondRoll == 12) return .9; else return .85; case 8: if (secondRoll >= 3 && secondRoll <= 7) return .8; else if (secondRoll == 8 && secondRoll == 9) return .75; else if (secondRoll == 10) return .7; else if (secondRoll == 11 && secondRoll == 12) return .65; else return .6; case 9: if (secondRoll >= 3 && secondRoll <= 8) return .55; else if (secondRoll >= 9 && secondRoll <= 11) return .5; else return .45; case 10: if (secondRoll >= 3 && secondRoll <= 8) return .4; else if (secondRoll >= 9 && secondRoll <= 11) return .35; else return .3; case 11: return .25; case 12: return .2; case 13: return .15; default: return .1; } }
public static double RollRandomAge(Dice d, bool habitableRoll) { //get roll int firstRoll = 0; if (!habitableRoll) firstRoll = d.gurpsRoll(); else firstRoll = d.rng(2, 6, 2); firstRoll = firstRoll - 3; //make array compliant. //sanity check the bounds if (firstRoll < 0 || firstRoll > 15) return 3.87; //return a valid number that you won't get normally. // Add the initial value to the first step value (which is multiplied by 1d6-1) and then add the second step value (which is also multiplied by 1d6-1) return (stellarAge[firstRoll][0] + (stellarAge[firstRoll][1] * d.rng(1, 6, -1)) + (stellarAge[firstRoll][2] * d.rng(1, 6, -1))); }
/// <summary> /// This function converts the astronomical object to mass. /// </summary> /// <param name="aType">The object</param> /// <returns>the mass of the type</returns> public static double convBonusAstroObjectToAge(AstroObjectType aType, Dice d) { switch (aType) { case AstroObjectType.BlackHole: return new RangePair(5.0, 10.0).RollInRange(d); case AstroObjectType.Pulsar: return new RangePair(1.4, 5.0).RollInRange(d); case AstroObjectType.TypeFGiant: return new RangePair(2.0, 5.0).RollInRange(d); case AstroObjectType.WhiteDwarf: return new RangePair(.15, 1.4).RollInRange(d); case AstroObjectType.RedGiant: return new RangePair(.5, 8).RollInRange(d); case AstroObjectType.TypeOGiant: return new RangePair(5.0, 50.0).RollInRange(d); case AstroObjectType.TypeBGiant: return new RangePair(4.0, 10.0).RollInRange(d); case AstroObjectType.Supergiant: return new RangePair(25.0, 1000.0).RollInRange(d); case AstroObjectType.NeutronStar: return new RangePair(1.4, 5.0).RollInRange(d); case AstroObjectType.Anomaly: return 0; default: return new RangePair(0.1, 2.0).RollInRange(d); } }
/// <summary> /// This gets the age of the system /// </summary> /// <param name="ourDice">The dice object</param> /// <returns>System age</returns> public static double genSystemAge(Dice ourDice) { //get first roll int roll; roll = ourDice.gurpsRoll(); if (roll == 3) return 0.01; if (roll >= 4 && roll <= 6) return (.1 + (ourDice.rng(1, 6, -1) * .3) + (ourDice.rng(1, 6, -1) * .05)); if (roll >= 7 && roll <= 10) return (2 + (ourDice.rng(1, 6, -1) * .6) + (ourDice.rng(1, 6, -1) * .1)); if (roll >= 11 && roll <= 14) return (5.6 + (ourDice.rng(1, 6, -1) * .6) + (ourDice.rng(1, 6, -1) * .1)); if (roll >= 15 && roll <= 17) return (8 + (ourDice.rng(1, 6, -1) * .6) + (ourDice.rng(1, 6, -1) * .1)); if (roll == 18) return (10 + (ourDice.rng(1, 6, -1) * .6) + (ourDice.rng(1, 6, -1) * .1)); return 13.8; }
/// <summary> /// This determines the distance of the object /// </summary> /// <param name="dist">The pre-distance of the star</param> /// <param name="d">The dice</param> /// <returns>The generated distance</returns> public static double genOrbitalSeperation(double dist, Dice d) { int roll = d.rng(1, 6); if (roll <= 3) return genCloseOrbitalDist(dist, d); else return genFartherOrbitalDist(dist, d); }
/// <summary> /// This generates a furthest orbital distance. /// </summary> /// <param name="dist">The pre-distance of the star</param> /// <param name="d">The dice</param> /// <returns>The generated distance</returns> public static double genFartherOrbitalDist(double dist, Dice d) { return (1000 * d.rng(2, 6)) + dist; }
//******************* Stellar spacing issues. /// <summary> /// This generates a close orbital distance. /// </summary> /// <param name="dist">The pre-distance of the star</param> /// <param name="d">The dice</param> /// <returns>The generated distance</returns> public static double genCloseOrbitalDist(double dist, Dice d) { int roll = d.rng(2, 6, -2); if (roll > 0) return (10 * roll) + dist; else return StellarReference.closeOrbital + dist; }