@reldens/skills 0.12.1 → 0.15.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.
@@ -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 an specific one for this level
56
- // and don't send extra information we already have on the client.
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 > 0){
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 < this.randomInteger(1, 100);
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)
@@ -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.12.1",
4
+ "version": "0.15.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.11.0"
45
+ "@reldens/utils": "^0.15.0"
46
46
  }
47
47
  }