@vibemancer/core 1.0.7 → 1.0.9
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/LICENSE +21 -0
- package/dist/{chunk-NR326XEY.js → chunk-OLGKLCCB.js} +43 -13
- package/dist/chunk-OLGKLCCB.js.map +1 -0
- package/dist/{index-browser-iiIpqpDl.d.ts → index-browser-BTHlrB_s.d.ts} +87 -12
- package/dist/index-browser.d.ts +1 -1
- package/dist/index-browser.js +3 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/bots/sniper/01_Spellshot.ts +11 -5
- package/src/engine/manual-match.ts +3 -1
- package/src/engine/physics.ts +12 -2
- package/src/engine/simulation.ts +79 -2
- package/src/engine-version.ts +1 -1
- package/src/hooks/action-builders.ts +299 -266
- package/src/hooks/index.ts +84 -83
- package/src/hooks/threat-analysis.ts +396 -389
- package/src/hooks/types.ts +216 -200
- package/src/rules.ts +6 -1
- package/src/trace.ts +497 -490
- package/src/types.ts +9 -3
- package/dist/chunk-NR326XEY.js.map +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Low Entry
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -51,6 +51,11 @@ var RULES = {
|
|
|
51
51
|
// base hitbox radius in units
|
|
52
52
|
MISSILE_DAMAGE_RADIUS_SCALE: 0.1,
|
|
53
53
|
// additional radius per damage point
|
|
54
|
+
// The real hitbox is THREE TIMES the base+scale figure. This lived as a bare `* 3` inside
|
|
55
|
+
// calculateMissileRadius, outside RULES, so no document could interpolate it — and five
|
|
56
|
+
// of them consequently stated the unmultiplied formula, understating the hit window by
|
|
57
|
+
// 43-57%. It is a rule, so it lives with the rules.
|
|
58
|
+
MISSILE_RADIUS_MULTIPLIER: 3,
|
|
54
59
|
MISSILE_BASE_CAST: 0.1,
|
|
55
60
|
MISSILE_DAMAGE_SCALE: 0.226,
|
|
56
61
|
MISSILE_DAMAGE_POWER: 2 / 3,
|
|
@@ -95,7 +100,7 @@ var MISSILE_MIN_CAST_TIME = RULES.MISSILE_MIN_CAST_TIME;
|
|
|
95
100
|
var MISSILE_BASE_RADIUS = RULES.MISSILE_BASE_RADIUS;
|
|
96
101
|
var MISSILE_DAMAGE_RADIUS_SCALE = RULES.MISSILE_DAMAGE_RADIUS_SCALE;
|
|
97
102
|
function calculateMissileRadius(damage) {
|
|
98
|
-
return (RULES.MISSILE_BASE_RADIUS + damage * RULES.MISSILE_DAMAGE_RADIUS_SCALE) *
|
|
103
|
+
return (RULES.MISSILE_BASE_RADIUS + damage * RULES.MISSILE_DAMAGE_RADIUS_SCALE) * RULES.MISSILE_RADIUS_MULTIPLIER;
|
|
99
104
|
}
|
|
100
105
|
var MISSILE_BASE_CAST = RULES.MISSILE_BASE_CAST;
|
|
101
106
|
var MISSILE_DAMAGE_SCALE = RULES.MISSILE_DAMAGE_SCALE;
|
|
@@ -208,7 +213,7 @@ function currentRuleset() {
|
|
|
208
213
|
}
|
|
209
214
|
|
|
210
215
|
// src/engine-version.ts
|
|
211
|
-
var ENGINE_VERSION =
|
|
216
|
+
var ENGINE_VERSION = 293192982913104;
|
|
212
217
|
var EQUIVALENT_ENGINE_VERSIONS = [1688330189011034];
|
|
213
218
|
|
|
214
219
|
// src/replay-compat.ts
|
|
@@ -444,6 +449,12 @@ function createActionBuilder(baseAction) {
|
|
|
444
449
|
...action,
|
|
445
450
|
move: { x, y }
|
|
446
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 });
|
|
447
458
|
}
|
|
448
459
|
};
|
|
449
460
|
}
|
|
@@ -462,6 +473,9 @@ function missile(config, ai, direction) {
|
|
|
462
473
|
}
|
|
463
474
|
});
|
|
464
475
|
}
|
|
476
|
+
function aim(degrees) {
|
|
477
|
+
return createActionBuilder(Number.isFinite(degrees) ? { aimDirection: degrees } : {});
|
|
478
|
+
}
|
|
465
479
|
function blink(x, y) {
|
|
466
480
|
return createFinalAction({
|
|
467
481
|
move: { x: 0, y: 0 },
|
|
@@ -511,8 +525,8 @@ function extractAction(finalAction) {
|
|
|
511
525
|
|
|
512
526
|
// src/engine/physics.ts
|
|
513
527
|
function moveWizard(wizard, move2, deltaTicks) {
|
|
514
|
-
let dx = move2.x
|
|
515
|
-
let dy = move2.y
|
|
528
|
+
let dx = Number.isFinite(move2?.x) ? move2.x : 0;
|
|
529
|
+
let dy = Number.isFinite(move2?.y) ? move2.y : 0;
|
|
516
530
|
const magnitude2 = Math.sqrt(dx * dx + dy * dy);
|
|
517
531
|
if (magnitude2 > 1) {
|
|
518
532
|
dx = dx / magnitude2;
|
|
@@ -865,6 +879,8 @@ function tick(currentTick, wizard1AI, wizard2AI, config, wizards, projectiles, m
|
|
|
865
879
|
const enemy = wizards[1 - i];
|
|
866
880
|
if (action.aimDirection !== void 0 && Number.isFinite(action.aimDirection)) {
|
|
867
881
|
wizard.rotation = action.aimDirection;
|
|
882
|
+
} else if (wizard.state === "casting" && wizard.castingSpell === "missile" && wizard.castAimDirection !== void 0) {
|
|
883
|
+
wizard.rotation = wizard.castAimDirection;
|
|
868
884
|
} else {
|
|
869
885
|
wizard.rotation = angleTo(wizard.position, enemy.position);
|
|
870
886
|
}
|
|
@@ -888,6 +904,7 @@ function tick(currentTick, wizard1AI, wizard2AI, config, wizards, projectiles, m
|
|
|
888
904
|
remainingTicks: validConfig.duration
|
|
889
905
|
};
|
|
890
906
|
projectiles.push(projectile);
|
|
907
|
+
wizard.castAimDirection = void 0;
|
|
891
908
|
missileAIs.set(id, wizard.missileAI);
|
|
892
909
|
events.push({ type: "missile-launch", position: { ...wizard.position }, damage: validConfig.damage, speed: validConfig.speed, ownerId: wizard.id, rotation: wizard.rotation });
|
|
893
910
|
wizard.lastMissileConfig = { ...validConfig };
|
|
@@ -974,6 +991,7 @@ function tick(currentTick, wizard1AI, wizard2AI, config, wizards, projectiles, m
|
|
|
974
991
|
if (action.startCast.direction !== void 0) {
|
|
975
992
|
wizard.rotation = action.startCast.direction;
|
|
976
993
|
}
|
|
994
|
+
wizard.castAimDirection = action.aimDirection !== void 0 && Number.isFinite(action.aimDirection) ? action.aimDirection : void 0;
|
|
977
995
|
} else if (castingSpell === "blink") {
|
|
978
996
|
wizard.blinkTarget = action.startCast.target;
|
|
979
997
|
}
|
|
@@ -1219,9 +1237,18 @@ function getPlayerStateView(playerIndex, wizards, projectiles, tick2) {
|
|
|
1219
1237
|
// AI views don't need events
|
|
1220
1238
|
};
|
|
1221
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
|
+
}
|
|
1222
1247
|
var FIGHT_SPAWN_DISTANCES = [500, 550, 600, 650, 700];
|
|
1223
1248
|
function fight(wizard1AI, wizard2AI, options = {}) {
|
|
1224
1249
|
const matches = [];
|
|
1250
|
+
const allErrors = [];
|
|
1251
|
+
let matchNumber = 1;
|
|
1225
1252
|
let wizard1Wins = 0;
|
|
1226
1253
|
let wizard2Wins = 0;
|
|
1227
1254
|
let draws = 0;
|
|
@@ -1234,6 +1261,8 @@ function fight(wizard1AI, wizard2AI, options = {}) {
|
|
|
1234
1261
|
budget
|
|
1235
1262
|
});
|
|
1236
1263
|
matches.push(result);
|
|
1264
|
+
allErrors.push(...result.errors.map((e) => ({ ...e, match: matchNumber })));
|
|
1265
|
+
matchNumber++;
|
|
1237
1266
|
if (result.winner === "wizard-1") {
|
|
1238
1267
|
wizard1Wins++;
|
|
1239
1268
|
} else if (result.winner === "wizard-2") {
|
|
@@ -1252,6 +1281,8 @@ function fight(wizard1AI, wizard2AI, options = {}) {
|
|
|
1252
1281
|
if (budget && swappedBudget) {
|
|
1253
1282
|
budget.states = [swappedBudget.states[1], swappedBudget.states[0]];
|
|
1254
1283
|
}
|
|
1284
|
+
allErrors.push(...swapped.errors.map((e) => ({ ...e, entityId: swapSide(e.entityId), match: matchNumber })));
|
|
1285
|
+
matchNumber++;
|
|
1255
1286
|
if (swapped.winner === "wizard-1") {
|
|
1256
1287
|
wizard2Wins++;
|
|
1257
1288
|
} else if (swapped.winner === "wizard-2") {
|
|
@@ -1261,7 +1292,7 @@ function fight(wizard1AI, wizard2AI, options = {}) {
|
|
|
1261
1292
|
}
|
|
1262
1293
|
}
|
|
1263
1294
|
const winner = wizard1Wins > wizard2Wins ? "wizard-1" : wizard2Wins > wizard1Wins ? "wizard-2" : "draw";
|
|
1264
|
-
return { wizard1Wins, wizard2Wins, draws, winner, matches };
|
|
1295
|
+
return { wizard1Wins, wizard2Wins, draws, winner, matches, allErrors };
|
|
1265
1296
|
}
|
|
1266
1297
|
function simulate(wizard1AI, wizard2AI, options = {}) {
|
|
1267
1298
|
if (typeof wizard1AI !== "function") {
|
|
@@ -1923,7 +1954,7 @@ function analyzeThreats(myPos, projectiles, myProjectiles, ticksUntilReady) {
|
|
|
1923
1954
|
return threats;
|
|
1924
1955
|
}
|
|
1925
1956
|
function analyzeOneThreat(targetPos, projectile, ticksUntilReady) {
|
|
1926
|
-
const missileRadius =
|
|
1957
|
+
const missileRadius = calculateMissileRadius(projectile.damage);
|
|
1927
1958
|
const collisionDist = COLLISION_RADIUS + missileRadius;
|
|
1928
1959
|
const dodgeCollisionDist = collisionDist + projectile.speed * 0.5;
|
|
1929
1960
|
const { willHit, ticksToImpact } = simulateMissileToTarget(
|
|
@@ -4469,8 +4500,8 @@ function Archlich() {
|
|
|
4469
4500
|
if (cfg2 && cfg2.damage >= MIN_USEFUL_DAMAGE) {
|
|
4470
4501
|
const ct = getMissileCastTime(cfg2, lastMissileConfig);
|
|
4471
4502
|
if (ct + distance / cfg2.speed < vulnTicks) {
|
|
4472
|
-
const
|
|
4473
|
-
return missile(cfg2, cfg2.turnRate > 0 ? HomingAI4 : StraightAI2, angleTo(position,
|
|
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);
|
|
4474
4505
|
}
|
|
4475
4506
|
}
|
|
4476
4507
|
}
|
|
@@ -10306,10 +10337,8 @@ function extractTraceEvents(history, errors) {
|
|
|
10306
10337
|
}
|
|
10307
10338
|
if (errors && errors.length > 0) {
|
|
10308
10339
|
for (const err of errors) {
|
|
10309
|
-
const
|
|
10310
|
-
|
|
10311
|
-
"W1"
|
|
10312
|
-
) : "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";
|
|
10313
10342
|
events.push({
|
|
10314
10343
|
tick: err.tick,
|
|
10315
10344
|
actor,
|
|
@@ -10544,6 +10573,7 @@ export {
|
|
|
10544
10573
|
resetAllHooks,
|
|
10545
10574
|
shield,
|
|
10546
10575
|
missile,
|
|
10576
|
+
aim,
|
|
10547
10577
|
blink,
|
|
10548
10578
|
cancel,
|
|
10549
10579
|
move,
|
|
@@ -10693,4 +10723,4 @@ export {
|
|
|
10693
10723
|
diagnoseTrace,
|
|
10694
10724
|
formatDiagnosis
|
|
10695
10725
|
};
|
|
10696
|
-
//# sourceMappingURL=chunk-
|
|
10726
|
+
//# sourceMappingURL=chunk-OLGKLCCB.js.map
|