@reldens/skills 0.30.0 → 0.32.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.
package/lib/constants.js
CHANGED
|
@@ -61,6 +61,7 @@ module.exports = {
|
|
|
61
61
|
APPLIED_CRITICAL_DAMAGE: 'appliedCriticalDamage',
|
|
62
62
|
APPLYING_EFFECTS: 'applyingEffects',
|
|
63
63
|
APPLIED_EFFECTS: 'appliedEffects',
|
|
64
|
-
EXECUTE_PHYSICAL_ATTACK: 'executePhysicalAttack'
|
|
64
|
+
EXECUTE_PHYSICAL_ATTACK: 'executePhysicalAttack',
|
|
65
|
+
TARGET_NOT_AVAILABLE: 'targetNotAvailable'
|
|
65
66
|
}
|
|
66
67
|
};
|
package/lib/levels-set.js
CHANGED
|
@@ -195,7 +195,8 @@ class LevelsSet
|
|
|
195
195
|
nextLevelIndex,
|
|
196
196
|
nextLevelKey,
|
|
197
197
|
nextLevel,
|
|
198
|
-
nextLevelExp
|
|
198
|
+
nextLevelExp,
|
|
199
|
+
isLevelUp
|
|
199
200
|
);
|
|
200
201
|
}
|
|
201
202
|
|
|
@@ -260,4 +261,4 @@ class LevelsSet
|
|
|
260
261
|
|
|
261
262
|
}
|
|
262
263
|
|
|
263
|
-
module.exports = LevelsSet;
|
|
264
|
+
module.exports = LevelsSet;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
const { ClassPathGenerator } = require('./class-path-generator');
|
|
8
8
|
const { DataServerValidator } = require('../data-server-validator');
|
|
9
9
|
const { SkillsGenerator } = require('./skills-generator');
|
|
10
|
-
const {
|
|
10
|
+
const { EventsManagerSingleton, Logger, sc } = require('@reldens/utils');
|
|
11
11
|
|
|
12
12
|
class ModelsManager
|
|
13
13
|
{
|
|
@@ -28,7 +28,7 @@ class ModelsManager
|
|
|
28
28
|
return await this.getEntity('ownersClassPath').loadOneByWithRelations(
|
|
29
29
|
'owner_id',
|
|
30
30
|
ownerId,
|
|
31
|
-
'
|
|
31
|
+
'owner_full_class_path'
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -74,6 +74,7 @@ class ModelsManager
|
|
|
74
74
|
);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
// @TODO - Refactor or remove this method.
|
|
77
78
|
async prepareClassPathData(owner, ownerIdProperty, classPathsListById, skillsClassesList)
|
|
78
79
|
{
|
|
79
80
|
// @TODO - BETA - Temporal one class path per player, we will have optional multiple classes.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
const { ModifiersGenerator } = require('./modifiers-generator');
|
|
8
8
|
const { ConditionsGenerator } = require('./conditions-generator');
|
|
9
|
-
const {
|
|
9
|
+
const { ErrorManager, sc } = require('@reldens/utils');
|
|
10
10
|
|
|
11
11
|
class SkillsGenerator
|
|
12
12
|
{
|
|
@@ -56,7 +56,7 @@ class SkillsGenerator
|
|
|
56
56
|
}
|
|
57
57
|
return skillsByLevel;
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
|
|
60
60
|
static enrichWithPhysicalData(skillModel)
|
|
61
61
|
{
|
|
62
62
|
if(!sc.isTrue(skillModel, 'skill_physical_data')){
|
package/lib/types/attack.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
const Skill = require('../skill');
|
|
10
10
|
const SkillsEvents = require('../skills-events');
|
|
11
11
|
const SkillsConst = require('../constants');
|
|
12
|
-
const { ErrorManager, sc } = require('@reldens/utils');
|
|
12
|
+
const { ErrorManager, sc, Logger} = require('@reldens/utils');
|
|
13
13
|
|
|
14
14
|
class Attack extends Skill
|
|
15
15
|
{
|
|
@@ -61,11 +61,23 @@ class Attack extends Skill
|
|
|
61
61
|
|
|
62
62
|
async applyDamageTo(target)
|
|
63
63
|
{
|
|
64
|
+
if(!target){
|
|
65
|
+
this.lastState = SkillsConst.SKILL_STATES.TARGET_NOT_AVAILABLE;
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
64
68
|
// @NOTE: both owner and target properties values has to be calculated at the time the skill is executed, that
|
|
65
69
|
// is why we are getting the target always as parameter.
|
|
66
70
|
// check if the skill can be dodged:
|
|
67
71
|
let ownerAim = this.getPropertiesTotal(this.owner, this.aimProperties);
|
|
72
|
+
if(false === ownerAim){
|
|
73
|
+
Logger.debug('Missing owner aim properties.', this.owner);
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
68
76
|
let targetDodge = this.getPropertiesTotal(target, this.dodgeProperties);
|
|
77
|
+
if(false === targetDodge){
|
|
78
|
+
Logger.debug('Missing target dodge properties.', target);
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
69
81
|
if(this.dodgeFullEnabled && targetDodge > (ownerAim * this.dodgeOverAimSuccess)){
|
|
70
82
|
this.lastState = SkillsConst.SKILL_STATES.DODGED;
|
|
71
83
|
return false;
|
|
@@ -129,17 +141,26 @@ class Attack extends Skill
|
|
|
129
141
|
|
|
130
142
|
getPropertiesTotal(object, propertiesArray)
|
|
131
143
|
{
|
|
144
|
+
if(!object){
|
|
145
|
+
Logger.warning('Missing object to get properties total.');
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
132
148
|
if(0 === propertiesArray.length){
|
|
133
149
|
return 0;
|
|
134
150
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
let
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
151
|
+
try {
|
|
152
|
+
let totalValue = 0;
|
|
153
|
+
for(let prop of propertiesArray){
|
|
154
|
+
let propValue = this.propertyManager.getPropertyValue(object, prop);
|
|
155
|
+
totalValue = sc.hasOwn(this.propertiesTotalOperators, prop)
|
|
156
|
+
? this.calculator.calculateNewValue(totalValue, this.propertiesTotalOperators[prop], propValue)
|
|
157
|
+
: totalValue + propValue;
|
|
158
|
+
}
|
|
159
|
+
return totalValue;
|
|
160
|
+
} catch (error) {
|
|
161
|
+
Logger.debug(error.message);
|
|
162
|
+
return false;
|
|
141
163
|
}
|
|
142
|
-
return totalValue;
|
|
143
164
|
}
|
|
144
165
|
|
|
145
166
|
getDiffProportion(totalValue, upProportionValue)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reldens/skills",
|
|
3
3
|
"scope": "@reldens",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.32.0",
|
|
5
5
|
"description": "Reldens - Skills",
|
|
6
6
|
"author": "Damian A. Pastorini",
|
|
7
7
|
"license": "MIT",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"url": "https://github.com/damian-pastorini/reldens-skills/issues"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@reldens/modifiers": "^0.
|
|
43
|
+
"@reldens/modifiers": "^0.25.0",
|
|
44
44
|
"@reldens/storage": "^0.29.0",
|
|
45
|
-
"@reldens/utils": "^0.
|
|
45
|
+
"@reldens/utils": "^0.38.0"
|
|
46
46
|
}
|
|
47
47
|
}
|