Balanced enemy fleet size and planet count, to match the star system level
This commit is contained in:
parent
ce3543026e
commit
1f4ca3e7b5
1
TODO.md
1
TODO.md
|
@ -13,7 +13,6 @@ Map/story
|
|||
|
||||
* Add initial character creation
|
||||
* Fix quickly zooming in twice preventing to display some UI parts
|
||||
* Enemy fleet size should start low and increase with system level (there should be less locations in systems too)
|
||||
* Allow to change/buy ship model
|
||||
* Add factions and reputation
|
||||
* Allow to cancel secondary missions
|
||||
|
|
|
@ -108,7 +108,7 @@ module TS.SpaceTac {
|
|||
|
||||
// Generate the contents of this star system
|
||||
generate(random = RandomGenerator.global): void {
|
||||
var location_count = random.randInt(2, 10);
|
||||
var location_count = random.randInt(2 + Math.floor(this.level / 2), 3 + this.level);
|
||||
if (this.name.length == 0) {
|
||||
this.name = random.choice(Star.NAMES_POOL);
|
||||
}
|
||||
|
@ -118,14 +118,14 @@ module TS.SpaceTac {
|
|||
// Generate points of interest (*count* doesn't include the star and warp locations)
|
||||
generateLocations(count: number, random = RandomGenerator.global): void {
|
||||
while (count--) {
|
||||
this.generateOneLocation(StarLocationType.PLANET, this.locations, this.radius * 0.2, this.radius * 0.7, random);
|
||||
this.generateOneLocation(StarLocationType.PLANET, this.locations, this.radius * 0.2, this.radius * 0.6, random);
|
||||
}
|
||||
}
|
||||
|
||||
// Generate a warp location to another star (to be bound later)
|
||||
generateWarpLocationTo(other: Star, random = RandomGenerator.global): StarLocation {
|
||||
let fav_phi = Math.atan2(other.y - this.y, other.x - this.x);
|
||||
var warp = this.generateOneLocation(StarLocationType.WARP, this.locations, this.radius * 0.8, this.radius * 1, random, fav_phi);
|
||||
var warp = this.generateOneLocation(StarLocationType.WARP, this.locations, this.radius * 0.75, this.radius * 0.85, random, fav_phi);
|
||||
return warp;
|
||||
}
|
||||
|
||||
|
|
|
@ -124,9 +124,15 @@ module TS.SpaceTac {
|
|||
this.encounter_gen = true;
|
||||
|
||||
let fleet_generator = new FleetGenerator(this.encounter_random);
|
||||
let variations: [number, number][] = [[this.star.level, 4], [this.star.level + 1, 3], [this.star.level + 2, 2]];
|
||||
if (this.star.level > 1) {
|
||||
variations.push([this.star.level - 1, 5]);
|
||||
let variations: [number, number][];
|
||||
if (this.star.level == 1) {
|
||||
variations = [[this.star.level, 2]];
|
||||
} else if (this.star.level <= 3) {
|
||||
variations = [[this.star.level, 2], [this.star.level - 1, 3]];
|
||||
} else if (this.star.level <= 6) {
|
||||
variations = [[this.star.level, 3], [this.star.level - 1, 4], [this.star.level + 1, 2]];
|
||||
} else {
|
||||
variations = [[this.star.level, 4], [this.star.level - 1, 5], [this.star.level + 1, 3], [this.star.level + 3, 2]];
|
||||
}
|
||||
let [level, enemies] = this.encounter_random.choice(variations);
|
||||
this.encounter = fleet_generator.generate(level, new Player(this.star.universe, "Enemy"), enemies, true);
|
||||
|
|
|
@ -38,21 +38,22 @@ module TS.SpaceTac {
|
|||
starcount = 4;
|
||||
}
|
||||
|
||||
// Links between stars
|
||||
while (this.stars.length == 0 || any(this.stars, star => star.getLinks().length == 0)) {
|
||||
this.stars = this.generateStars(starcount);
|
||||
|
||||
let links = this.getPotentialLinks();
|
||||
this.starlinks = this.filterRedundantLinks(this.filterCrossingLinks(links));
|
||||
}
|
||||
|
||||
this.generateWarpLocations();
|
||||
|
||||
// Encounter levels
|
||||
this.setEncounterLevels();
|
||||
|
||||
// Locations
|
||||
this.stars.forEach((star: Star) => {
|
||||
star.generate(this.random);
|
||||
});
|
||||
|
||||
this.setEncounterLevels();
|
||||
|
||||
this.addShops();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue