@vibemancer/core 0.1.3 → 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.
- package/README.md +2 -2
- package/dist/chunk-W7HWJFQ4.js +10599 -0
- package/dist/chunk-W7HWJFQ4.js.map +1 -0
- package/dist/index-browser.d.ts +1300 -1051
- package/dist/index-browser.js +55 -17
- package/dist/index.d.ts +53 -3
- package/dist/index.js +200 -54
- package/dist/index.js.map +1 -1
- package/package.json +21 -15
- package/src/bots/Hero.ts +867 -0
- package/src/bots/berserker/01_Stormchaser.ts +162 -120
- package/src/bots/berserker/02_Stormcaller.ts +160 -116
- package/src/bots/berserker/03_Stormforger.ts +162 -129
- package/src/bots/caster/01_Flamecaller.ts +126 -84
- package/src/bots/caster/02_Pyromancer.ts +148 -101
- package/src/bots/caster/03_Infernalist.ts +180 -160
- package/src/bots/defensive/01_Turtle.ts +48 -44
- package/src/bots/defensive/02_Sentinel.ts +57 -53
- package/src/bots/defensive/03_Golem.ts +85 -97
- package/src/bots/duelist/01_Battlemage.ts +157 -122
- package/src/bots/duelist/02_Warmage.ts +166 -121
- package/src/bots/duelist/03_Archmage.ts +198 -178
- package/src/bots/homing/01_Bonemancer.ts +20 -32
- package/src/bots/homing/02_Lich.ts +145 -93
- package/src/bots/homing/03_Archlich.ts +129 -60
- package/src/bots/kiter/01_Spellspinner.ts +145 -107
- package/src/bots/kiter/02_Spellweaver.ts +153 -105
- package/src/bots/kiter/03_Spellbinder.ts +168 -123
- package/src/bots/melee/01_Shadowblade.ts +131 -75
- package/src/bots/melee/02_Nightblade.ts +174 -130
- package/src/bots/melee/03_Voidblade.ts +266 -168
- package/src/bots/registry.ts +44 -37
- package/src/bots/shared.ts +185 -25
- package/src/bots/sniper/01_Spellshot.ts +151 -98
- package/src/bots/sniper/02_Spelltracer.ts +173 -128
- package/src/bots/sniper/03_Spellseeker.ts +177 -152
- package/src/bots/standalone/Critter.ts +46 -52
- package/src/bots/standalone/Doombringer.ts +36 -40
- package/src/bots/standalone/Hogger.ts +120 -89
- package/src/bots/standalone/Rookie.ts +21 -23
- package/src/bots/standalone/TargetDummy.ts +5 -6
- package/src/bots/test/cheater.ts +91 -85
- package/src/bots/test/crasher.ts +26 -28
- package/src/engine/bundle-fight.ts +242 -0
- package/src/engine/hooks-runtime.ts +58 -18
- package/src/engine/manual-match.ts +33 -25
- package/src/engine/missile-templates.ts +25 -43
- package/src/engine/optimizer.ts +7 -7
- package/src/engine/params-runtime.ts +3 -3
- package/src/engine/physics.ts +33 -23
- package/src/engine/sandbox-browser.ts +8 -7
- package/src/engine/sandbox-compile.ts +1 -1
- package/src/engine/sandbox-harness.ts +299 -367
- package/src/engine/sandbox.ts +3 -3
- package/src/engine/simulation.ts +291 -76
- package/src/engine/spells.ts +9 -12
- package/src/engine-version.ts +1 -1
- package/src/hooks/action-builders.ts +76 -21
- package/src/hooks/index.ts +17 -9
- package/src/hooks/state-hooks.ts +61 -25
- package/src/hooks/threat-analysis.ts +44 -20
- package/src/hooks/types.ts +62 -5
- package/src/index.ts +2 -0
- package/src/rules.ts +209 -63
- package/src/stats.ts +2 -2
- package/src/testing.ts +6 -30
- package/src/trace.ts +63 -3
- package/src/types.ts +127 -14
- package/src/utils/angles.ts +1 -0
- package/src/utils/combat.ts +98 -6
- package/src/utils/spatial.ts +3 -3
- package/dist/chunk-B7YYYBEC.js +0 -9140
- package/dist/chunk-B7YYYBEC.js.map +0 -1
- package/src/hooks/bot-wrapper.ts +0 -84
package/src/hooks/bot-wrapper.ts
DELETED
|
@@ -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
|
-
}
|