1+ /*
2+
3+ Gennia Map Constructor
4+
5+ @Author : Reqwey(hi@reqwey.com)
6+ Jackiexiao(707610215@qq.com)
7+ GitHub Copilot
8+
9+ */
110const Block = require ( './block' ) ;
211const Point = require ( './point' ) ;
312
@@ -19,8 +28,8 @@ function getRandomInt(min, max) {
1928
2029class GameMap {
2130 constructor ( width , height , mountain , city , swamp , kings ) {
22- this . width = parseInt ( kings . length * 2.7 + 10 * width ) ;
23- this . height = parseInt ( kings . length * 2.7 + 10 * height ) ;
31+ this . width = parseInt ( kings . length * 5 + 6 * width ) ;
32+ this . height = parseInt ( kings . length * 5 + 6 * height ) ;
2433 if ( mountain + city === 0 ) {
2534 this . mountain = this . city = 0
2635 } else {
@@ -120,6 +129,7 @@ class GameMap {
120129 }
121130 }
122131 }
132+ console . log ( 'Kings generated successfully' ) ;
123133 // Generate the mountain
124134 for ( let i = 1 ; i <= this . mountain ; ++ i ) {
125135 let generated = false
@@ -139,6 +149,7 @@ class GameMap {
139149 }
140150 if ( ! generated ) { this . mountain = i - 1 ; console . log ( "Mountain Interrupted" , i ) ; break }
141151 }
152+ console . log ( 'Mountains generated successfully' ) ;
142153 // Generate the city
143154 for ( let i = 1 ; i <= this . city ; ++ i ) {
144155 let generated = false
@@ -159,6 +170,7 @@ class GameMap {
159170 }
160171 if ( ! generated ) { this . city = i - 1 ; console . log ( "City Interrupted" , i ) ; break }
161172 }
173+ console . log ( 'Cities generated successfully' ) ;
162174 // Generate the swamp.
163175 for ( let i = 1 , x , y ; i <= this . swamp ; ++ i ) {
164176 while ( true ) {
@@ -168,6 +180,7 @@ class GameMap {
168180 }
169181 this . map [ x ] [ y ] . type = 'Swamp'
170182 }
183+ console . log ( 'Swamps generated successfully' ) ;
171184 let kings = this . kings
172185 return new Promise ( function ( resolve , reject ) {
173186 console . log ( 'Map generated successfully' )
0 commit comments