private Node CreateNode( StarSystem system, double fuelMin, double fuelMax, BoostType boostType, RefuelType refuelType, double?refuelMin, double?refuelMax, int jumps) { var fuelAvg = (fuelMin + fuelMax) / 2.0; return(new Node( (system.Id, this.GetNodeFuelId(fuelAvg), boostType, refuelType), system, system.Equals(this.goal), fuelMin, fuelMax, boostType, refuelType, refuelMin, refuelMax, jumps )); }
public JumpParameters( RefuelType refuelType, double?refuelMin = null, double?refuelMax = null, int?jumpsMin = null, int?jumpsMax = null, double?multiJumpRangeFactor = null) { this.RefuelType = refuelType; this.RefuelMin = refuelMin; this.RefuelMax = refuelMax; this.JumpsMin = jumpsMin ?? 0; this.JumpsMax = jumpsMax ?? int.MaxValue; this.MultiJumpRangeFactor = multiJumpRangeFactor ?? 1.0; }
public double?Get(StarSystem from, BoostType boost, RefuelType refuelType, double?refuelLevel) { var distanceToNeutron = from?.DistanceToNeutron ?? 0; var distanceToScoopable = from?.DistanceToScoopable ?? 0; var distanceToStation = from?.DistanceToStation ?? 0; var distanceToWhiteDwarf = from?.DistanceToWhiteDwarf ?? 0; if (refuelType == RefuelType.None) { return(GetWithoutRefuel(from, boost)); } // Block A/B refueling if (refuelType != RefuelType.None && (boost == BoostType.Neutron || boost == BoostType.WhiteDwarf)) { return(null); } var timeFst = TIME_WITCHSPACE; var timeRst = 0.0; if (boost == BoostType.None) { timeRst = TIME_FSD_COOLDOWN + TIME_FSD_CHARGE; } else if (boost == BoostType.Synthesis) { timeRst = TIME_SYNTHESIS_BOOST + TIME_FSD_CHARGE; } else if (boost == BoostType.Neutron) { timeFst += this.GetSupercruiseTime(distanceToNeutron); timeFst += TIME_NEUTRON_BOOST; timeRst = TIME_FSD_CHARGE; } else if (boost == BoostType.WhiteDwarf) { timeFst += this.GetSupercruiseTime(distanceToWhiteDwarf); timeFst += TIME_WHITE_DWARF_BOOST; timeRst = TIME_FSD_CHARGE; } else { throw new NotImplementedException(); } if (refuelType == RefuelType.None) { // No added time } else if (refuelType == RefuelType.Scoop) { var timeRefuelScoop = refuelLevel.Value / this.ship.FuelScoopRate; var timeRefuel = this.GetSupercruiseTime(distanceToScoopable) + timeRefuelScoop + TIME_FSD_CHARGE; timeRst = Math.Max(timeRst, timeRefuel); } else if (refuelType == RefuelType.ScoopHeatsink) { var timeRefuelScoop = refuelLevel.Value / this.ship.FuelScoopRate; var timeRefuelParallel = TIME_GALAXY_MAP + TIME_REFUEL_TRAVEL + TIME_FSD_CHARGE; if (timeRefuelScoop < timeRefuelParallel) { return(null); } var timeRefuel = this.GetSupercruiseTime(distanceToScoopable) + timeRefuelScoop; timeRst = Math.Max(timeRst, timeRefuel); } else if (refuelType == RefuelType.ScoopReckless) { var timeRefuelScoop = refuelLevel.Value / this.ship.FuelScoopRate; var timeRefuel = this.GetSupercruiseTime(distanceToStation) + Math.Max(timeRefuelScoop, TIME_FSD_CHARGE); timeRst = Math.Max(timeRst, timeRefuel); } else if (refuelType == RefuelType.Station) { var timeRefuel = this.GetSupercruiseTime(distanceToStation) + TIME_VISIT_STATION; timeRst = Math.Max(timeRst, timeRefuel); } else { throw new NotImplementedException(); } return(timeFst + timeRst); }