@reldens/skills 0.16.4 → 0.16.5
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/skill.js
CHANGED
|
@@ -47,6 +47,8 @@ class Skill
|
|
|
47
47
|
this.canActivate = sc.get(props, 'canActivate', true);
|
|
48
48
|
this.range = sc.get(props, 'range', 0);
|
|
49
49
|
this.lastState = '';
|
|
50
|
+
this.groups = sc.get(props, 'groups', []);
|
|
51
|
+
this.lastAppliedModifiers = {};
|
|
50
52
|
// if enabled range will be validated just before execution to get the owner and target realtime positions:
|
|
51
53
|
this.rangeAutomaticValidation = sc.get(props, 'rangeAutomaticValidation', false);
|
|
52
54
|
// @NOTE: if automatic range validation is enabled the rangePropertyX and rangePropertyY will be required and
|
|
@@ -64,8 +66,6 @@ class Skill
|
|
|
64
66
|
this.ownerConditions = sc.get(props, 'ownerConditions', []);
|
|
65
67
|
// owner effects will be applied when the skill is executed:
|
|
66
68
|
this.ownerEffects = sc.get(props, 'ownerEffects', []);
|
|
67
|
-
// groups:
|
|
68
|
-
this.groups = sc.get(props, 'groups', []);
|
|
69
69
|
// critical multiplier and critical chance are to specify how and if a skill hit is critical:
|
|
70
70
|
this.criticalChance = sc.get(props, 'criticalChance', 0);
|
|
71
71
|
this.criticalMultiplier = sc.get(props, 'criticalMultiplier', 1);
|
|
@@ -270,6 +270,7 @@ class Skill
|
|
|
270
270
|
|
|
271
271
|
applyModifiers(modifiersObjectList, target, avoidCritical = false)
|
|
272
272
|
{
|
|
273
|
+
this.lastAppliedModifiers = {};
|
|
273
274
|
for(let i of Object.keys(modifiersObjectList)){
|
|
274
275
|
let modifier = modifiersObjectList[i];
|
|
275
276
|
modifier.target = target;
|
|
@@ -278,6 +279,7 @@ class Skill
|
|
|
278
279
|
newValue = this.applyCriticalValue(newValue);
|
|
279
280
|
}
|
|
280
281
|
modifier.setOwnerProperty(modifier.propertyKey, newValue);
|
|
282
|
+
this.lastAppliedModifiers[modifier.propertyKey] = newValue;
|
|
281
283
|
}
|
|
282
284
|
}
|
|
283
285
|
|
package/lib/types/effect.js
CHANGED
|
@@ -28,7 +28,7 @@ class Effect extends Skill
|
|
|
28
28
|
{
|
|
29
29
|
if(!this.validateRange(this.target)){
|
|
30
30
|
this.lastState = SkillsConst.SKILL_STATES.OUT_OF_RANGE;
|
|
31
|
-
// out of range, the owner or the target could
|
|
31
|
+
// out of range, the owner or the target could move away
|
|
32
32
|
return false;
|
|
33
33
|
}
|
|
34
34
|
this.lastState = SkillsConst.SKILL_STATES.APPLYING_EFFECTS;
|
|
@@ -20,6 +20,7 @@ class PhysicalAttack extends Attack
|
|
|
20
20
|
{
|
|
21
21
|
super(props);
|
|
22
22
|
this.type = SkillsConst.SKILL_TYPE_PHYSICAL_ATTACK;
|
|
23
|
+
this.parentType = SkillsConst.SKILL_TYPE_ATTACK;
|
|
23
24
|
PhysicalPropertiesValidator.validate(props);
|
|
24
25
|
this.magnitude = props.magnitude;
|
|
25
26
|
this.objectWidth = props.objectWidth;
|
|
@@ -20,6 +20,7 @@ class PhysicalEffect extends Effect
|
|
|
20
20
|
{
|
|
21
21
|
super(props);
|
|
22
22
|
this.type = SkillsConst.SKILL_TYPE_PHYSICAL_EFFECT;
|
|
23
|
+
this.parentType = SkillsConst.SKILL_TYPE_EFFECT;
|
|
23
24
|
PhysicalPropertiesValidator.validate(props);
|
|
24
25
|
this.magnitude = props.magnitude;
|
|
25
26
|
this.objectWidth = props.objectWidth;
|