@vibemancer/core 0.1.4 → 0.1.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.
Files changed (74) hide show
  1. package/README.md +2 -2
  2. package/dist/chunk-W7HWJFQ4.js +10599 -0
  3. package/dist/chunk-W7HWJFQ4.js.map +1 -0
  4. package/dist/index-browser.d.ts +1300 -1051
  5. package/dist/index-browser.js +55 -17
  6. package/dist/index.d.ts +53 -3
  7. package/dist/index.js +200 -54
  8. package/dist/index.js.map +1 -1
  9. package/package.json +21 -15
  10. package/src/bots/Hero.ts +867 -0
  11. package/src/bots/berserker/01_Stormchaser.ts +162 -120
  12. package/src/bots/berserker/02_Stormcaller.ts +160 -116
  13. package/src/bots/berserker/03_Stormforger.ts +162 -129
  14. package/src/bots/caster/01_Flamecaller.ts +126 -84
  15. package/src/bots/caster/02_Pyromancer.ts +148 -101
  16. package/src/bots/caster/03_Infernalist.ts +180 -160
  17. package/src/bots/defensive/01_Turtle.ts +48 -44
  18. package/src/bots/defensive/02_Sentinel.ts +57 -53
  19. package/src/bots/defensive/03_Golem.ts +85 -97
  20. package/src/bots/duelist/01_Battlemage.ts +157 -122
  21. package/src/bots/duelist/02_Warmage.ts +166 -121
  22. package/src/bots/duelist/03_Archmage.ts +198 -178
  23. package/src/bots/homing/01_Bonemancer.ts +20 -32
  24. package/src/bots/homing/02_Lich.ts +145 -93
  25. package/src/bots/homing/03_Archlich.ts +129 -60
  26. package/src/bots/kiter/01_Spellspinner.ts +145 -107
  27. package/src/bots/kiter/02_Spellweaver.ts +153 -105
  28. package/src/bots/kiter/03_Spellbinder.ts +168 -123
  29. package/src/bots/melee/01_Shadowblade.ts +131 -75
  30. package/src/bots/melee/02_Nightblade.ts +174 -130
  31. package/src/bots/melee/03_Voidblade.ts +266 -168
  32. package/src/bots/registry.ts +44 -37
  33. package/src/bots/shared.ts +185 -25
  34. package/src/bots/sniper/01_Spellshot.ts +151 -98
  35. package/src/bots/sniper/02_Spelltracer.ts +173 -128
  36. package/src/bots/sniper/03_Spellseeker.ts +177 -152
  37. package/src/bots/standalone/Critter.ts +46 -52
  38. package/src/bots/standalone/Doombringer.ts +36 -40
  39. package/src/bots/standalone/Hogger.ts +120 -89
  40. package/src/bots/standalone/Rookie.ts +21 -23
  41. package/src/bots/standalone/TargetDummy.ts +5 -6
  42. package/src/bots/test/cheater.ts +91 -85
  43. package/src/bots/test/crasher.ts +26 -28
  44. package/src/engine/bundle-fight.ts +242 -0
  45. package/src/engine/hooks-runtime.ts +58 -18
  46. package/src/engine/manual-match.ts +33 -25
  47. package/src/engine/missile-templates.ts +25 -43
  48. package/src/engine/optimizer.ts +7 -7
  49. package/src/engine/params-runtime.ts +3 -3
  50. package/src/engine/physics.ts +33 -23
  51. package/src/engine/sandbox-browser.ts +8 -7
  52. package/src/engine/sandbox-compile.ts +1 -1
  53. package/src/engine/sandbox-harness.ts +299 -367
  54. package/src/engine/sandbox.ts +3 -3
  55. package/src/engine/simulation.ts +291 -76
  56. package/src/engine/spells.ts +9 -12
  57. package/src/engine-version.ts +1 -1
  58. package/src/hooks/action-builders.ts +76 -21
  59. package/src/hooks/index.ts +17 -9
  60. package/src/hooks/state-hooks.ts +61 -25
  61. package/src/hooks/threat-analysis.ts +44 -20
  62. package/src/hooks/types.ts +62 -5
  63. package/src/index.ts +2 -0
  64. package/src/rules.ts +209 -63
  65. package/src/stats.ts +2 -2
  66. package/src/testing.ts +6 -30
  67. package/src/trace.ts +63 -3
  68. package/src/types.ts +127 -14
  69. package/src/utils/angles.ts +1 -0
  70. package/src/utils/combat.ts +98 -6
  71. package/src/utils/spatial.ts +3 -3
  72. package/dist/chunk-74FFJCFF.js +0 -9140
  73. package/dist/chunk-74FFJCFF.js.map +0 -1
  74. package/src/hooks/bot-wrapper.ts +0 -84
