@reldens/game-data-generator 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
*
|
|
3
|
-
* Reldens - Game Data Generator -
|
|
3
|
+
* Reldens - Game Data Generator - AttributesPerLevel
|
|
4
4
|
*
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -27,7 +27,10 @@ class AttributesPerLevel extends GameDataGenerator
|
|
|
27
27
|
this.typeTemplates = sc.get(options, 'typeTemplates', false);
|
|
28
28
|
this.typesVariations = sc.get(options, 'typesVariations', false);
|
|
29
29
|
// optional:
|
|
30
|
+
this.setBaseAsInitialLevel = sc.get(options, 'setBaseAsInitialLevel', false);
|
|
30
31
|
this.maxLevel = sc.get(options, 'maxLevel', 100);
|
|
32
|
+
this.scaleDivisor = sc.get(options, 'scaleDivisor', 10);
|
|
33
|
+
this.levelDivisor = sc.get(options, 'levelDivisor', 10);
|
|
31
34
|
this.jsonFileName = sc.get(options, 'jsonFileName', 'attributes-per-level-'+this.currentDate+'.json');
|
|
32
35
|
this.generateFolderPath = sc.get(options, 'generateFolderPath', 'generated');
|
|
33
36
|
}
|
|
@@ -77,10 +80,18 @@ class AttributesPerLevel extends GameDataGenerator
|
|
|
77
80
|
let result = {...base};
|
|
78
81
|
let scaleTypeFactor = this.typeScaleFactors[variationType];
|
|
79
82
|
let templatesProperties = Object.keys(this.typeTemplates[typeKey]);
|
|
80
|
-
for
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
for(let key of templatesProperties){
|
|
84
|
+
if(1 === level && this.setBaseAsInitialLevel){
|
|
85
|
+
result[key] = base[key];
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
let templateData = this.typeTemplates[typeKey][key];
|
|
89
|
+
let scale = sc.isObject(templateData)
|
|
90
|
+
? sc.randomInteger(templateData.min, templateData.max) + templateData.min
|
|
91
|
+
: templateData;
|
|
92
|
+
result[key] = Math.round(
|
|
93
|
+
base[key] * (1 + scale / this.scaleDivisor) * (1 + level / this.levelDivisor) * scaleTypeFactor
|
|
94
|
+
);
|
|
84
95
|
}
|
|
85
96
|
return result;
|
|
86
97
|
}
|