@reldens/skills 0.12.0 → 0.14.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/server/sender.js +4 -6
- package/lib/skill.js +2 -7
- package/lib/types/attack.js +3 -3
- package/package.json +2 -2
package/lib/server/sender.js
CHANGED
|
@@ -52,8 +52,8 @@ class Sender
|
|
|
52
52
|
if(nextLevelExp > 0){
|
|
53
53
|
messageData.ne = nextLevelExp;
|
|
54
54
|
}
|
|
55
|
-
// @NOTE: we could send just this.currentLabel but better check if there's
|
|
56
|
-
//
|
|
55
|
+
// @NOTE: we could send just this.currentLabel but better check if there's a specific one for this level and
|
|
56
|
+
// don't send extra information we already have on the client.
|
|
57
57
|
if(classPath.labelsByLevel[classPath.currentLevel]){
|
|
58
58
|
messageData.nl = classPath.labelsByLevel[classPath.currentLevel];
|
|
59
59
|
}
|
|
@@ -121,9 +121,7 @@ class Sender
|
|
|
121
121
|
|
|
122
122
|
async onSkillAttachApplyDamage(skill, target, damage, newValue)
|
|
123
123
|
{
|
|
124
|
-
let messageData = {
|
|
125
|
-
d: damage
|
|
126
|
-
};
|
|
124
|
+
let messageData = {d: damage};
|
|
127
125
|
if(typeof skill.owner.getSkillExtraData === 'function'){
|
|
128
126
|
Object.assign(messageData, {extraData: skill.owner.getSkillExtraData({skill, target})});
|
|
129
127
|
}
|
|
@@ -137,7 +135,7 @@ class Sender
|
|
|
137
135
|
|
|
138
136
|
async runBehaviors(messageData, actionName, behavior, ownerId)
|
|
139
137
|
{
|
|
140
|
-
// @NOTE: since the sender is a new instance for each SkillsServer but it's listening on a single EventsManager
|
|
138
|
+
// @NOTE: since the sender is a new instance for each SkillsServer, but it's listening on a single EventsManager
|
|
141
139
|
// which fires the event for every player then we need to check if the current event fired was related to the
|
|
142
140
|
// current player.
|
|
143
141
|
if(this.classPath.getOwnerId() !== ownerId){
|
package/lib/skill.js
CHANGED
|
@@ -190,7 +190,7 @@ class Skill
|
|
|
190
190
|
this.applyModifiers(this.ownerEffects, this.owner, true);
|
|
191
191
|
await this.fireEvent(SkillsEvents.SKILL_APPLY_OWNER_EFFECTS, this, target);
|
|
192
192
|
}
|
|
193
|
-
if(this.castTime
|
|
193
|
+
if(0 < this.castTime){
|
|
194
194
|
await this.fireEvent(SkillsEvents.SKILL_BEFORE_CAST, this, target);
|
|
195
195
|
this.owner.isCasting = setTimeout(() => {
|
|
196
196
|
skillLogicResult = this.finishExecution(target);
|
|
@@ -263,12 +263,7 @@ class Skill
|
|
|
263
263
|
if(this.criticalChance <= 0){
|
|
264
264
|
return false;
|
|
265
265
|
}
|
|
266
|
-
return this.criticalChance <
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
randomInteger(min, max)
|
|
270
|
-
{
|
|
271
|
-
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
266
|
+
return this.criticalChance < sc.randomInteger(1, 100);
|
|
272
267
|
}
|
|
273
268
|
|
|
274
269
|
applyModifiers(modifiersObjectList, target, avoidCritical = false)
|
package/lib/types/attack.js
CHANGED
|
@@ -67,12 +67,12 @@ class Attack extends Skill
|
|
|
67
67
|
return false;
|
|
68
68
|
}
|
|
69
69
|
let affectedPropertyValue = this.getAffectedPropertyValue(target);
|
|
70
|
-
if(!this.allowEffectBelowZero && 0
|
|
70
|
+
if(!this.allowEffectBelowZero && 0 >= affectedPropertyValue){
|
|
71
71
|
return false;
|
|
72
72
|
}
|
|
73
73
|
// dodge proportion:
|
|
74
74
|
let dodgeAimDiff = this.getDiffProportion(ownerAim, targetDodge);
|
|
75
|
-
let damage = this.applyDirectDamage
|
|
75
|
+
let damage = this.applyDirectDamage
|
|
76
76
|
? this.hitDamage // 100%
|
|
77
77
|
: this.calculateProportionDamage(target, this.hitDamage, targetDodge, ownerAim, dodgeAimDiff);
|
|
78
78
|
// critical calculation:
|
|
@@ -81,8 +81,8 @@ class Attack extends Skill
|
|
|
81
81
|
let modifiedValue = (!this.allowEffectBelowZero && affectedPropertyValue < damage)
|
|
82
82
|
? 0
|
|
83
83
|
: affectedPropertyValue - damage;
|
|
84
|
-
await this.fireEvent(SkillsEvents.SKILL_ATTACK_APPLY_DAMAGE, this, target, damage, modifiedValue);
|
|
85
84
|
this.setAffectedPropertyValue(target, modifiedValue);
|
|
85
|
+
await this.fireEvent(SkillsEvents.SKILL_ATTACK_APPLY_DAMAGE, this, target, damage, modifiedValue);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
calculateCriticalDamage(damage, targetDodge, ownerAim, dodgeAimDiff)
|
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.14.0",
|
|
5
5
|
"description": "Reldens - Skills",
|
|
6
6
|
"author": "Damian A. Pastorini",
|
|
7
7
|
"license": "MIT",
|
|
@@ -42,6 +42,6 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@reldens/modifiers": "^0.11.0",
|
|
44
44
|
"@reldens/storage": "^0.11.0",
|
|
45
|
-
"@reldens/utils": "^0.
|
|
45
|
+
"@reldens/utils": "^0.14.0"
|
|
46
46
|
}
|
|
47
47
|
}
|