@adatechnology/game-contracts 0.19.0 → 0.20.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/dist/index.js CHANGED
@@ -344,6 +344,38 @@ var ignitionChance = (hit, target, rules = DEFAULT_IGNITION_RULES) => {
344
344
  return 1 - (1 - Math.min(1, Math.max(0, spark))) * (1 - Math.min(1, Math.max(0, flame)));
345
345
  };
346
346
 
347
+ // src/seal.ts
348
+ var sealOpener = (seal, tools) => {
349
+ if (seal.byHand || !seal.openWith || seal.openWith.length === 0) return { ok: true };
350
+ const have = new Set(tools);
351
+ const tool = seal.openWith.find((id) => have.has(id));
352
+ return tool === void 0 ? { ok: false } : { ok: true, tool };
353
+ };
354
+ var sealBlock = (seal, state) => {
355
+ if (seal.spoilsWhenBreached && state.breached) return "breached";
356
+ if (seal.spoilsWhenBreached && state.leaked) return "leaked";
357
+ if (!state.opened) return "sealed";
358
+ return void 0;
359
+ };
360
+
361
+ // src/twist.ts
362
+ var TWIST_LIFT = 0.012;
363
+ var TURNING = 0.7;
364
+ var smooth = (k) => k * k * (3 - 2 * k);
365
+ var twistStroke = (share, options = {}) => {
366
+ const strokes = Math.max(1, Math.round(options.strokes ?? 3));
367
+ const reach = options.reach ?? 1.6;
368
+ const along = Math.min(1, Math.max(0, share)) * strokes;
369
+ const index = Math.min(strokes - 1, Math.floor(along));
370
+ const phase = along - index;
371
+ if (phase <= TURNING) {
372
+ const k2 = smooth(phase / TURNING);
373
+ return { angle: reach * (k2 - 0.5), turned: reach * (index + k2), grip: 1, lift: 0 };
374
+ }
375
+ const k = (phase - TURNING) / (1 - TURNING);
376
+ return { angle: reach * (0.5 - smooth(k)), turned: reach * (index + 1), grip: 0.35, lift: Math.sin(k * Math.PI) };
377
+ };
378
+
347
379
  // src/animation.ts
348
380
  var finite3 = (v) => Array.isArray(v) && v.length === 3 && v.every((n) => typeof n === "number" && Number.isFinite(n));
349
381
  var checkAnimation = (clip, partIds) => {
@@ -838,6 +870,7 @@ export {
838
870
  MISSING_BITS,
839
871
  STAGE_EVENT,
840
872
  TOOL_CLIP,
873
+ TWIST_LIFT,
841
874
  applyPatches,
842
875
  blastShove,
843
876
  checkAnimation,
@@ -862,10 +895,13 @@ export {
862
895
  resolveIgnitionRules,
863
896
  sampleClip,
864
897
  scaleClip,
898
+ sealBlock,
899
+ sealOpener,
865
900
  shotExtras,
866
901
  shotToHit,
867
902
  sparkTargetFactor,
868
903
  toolAnimationStep,
904
+ twistStroke,
869
905
  unmarkedDrawings,
870
906
  useToHit
871
907
  };