@vibemancer/core 1.0.8 → 1.0.10

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.
@@ -213,7 +213,7 @@ function currentRuleset() {
213
213
  }
214
214
 
215
215
  // src/engine-version.ts
216
- var ENGINE_VERSION = 3523070221336433;
216
+ var ENGINE_VERSION = 293192982913104;
217
217
  var EQUIVALENT_ENGINE_VERSIONS = [1688330189011034];
218
218
 
219
219
  // src/replay-compat.ts
@@ -449,6 +449,12 @@ function createActionBuilder(baseAction) {
449
449
  ...action,
450
450
  move: { x, y }
451
451
  });
452
+ },
453
+ lockAim() {
454
+ const cast = action.startCast;
455
+ const direction = cast && cast.spell === "missile" ? cast.direction : void 0;
456
+ if (direction === void 0 || !Number.isFinite(direction)) return createActionBuilder(baseAction);
457
+ return createActionBuilder({ ...baseAction, aimDirection: direction });
452
458
  }
453
459
  };
454
460
  }
@@ -467,6 +473,9 @@ function missile(config, ai, direction) {
467
473
  }
468
474
  });
469
475
  }
476
+ function aim(degrees) {
477
+ return createActionBuilder(Number.isFinite(degrees) ? { aimDirection: degrees } : {});
478
+ }
470
479
  function blink(x, y) {
471
480
  return createFinalAction({
472
481
  move: { x: 0, y: 0 },
@@ -516,8 +525,8 @@ function extractAction(finalAction) {
516
525
 
517
526
  // src/engine/physics.ts
518
527
  function moveWizard(wizard, move2, deltaTicks) {
519
- let dx = move2.x || 0;
520
- let dy = move2.y || 0;
528
+ let dx = Number.isFinite(move2?.x) ? move2.x : 0;
529
+ let dy = Number.isFinite(move2?.y) ? move2.y : 0;
521
530
  const magnitude2 = Math.sqrt(dx * dx + dy * dy);
522
531
  if (magnitude2 > 1) {
523
532
  dx = dx / magnitude2;
@@ -870,6 +879,8 @@ function tick(currentTick, wizard1AI, wizard2AI, config, wizards, projectiles, m
870
879
  const enemy = wizards[1 - i];
871
880
  if (action.aimDirection !== void 0 && Number.isFinite(action.aimDirection)) {
872
881
  wizard.rotation = action.aimDirection;
882
+ } else if (wizard.state === "casting" && wizard.castingSpell === "missile" && wizard.castAimDirection !== void 0) {
883
+ wizard.rotation = wizard.castAimDirection;
873
884
  } else {
874
885
  wizard.rotation = angleTo(wizard.position, enemy.position);
875
886
  }
@@ -893,6 +904,7 @@ function tick(currentTick, wizard1AI, wizard2AI, config, wizards, projectiles, m
893
904
  remainingTicks: validConfig.duration
894
905
  };
895
906
  projectiles.push(projectile);
907
+ wizard.castAimDirection = void 0;
896
908
  missileAIs.set(id, wizard.missileAI);
897
909
  events.push({ type: "missile-launch", position: { ...wizard.position }, damage: validConfig.damage, speed: validConfig.speed, ownerId: wizard.id, rotation: wizard.rotation });
898
910
  wizard.lastMissileConfig = { ...validConfig };
@@ -979,6 +991,7 @@ function tick(currentTick, wizard1AI, wizard2AI, config, wizards, projectiles, m
979
991
  if (action.startCast.direction !== void 0) {
980
992
  wizard.rotation = action.startCast.direction;
981
993
  }
994
+ wizard.castAimDirection = action.aimDirection !== void 0 && Number.isFinite(action.aimDirection) ? action.aimDirection : void 0;
982
995
  } else if (castingSpell === "blink") {
983
996
  wizard.blinkTarget = action.startCast.target;
984
997
  }
@@ -1224,9 +1237,18 @@ function getPlayerStateView(playerIndex, wizards, projectiles, tick2) {
1224
1237
  // AI views don't need events
1225
1238
  };
1226
1239
  }
1240
+ function swapSide(entityId) {
1241
+ if (entityId === "wizard-1") return "wizard-2";
1242
+ if (entityId === "wizard-2") return "wizard-1";
1243
+ if (entityId.startsWith("missile-wizard-1-")) return "missile-wizard-2-" + entityId.slice("missile-wizard-1-".length);
1244
+ if (entityId.startsWith("missile-wizard-2-")) return "missile-wizard-1-" + entityId.slice("missile-wizard-2-".length);
1245
+ return entityId;
1246
+ }
1227
1247
  var FIGHT_SPAWN_DISTANCES = [500, 550, 600, 650, 700];
1228
1248
  function fight(wizard1AI, wizard2AI, options = {}) {
1229
1249
  const matches = [];
1250
+ const allErrors = [];
1251
+ let matchNumber = 1;
1230
1252
  let wizard1Wins = 0;
1231
1253
  let wizard2Wins = 0;
1232
1254
  let draws = 0;
@@ -1239,6 +1261,8 @@ function fight(wizard1AI, wizard2AI, options = {}) {
1239
1261
  budget
1240
1262
  });
1241
1263
  matches.push(result);
1264
+ allErrors.push(...result.errors.map((e) => ({ ...e, match: matchNumber })));
1265
+ matchNumber++;
1242
1266
  if (result.winner === "wizard-1") {
1243
1267
  wizard1Wins++;
1244
1268
  } else if (result.winner === "wizard-2") {
@@ -1257,6 +1281,8 @@ function fight(wizard1AI, wizard2AI, options = {}) {
1257
1281
  if (budget && swappedBudget) {
1258
1282
  budget.states = [swappedBudget.states[1], swappedBudget.states[0]];
1259
1283
  }
1284
+ allErrors.push(...swapped.errors.map((e) => ({ ...e, entityId: swapSide(e.entityId), match: matchNumber })));
1285
+ matchNumber++;
1260
1286
  if (swapped.winner === "wizard-1") {
1261
1287
  wizard2Wins++;
1262
1288
  } else if (swapped.winner === "wizard-2") {
@@ -1266,7 +1292,7 @@ function fight(wizard1AI, wizard2AI, options = {}) {
1266
1292
  }
1267
1293
  }
1268
1294
  const winner = wizard1Wins > wizard2Wins ? "wizard-1" : wizard2Wins > wizard1Wins ? "wizard-2" : "draw";
1269
- return { wizard1Wins, wizard2Wins, draws, winner, matches };
1295
+ return { wizard1Wins, wizard2Wins, draws, winner, matches, allErrors };
1270
1296
  }
1271
1297
  function simulate(wizard1AI, wizard2AI, options = {}) {
1272
1298
  if (typeof wizard1AI !== "function") {
@@ -4474,8 +4500,8 @@ function Archlich() {
4474
4500
  if (cfg2 && cfg2.damage >= MIN_USEFUL_DAMAGE) {
4475
4501
  const ct = getMissileCastTime(cfg2, lastMissileConfig);
4476
4502
  if (ct + distance / cfg2.speed < vulnTicks) {
4477
- const aim = cfg2.turnRate > 0 ? enemy.position : getLeadPosition(enemy.position, enemy.velocity, cfg2.speed, position);
4478
- return missile(cfg2, cfg2.turnRate > 0 ? HomingAI4 : StraightAI2, angleTo(position, aim)).move(safeMove.x, safeMove.y);
4503
+ const aim2 = cfg2.turnRate > 0 ? enemy.position : getLeadPosition(enemy.position, enemy.velocity, cfg2.speed, position);
4504
+ return missile(cfg2, cfg2.turnRate > 0 ? HomingAI4 : StraightAI2, angleTo(position, aim2)).move(safeMove.x, safeMove.y);
4479
4505
  }
4480
4506
  }
4481
4507
  }
@@ -10311,10 +10337,8 @@ function extractTraceEvents(history, errors) {
10311
10337
  }
10312
10338
  if (errors && errors.length > 0) {
10313
10339
  for (const err of errors) {
10314
- const actor = err.entityId === "wizard-1" ? "W1" : err.entityId === "wizard-2" ? "W2" : err.entityId.startsWith("missile") ? (
10315
- /* missile errors attributed to owner */
10316
- "W1"
10317
- ) : "W1";
10340
+ const missileOwner = /^missile-(wizard-[12])-/.exec(err.entityId);
10341
+ const actor = err.entityId === "wizard-1" ? "W1" : err.entityId === "wizard-2" ? "W2" : missileOwner ? missileOwner[1] === "wizard-2" ? "W2" : "W1" : "W1";
10318
10342
  events.push({
10319
10343
  tick: err.tick,
10320
10344
  actor,
@@ -10549,6 +10573,7 @@ export {
10549
10573
  resetAllHooks,
10550
10574
  shield,
10551
10575
  missile,
10576
+ aim,
10552
10577
  blink,
10553
10578
  cancel,
10554
10579
  move,
@@ -10698,4 +10723,4 @@ export {
10698
10723
  diagnoseTrace,
10699
10724
  formatDiagnosis
10700
10725
  };
10701
- //# sourceMappingURL=chunk-MUU3ELH5.js.map
10726
+ //# sourceMappingURL=chunk-OLGKLCCB.js.map