@reldens/skills 0.59.0 → 0.61.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.
@@ -126,15 +126,20 @@ jobs:
126
126
  PKG_NAME="${{ steps.meta.outputs.name }}"
127
127
  PKG_VERSION="${{ steps.meta.outputs.version }}"
128
128
  DIST_TAG="${{ steps.disttag.outputs.value }}"
129
- for ATTEMPT in 1 2 3 4 5 6 7 8 9 10; do
130
- FOUND=$(npm view "$PKG_NAME@$PKG_VERSION" version --registry=https://registry.npmjs.org/ --prefer-online --loglevel=error 2>/dev/null || true)
131
- TAGGED=$(npm view "$PKG_NAME" "dist-tags.$DIST_TAG" --registry=https://registry.npmjs.org/ --prefer-online --loglevel=error 2>/dev/null || true)
132
- if [ "$FOUND" = "$PKG_VERSION" ] && [ "$TAGGED" = "$PKG_VERSION" ]; then
133
- echo "Confirmed on the registry: $PKG_NAME@$PKG_VERSION with dist-tag $DIST_TAG."
129
+ ENCODED_NAME=$(printf '%s' "$PKG_NAME" | sed 's|/|%2F|g')
130
+ for ATTEMPT in $(seq 1 40); do
131
+ STAMP=$(date +%s%N)
132
+ VERSION_STATUS=$(curl -s -o /dev/null -w '%{http_code}' -H 'Cache-Control: no-cache' \
133
+ "https://registry.npmjs.org/$ENCODED_NAME/$PKG_VERSION?cache=$STAMP" || true)
134
+ TAGGED=$(curl -s -H 'Cache-Control: no-cache' \
135
+ "https://registry.npmjs.org/-/package/$ENCODED_NAME/dist-tags?cache=$STAMP" \
136
+ | grep -o "\"$DIST_TAG\":\"[^\"]*\"" | head -n 1 | cut -d'"' -f4 || true)
137
+ if [ "$VERSION_STATUS" = "200" ] && [ "$TAGGED" = "$PKG_VERSION" ]; then
138
+ echo "Confirmed on the registry after $ATTEMPT checks: $PKG_NAME@$PKG_VERSION with dist-tag $DIST_TAG."
134
139
  exit 0
135
140
  fi
136
- echo "Attempt $ATTEMPT: $PKG_NAME@$PKG_VERSION is not on the registry yet, the dist-tag $DIST_TAG points to [${TAGGED:-none}]. Retry in 60s."
137
- sleep 60
141
+ echo "Check $ATTEMPT: the version document answered [$VERSION_STATUS], the dist-tag $DIST_TAG points to [${TAGGED:-none}]. Next check in 15s."
142
+ sleep 15
138
143
  done
139
144
  echo "::error::$PKG_NAME@$PKG_VERSION with dist-tag $DIST_TAG was not confirmed on the registry after 10 minutes. Check https://www.npmjs.com/package/$PKG_NAME before releasing again, published versions are immutable."
140
145
  exit 1
@@ -36,9 +36,15 @@ class PhysicalAttack extends Attack
36
36
 
37
37
  async executeOnHit(target)
38
38
  {
39
- return PhysicalSkillRunner.executeOnHit(target, this, SkillsEvents.SKILL_PHYSICAL_ATTACK_HIT, async () => {
40
- return await super.runSkillLogic();
41
- });
39
+ return PhysicalSkillRunner.executeOnHit(
40
+ target,
41
+ this,
42
+ SkillsEvents.SKILL_PHYSICAL_ATTACK_HIT,
43
+ async (hitTarget) => {
44
+ this.target = hitTarget;
45
+ return await super.runSkillLogic();
46
+ }
47
+ );
42
48
  }
43
49
 
44
50
  }
@@ -36,9 +36,15 @@ class PhysicalEffect extends Effect
36
36
 
37
37
  async executeOnHit(target)
38
38
  {
39
- return PhysicalSkillRunner.executeOnHit(target, this, SkillsEvents.SKILL_PHYSICAL_EFFECT_HIT, async () => {
40
- return await super.runSkillLogic();
41
- });
39
+ return PhysicalSkillRunner.executeOnHit(
40
+ target,
41
+ this,
42
+ SkillsEvents.SKILL_PHYSICAL_EFFECT_HIT,
43
+ async (hitTarget) => {
44
+ this.target = hitTarget;
45
+ return await super.runSkillLogic();
46
+ }
47
+ );
42
48
  }
43
49
 
44
50
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@reldens/skills",
3
3
  "scope": "@reldens",
4
- "version": "0.59.0",
4
+ "version": "0.61.0",
5
5
  "description": "Reldens - Skills",
6
6
  "author": "Damian A. Pastorini",
7
7
  "license": "MIT",
@@ -46,7 +46,7 @@
46
46
  "test:coverage": "node --test --experimental-test-coverage tests/run-tests.js"
47
47
  },