@@ -1,84 +0,0 @@
1
- /**
2
- * VIBEMANCER - BOT WRAPPER
3
- *
4
- * Utilities to convert between old-style (WizardFunction) and new-style (BotFunction) bots.
5
- */
6
-
7
- import {WizardFunction, WizardActions, GameState, GameConfig} from '../types.js';
8
- import {withBotContext} from '../engine/hooks-runtime.js';
9
- import {extractAction} from './action-builders.js';
10
- import type {BotFunction, BotContext} from './types.js';
11
-
12
- /**
13
- * Convert a new-style bot (using hooks) to an old-style bot (WizardFunction).
14
- *
15
- * This allows new bots to work with the existing simulation.
16
- *
17
- * @example
18
- * const NewBot: BotFunction = () => {
19
- * const health = useHealth();
20
- * return health < 10 ? shield() : idle();
21
- * };
22
- *
23
- * // Convert to work with simulate()
24
- * const oldStyleBot = wrapNewBot(NewBot);
25
- * simulate(oldStyleBot, opponent);
26
- */
27
- export function wrapNewBot(newBot: BotFunction): WizardFunction
28
- {
29
- return ({state, config}: {state: GameState; config: GameConfig; random: () => number}): WizardActions =>
30
- {
31
- // Create the BotContext from GameState
32
- // Note: entityId is inherited from the simulation's outer runWithHooks call
33
- const botContext: BotContext = {
34
- entityId: 'unused', // Not used - entity ID comes from simulation
35
- tick: state.tick,
36
- position: state.position,
37
- velocity: state.velocity,
38
- health: state.health,
39
- maxHealth: state.maxHealth,
40
- state: state.state,
41
- castingSpell: state.castingSpell,
42
- castProgress: state.castProgress,
43
- castDuration: state.castDuration,
44
- channelingSpell: state.channelingSpell,
45
- channelDuration: state.channelDuration,
46
- gcdRemaining: state.gcdRemaining,
47
- blinkCooldown: state.blinkCooldown,
48
- enemies: state.enemies.map((e) => ({
49
- id: e.id,
50
- position: e.position,
51
- velocity: e.velocity,
52
- health: e.health,
53
- state: e.state,
54
- castingSpell: e.castingSpell,
55
- channelingSpell: e.channelingSpell,
56
- channelDuration: e.channelDuration,
57
- })),
58
- projectiles: state.projectiles,
59
- myProjectiles: state.myProjectiles,
60
- arenaWidth: config.arenaSize.width,
61
- arenaHeight: config.arenaSize.height,
62
- damageDealt: state.damageDealt,
63
- damageTaken: state.damageTaken,
64
- lastHitTick: state.lastHitTick,
65
- };
66
-
67
- // Run the new-style bot with context
68
- // Use withBotContext (not runBotWithContext) to preserve the entity ID
69
- // set by the simulation's outer runWithHooks call
70
- const finalAction = withBotContext(botContext, newBot);
71
-
72
- // Extract WizardActions from FinalAction
73
- return extractAction(finalAction);
74
- };
75
- }
76
-
77
- /**
78
- * Type guard to check if a bot is a new-style BotFunction.
79
- * New-style bots have 0 parameters, old-style bots have at least 1.
80
- */
81
- export function isNewStyleBot(bot: WizardFunction | BotFunction): bot is BotFunction
82
- {
83
- return bot.length === 0;
84
- }