diff --git a/data/biomes.js b/data/biomes.js index 1d2ba7d..c17fbe8 100644 --- a/data/biomes.js +++ b/data/biomes.js @@ -1,7 +1,8 @@ var biomes = [ {"Description": "Arctic", "Weight": 2}, {"Description": "Desert", "Weight": 2}, - {"Description": "Island/Beach", "Weight": 2}, + { "Description": "Island", "Weight": 1 }, + { "Description": "Beach", "Weight": 1 }, {"Description": "Jungle", "Weight": 2}, {"Description": "Mountain", "Weight": 2}, {"Description": "Plains", "Weight": 2}, diff --git a/index.html b/index.html index 18727ed..49820c8 100644 --- a/index.html +++ b/index.html @@ -110,6 +110,7 @@

Room Key

+ diff --git a/lib/dungeon.js b/lib/dungeon.js index 554ff28..bf9a12e 100644 --- a/lib/dungeon.js +++ b/lib/dungeon.js @@ -420,7 +420,7 @@ function html_sanctity(element, room) { /** * * @param {object} element - * @param {Array} travel_distance + * @param {object} travel_distance */ function html_travel_time(element, travel_distance){ var container = document.createElement('div'); @@ -431,17 +431,17 @@ function html_travel_time(element, travel_distance){ var title = document.createElement('h3'); title.innerText = 'Travel Time'; container.appendChild(title); - travel_distance.forEach(element => { - var travel = dungeon_options['travel_distance'][travel_distance]; + travel_distance.forEach(travelElement => { + + var travel = dungeon_options['travel_distance'][travelElement['travel']]; var time = Math.max(0, roll_dice(travel.Time)); - add_labeled_text(container, - travel.title + ': ', - 'This dungeon is ' + ( - (time == 0) ? 'right under town! ' : - (time + ' day' + ((time > 1 ) ? 's' : '')+ ' of travel away. ') - ) - - + travel.Notes) + var travelText = 'This dungeon is ' + ( + (time == 0) ? 'right under town! ' : + (time + ' day' + ((time > 1) ? 's' : '') + ' of travel away, through ' + travelElement['biome'] +'. ') + ) + + travel.Notes; + + add_labeled_text(container, travel.title + ': ', travelText) }); @@ -811,6 +811,7 @@ function sanctity_dungeon(dungeonOBJ) { function travel_distance_dungeon(dungeonOBJ) { console.log("travel_distance_dungeon is " + dungeonOBJ.travel_distance) var travelDistance = {}; + if (dungeon_options['travel_distance'][dungeonOBJ.travel_distance]["random"] == 1) { console.log("Random distance!"); @@ -825,10 +826,20 @@ function travel_distance_dungeon(dungeonOBJ) { } console.log("travel distance is using this object " + JSON.stringify(dungeon_options['travel_distance'][dungeonOBJ.travel_distance])); if (travelDistance == {}) return dungeonOBJ; + + var travelBiome = select_from_weighted_table(biomes).Description; + + if (dungeonOBJ.dungeon_overall.travel_distance == undefined) dungeonOBJ.dungeon_overall.travel_distance = []; - dungeonOBJ.dungeon_overall.travel_distance.push(travelDistance); - console.log("Travel Distance processed in travel_distance_dungeon() as " + JSON.stringify( travelDistance) ); + var travel_biome = { + "travel": travelDistance, + "biome": travelBiome + }; + dungeonOBJ.dungeon_overall.travel_distance.push(travel_biome); + console.log("dungeonOBJ.dungeon_overall.travel_distance is using this object " + JSON.stringify(dungeonOBJ.dungeon_overall.travel_distance)); + + console.log("Travel Distance processed in travel_distance_dungeon() as " + JSON.stringify(travelDistance)); return dungeonOBJ; } function flavor_text_room(room) { diff --git a/lib/treasure_service.js b/lib/treasure_service.js index 701efaa..9ded353 100644 --- a/lib/treasure_service.js +++ b/lib/treasure_service.js @@ -307,7 +307,7 @@ function treasure_room(room, dungeonCER, element, generosity, travel_distance) { cer *= modify_cer_for_treasure(dungeonCER / cer); var horde_min = cer * 5 * Number(dungeon_options.generosity[generosity].scale) - * Number(dungeon_options.travel_distance[travel_distance].scale); + * Number(dungeon_options.travel_distance[travel_distance[0]['travel']].scale); var horde_max = horde_min * (1 + roll_dice('4d6') / 11); horde_max = clean_number(horde_max, 2);