48
48
  "dependencies": {
49
- "@reldens/modifiers": "^0.43.0",
50
- "@reldens/utils": "^0.66.0"
49
+ "@reldens/modifiers": "^0.44.0",
50
+ "@reldens/utils": "^0.67.0"
51
51
  }
52
52
  }
@@ -230,7 +230,7 @@ describe('PhysicalAttack', () => {
230
230
  assert.strictEqual(result, false);
231
231
  });
232
232
 
233
- it('should skip validation when validateTargetOnHit is false', async () => {
233
+ it('should damage the hit body and not the selected target when validateTargetOnHit is false', async () => {
234
234
  let differentTarget = new MockTarget();
235
235
  differentTarget.id = 'different-id';
236
236
  let skillData = {
@@ -241,9 +241,13 @@ describe('PhysicalAttack', () => {
241
241
  applyDirectDamage: true
242
242
  };
243
243
  let skill = new PhysicalAttack(skillData);
244
- let initialHp = mockTarget.stats.hp;
244
+ let selectedTargetHp = mockTarget.stats.hp;
245
+ let hitTargetHp = differentTarget.stats.hp;
245
246
  await skill.executeOnHit(differentTarget);
246
- assert.ok(mockTarget.stats.hp < initialHp);
247
+ assert.deepStrictEqual(
248
+ [mockTarget.stats.hp, differentTarget.stats.hp < hitTargetHp],
249
+ [selectedTargetHp, true]
250
+ );
247
251
  });
248
252
 
249
253
  it('should call parent runSkillLogic', async () => {
@@ -358,7 +358,7 @@ describe('PhysicalEffect', () => {
358
358
  assert.strictEqual(result, false);
359
359
  });
360
360
 
361
- it('should skip validation when validateTargetOnHit is false', async () => {
361
+ it('should apply the effect to the hit body and not the selected target when validateTargetOnHit is false', async () => {
362
362
  let differentTarget = new MockTarget();
363
363
  differentTarget.id = 'different-id';
364
364
  let modifier = new Modifier({
@@ -378,9 +378,13 @@ describe('PhysicalEffect', () => {
378
378
  validateTargetOnHit: false
379
379
  };
380
380
  let skill = new PhysicalEffect(skillData);
381
- let initialDef = mockTarget.stats.def;
381
+ let selectedTargetDef = mockTarget.stats.def;
382
+ let hitTargetDef = differentTarget.stats.def;
382
383
  await skill.executeOnHit(differentTarget);
383
- assert.strictEqual(mockTarget.stats.def, initialDef + 15);
384
+ assert.deepStrictEqual(
385
+ [mockTarget.stats.def, differentTarget.stats.def],
386
+ [selectedTargetDef, hitTargetDef + 15]
387
+ );
384
388
  });
385
389
 
386
390
  it('should call parent runSkillLogic', async () => {