@vibemancer/core 0.1.0 → 0.1.1
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 +28 -28
- package/dist/{chunk-L7Z7OFXD.js → chunk-7VDJHO22.js} +3 -3
- package/dist/chunk-7VDJHO22.js.map +1 -0
- package/dist/index-browser.d.ts +1 -1
- package/dist/index-browser.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +79 -78
- package/src/bots/berserker/01_Stormchaser.ts +457 -457
- package/src/bots/berserker/02_Stormcaller.ts +417 -417
- package/src/bots/berserker/03_Stormforger.ts +481 -481
- package/src/bots/caster/01_Flamecaller.ts +286 -286
- package/src/bots/caster/02_Pyromancer.ts +350 -350
- package/src/bots/caster/03_Infernalist.ts +492 -492
- package/src/bots/defensive/01_Turtle.ts +151 -151
- package/src/bots/defensive/02_Sentinel.ts +134 -134
- package/src/bots/defensive/03_Golem.ts +357 -357
- package/src/bots/duelist/01_Battlemage.ts +433 -433
- package/src/bots/duelist/02_Warmage.ts +438 -438
- package/src/bots/duelist/03_Archmage.ts +588 -588
- package/src/bots/homing/01_Bonemancer.ts +67 -67
- package/src/bots/homing/02_Lich.ts +356 -356
- package/src/bots/homing/03_Archlich.ts +220 -220
- package/src/bots/kiter/01_Spellspinner.ts +398 -398
- package/src/bots/kiter/02_Spellweaver.ts +378 -378
- package/src/bots/kiter/03_Spellbinder.ts +448 -448
- package/src/bots/melee/01_Shadowblade.ts +270 -270
- package/src/bots/melee/02_Nightblade.ts +437 -437
- package/src/bots/melee/03_Voidblade.ts +582 -582
- package/src/bots/sniper/01_Spellshot.ts +385 -385
- package/src/bots/sniper/02_Spelltracer.ts +441 -441
- package/src/bots/sniper/03_Spellseeker.ts +546 -546
- package/src/bots/standalone/Critter.ts +89 -89
- package/src/bots/standalone/Doombringer.ts +91 -91
- package/src/bots/standalone/Hogger.ts +228 -228
- package/src/bots/standalone/Rookie.ts +50 -50
- package/src/bots/standalone/TargetDummy.ts +21 -21
- package/src/bots/test/cheater.ts +405 -405
- package/src/bots/test/crasher.ts +81 -81
- package/src/engine/hooks-runtime.ts +394 -394
- package/src/engine/manual-match.ts +289 -289
- package/src/engine/missile-templates.ts +155 -155
- package/src/engine/physics.ts +143 -143
- package/src/engine/simulation.ts +828 -828
- package/src/engine/spells.ts +128 -128
- package/src/engine-version.ts +1 -1
- package/src/index.ts +23 -23
- package/src/rules.ts +254 -254
- package/src/types.ts +193 -193
- package/src/utils/index.ts +6 -6
- package/dist/chunk-L7Z7OFXD.js.map +0 -1
package/src/types.ts
CHANGED
|
@@ -1,193 +1,193 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* VIBEMANCER - TYPES
|
|
3
|
-
*
|
|
4
|
-
* This file contains all the TypeScript interfaces used by the game engine.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Position in 2D space.
|
|
9
|
-
*/
|
|
10
|
-
export interface Position
|
|
11
|
-
{
|
|
12
|
-
x: number;
|
|
13
|
-
y: number;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Velocity in 2D space (units per tick).
|
|
18
|
-
*/
|
|
19
|
-
export interface Velocity
|
|
20
|
-
{
|
|
21
|
-
x: number;
|
|
22
|
-
y: number;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Wizard state.
|
|
27
|
-
*/
|
|
28
|
-
export interface WizardState
|
|
29
|
-
{
|
|
30
|
-
id: string;
|
|
31
|
-
position: Position;
|
|
32
|
-
rotation: number; // degrees
|
|
33
|
-
health: number;
|
|
34
|
-
maxHealth: number;
|
|
35
|
-
state: 'idle' | 'casting' | 'channeling' | 'gcd_locked';
|
|
36
|
-
castingSpell?: 'missile' | 'shield' | 'blink';
|
|
37
|
-
castProgress?: number; // ticks elapsed
|
|
38
|
-
castDuration?: number; // total ticks needed
|
|
39
|
-
channelingSpell?: 'shield';
|
|
40
|
-
channelDuration?: number; // ticks spent channeling (for decay calc)
|
|
41
|
-
gcdRemaining?: number; // ticks remaining
|
|
42
|
-
blinkCooldown: number; // ticks remaining
|
|
43
|
-
velocity: Velocity;
|
|
44
|
-
lastMissileConfig?: MissileConfig; // last fired missile (for warmup system)
|
|
45
|
-
warmupMultiplier?: number; // warmup multiplier applied to most recent missile cast (0.80 = full bonus, 1.20 = full penalty)
|
|
46
|
-
invincible?: boolean; // manual play mode: damage is ignored when true
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Projectile (missile) state.
|
|
51
|
-
*/
|
|
52
|
-
export interface ProjectileState
|
|
53
|
-
{
|
|
54
|
-
id: string;
|
|
55
|
-
type: 'missile';
|
|
56
|
-
ownerId: string;
|
|
57
|
-
position: Position;
|
|
58
|
-
rotation: number; // degrees
|
|
59
|
-
speed: number; // units per tick
|
|
60
|
-
turnRate: number; // degrees per tick
|
|
61
|
-
damage: number;
|
|
62
|
-
remainingTicks: number;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Game configuration (read-only).
|
|
67
|
-
*/
|
|
68
|
-
export interface GameConfig
|
|
69
|
-
{
|
|
70
|
-
arenaSize: {
|
|
71
|
-
width: number;
|
|
72
|
-
height: number;
|
|
73
|
-
};
|
|
74
|
-
tickRate: number;
|
|
75
|
-
maxTicks: number;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Full game state passed to wizard.
|
|
80
|
-
*/
|
|
81
|
-
export interface GameState
|
|
82
|
-
{
|
|
83
|
-
tick: number;
|
|
84
|
-
position: Position;
|
|
85
|
-
rotation: number;
|
|
86
|
-
health: number;
|
|
87
|
-
maxHealth: number;
|
|
88
|
-
state: WizardState['state'];
|
|
89
|
-
castingSpell?: 'missile' | 'shield' | 'blink';
|
|
90
|
-
castProgress?: number;
|
|
91
|
-
castDuration?: number;
|
|
92
|
-
channelingSpell?: 'shield';
|
|
93
|
-
channelDuration?: number;
|
|
94
|
-
gcdRemaining?: number;
|
|
95
|
-
blinkCooldown: number;
|
|
96
|
-
velocity: Velocity;
|
|
97
|
-
lastMissileConfig?: MissileConfig; // last fired missile (for warmup system)
|
|
98
|
-
warmupMultiplier?: number; // warmup multiplier applied to most recent missile cast (0.80 = full bonus, 1.20 = full penalty)
|
|
99
|
-
enemies: WizardState[];
|
|
100
|
-
projectiles: ProjectileState[]; // all projectiles (yours and enemy's)
|
|
101
|
-
myProjectiles: ProjectileState[]; // only your active projectiles
|
|
102
|
-
|
|
103
|
-
// Combat tracking (for new hooks API)
|
|
104
|
-
damageDealt: number; // total damage dealt this match
|
|
105
|
-
damageTaken: number; // total damage taken this match
|
|
106
|
-
lastHitTick: number; // tick when last took damage (0 if never)
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Actions returned by wizard each tick.
|
|
111
|
-
*
|
|
112
|
-
* Movement uses world-space coordinates:
|
|
113
|
-
* - x: +100 = right, -100 = left
|
|
114
|
-
* - y: +100 = down, -100 = up
|
|
115
|
-
* - Diagonal movement is normalized (magnitude capped at 100)
|
|
116
|
-
* - No rotation tracking - just output (x, y) direction
|
|
117
|
-
*/
|
|
118
|
-
export interface WizardActions
|
|
119
|
-
{
|
|
120
|
-
/**
|
|
121
|
-
* Movement direction in world-space.
|
|
122
|
-
* Values are clamped to [-100, 100] range.
|
|
123
|
-
* Magnitude is normalized to max 100 for diagonal movement.
|
|
124
|
-
*/
|
|
125
|
-
move: {
|
|
126
|
-
x: number;
|
|
127
|
-
y: number;
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Start a new cast (only works if state === 'idle').
|
|
132
|
-
*/
|
|
133
|
-
startCast?: {
|
|
134
|
-
spell: 'missile';
|
|
135
|
-
config: MissileConfig;
|
|
136
|
-
missileAI: MissileAIFunction;
|
|
137
|
-
direction?: number; // initial rotation override (auto-aims at enemy by default)
|
|
138
|
-
} | {
|
|
139
|
-
spell: 'shield';
|
|
140
|
-
} | {
|
|
141
|
-
spell: 'blink';
|
|
142
|
-
target: Position; // clamped to max range
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Cancel current cast or channel (works if casting or channeling).
|
|
147
|
-
*/
|
|
148
|
-
cancel?: boolean;
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Update aim direction while casting a missile (degrees).
|
|
152
|
-
* The missile fires in this direction at launch, allowing tracking during cast.
|
|
153
|
-
* Only applies while state === 'casting' and castingSpell === 'missile'.
|
|
154
|
-
*/
|
|
155
|
-
aimDirection?: number;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Missile configuration.
|
|
160
|
-
*/
|
|
161
|
-
export interface MissileConfig
|
|
162
|
-
{
|
|
163
|
-
damage: number;
|
|
164
|
-
speed: number; // units per tick
|
|
165
|
-
turnRate: number; // degrees per tick
|
|
166
|
-
duration: number; // ticks (determines range and cast time)
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Missile AI function type.
|
|
171
|
-
*/
|
|
172
|
-
export type MissileAIFunction = (props: {
|
|
173
|
-
missileState: ProjectileState;
|
|
174
|
-
worldState: GameState;
|
|
175
|
-
random: () => number; // Seeded PRNG, isolated per entity, 0-1 range
|
|
176
|
-
}) => MissileActions;
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Actions returned by missile each tick.
|
|
180
|
-
*/
|
|
181
|
-
export interface MissileActions
|
|
182
|
-
{
|
|
183
|
-
turnToward?: Position; // engine handles turn rate limit
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Main wizard function type.
|
|
188
|
-
*/
|
|
189
|
-
export type WizardFunction = (props: {
|
|
190
|
-
state: GameState;
|
|
191
|
-
config: GameConfig;
|
|
192
|
-
random: () => number; // Seeded PRNG, isolated per entity, 0-1 range
|
|
193
|
-
}) => WizardActions;
|
|
1
|
+
/**
|
|
2
|
+
* VIBEMANCER - TYPES
|
|
3
|
+
*
|
|
4
|
+
* This file contains all the TypeScript interfaces used by the game engine.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Position in 2D space.
|
|
9
|
+
*/
|
|
10
|
+
export interface Position
|
|
11
|
+
{
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Velocity in 2D space (units per tick).
|
|
18
|
+
*/
|
|
19
|
+
export interface Velocity
|
|
20
|
+
{
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Wizard state.
|
|
27
|
+
*/
|
|
28
|
+
export interface WizardState
|
|
29
|
+
{
|
|
30
|
+
id: string;
|
|
31
|
+
position: Position;
|
|
32
|
+
rotation: number; // degrees
|
|
33
|
+
health: number;
|
|
34
|
+
maxHealth: number;
|
|
35
|
+
state: 'idle' | 'casting' | 'channeling' | 'gcd_locked';
|
|
36
|
+
castingSpell?: 'missile' | 'shield' | 'blink';
|
|
37
|
+
castProgress?: number; // ticks elapsed
|
|
38
|
+
castDuration?: number; // total ticks needed
|
|
39
|
+
channelingSpell?: 'shield';
|
|
40
|
+
channelDuration?: number; // ticks spent channeling (for decay calc)
|
|
41
|
+
gcdRemaining?: number; // ticks remaining
|
|
42
|
+
blinkCooldown: number; // ticks remaining
|
|
43
|
+
velocity: Velocity;
|
|
44
|
+
lastMissileConfig?: MissileConfig; // last fired missile (for warmup system)
|
|
45
|
+
warmupMultiplier?: number; // warmup multiplier applied to most recent missile cast (0.80 = full bonus, 1.20 = full penalty)
|
|
46
|
+
invincible?: boolean; // manual play mode: damage is ignored when true
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Projectile (missile) state.
|
|
51
|
+
*/
|
|
52
|
+
export interface ProjectileState
|
|
53
|
+
{
|
|
54
|
+
id: string;
|
|
55
|
+
type: 'missile';
|
|
56
|
+
ownerId: string;
|
|
57
|
+
position: Position;
|
|
58
|
+
rotation: number; // degrees
|
|
59
|
+
speed: number; // units per tick
|
|
60
|
+
turnRate: number; // degrees per tick
|
|
61
|
+
damage: number;
|
|
62
|
+
remainingTicks: number;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Game configuration (read-only).
|
|
67
|
+
*/
|
|
68
|
+
export interface GameConfig
|
|
69
|
+
{
|
|
70
|
+
arenaSize: {
|
|
71
|
+
width: number;
|
|
72
|
+
height: number;
|
|
73
|
+
};
|
|
74
|
+
tickRate: number;
|
|
75
|
+
maxTicks: number;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Full game state passed to wizard.
|
|
80
|
+
*/
|
|
81
|
+
export interface GameState
|
|
82
|
+
{
|
|
83
|
+
tick: number;
|
|
84
|
+
position: Position;
|
|
85
|
+
rotation: number;
|
|
86
|
+
health: number;
|
|
87
|
+
maxHealth: number;
|
|
88
|
+
state: WizardState['state'];
|
|
89
|
+
castingSpell?: 'missile' | 'shield' | 'blink';
|
|
90
|
+
castProgress?: number;
|
|
91
|
+
castDuration?: number;
|
|
92
|
+
channelingSpell?: 'shield';
|
|
93
|
+
channelDuration?: number;
|
|
94
|
+
gcdRemaining?: number;
|
|
95
|
+
blinkCooldown: number;
|
|
96
|
+
velocity: Velocity;
|
|
97
|
+
lastMissileConfig?: MissileConfig; // last fired missile (for warmup system)
|
|
98
|
+
warmupMultiplier?: number; // warmup multiplier applied to most recent missile cast (0.80 = full bonus, 1.20 = full penalty)
|
|
99
|
+
enemies: WizardState[];
|
|
100
|
+
projectiles: ProjectileState[]; // all projectiles (yours and enemy's)
|
|
101
|
+
myProjectiles: ProjectileState[]; // only your active projectiles
|
|
102
|
+
|
|
103
|
+
// Combat tracking (for new hooks API)
|
|
104
|
+
damageDealt: number; // total damage dealt this match
|
|
105
|
+
damageTaken: number; // total damage taken this match
|
|
106
|
+
lastHitTick: number; // tick when last took damage (0 if never)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Actions returned by wizard each tick.
|
|
111
|
+
*
|
|
112
|
+
* Movement uses world-space coordinates:
|
|
113
|
+
* - x: +100 = right, -100 = left
|
|
114
|
+
* - y: +100 = down, -100 = up
|
|
115
|
+
* - Diagonal movement is normalized (magnitude capped at 100)
|
|
116
|
+
* - No rotation tracking - just output (x, y) direction
|
|
117
|
+
*/
|
|
118
|
+
export interface WizardActions
|
|
119
|
+
{
|
|
120
|
+
/**
|
|
121
|
+
* Movement direction in world-space.
|
|
122
|
+
* Values are clamped to [-100, 100] range.
|
|
123
|
+
* Magnitude is normalized to max 100 for diagonal movement.
|
|
124
|
+
*/
|
|
125
|
+
move: {
|
|
126
|
+
x: number;
|
|
127
|
+
y: number;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Start a new cast (only works if state === 'idle').
|
|
132
|
+
*/
|
|
133
|
+
startCast?: {
|
|
134
|
+
spell: 'missile';
|
|
135
|
+
config: MissileConfig;
|
|
136
|
+
missileAI: MissileAIFunction;
|
|
137
|
+
direction?: number; // initial rotation override (auto-aims at enemy by default)
|
|
138
|
+
} | {
|
|
139
|
+
spell: 'shield';
|
|
140
|
+
} | {
|
|
141
|
+
spell: 'blink';
|
|
142
|
+
target: Position; // clamped to max range
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Cancel current cast or channel (works if casting or channeling).
|
|
147
|
+
*/
|
|
148
|
+
cancel?: boolean;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Update aim direction while casting a missile (degrees).
|
|
152
|
+
* The missile fires in this direction at launch, allowing tracking during cast.
|
|
153
|
+
* Only applies while state === 'casting' and castingSpell === 'missile'.
|
|
154
|
+
*/
|
|
155
|
+
aimDirection?: number;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Missile configuration.
|
|
160
|
+
*/
|
|
161
|
+
export interface MissileConfig
|
|
162
|
+
{
|
|
163
|
+
damage: number;
|
|
164
|
+
speed: number; // units per tick
|
|
165
|
+
turnRate: number; // degrees per tick
|
|
166
|
+
duration: number; // ticks (determines range and cast time)
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Missile AI function type.
|
|
171
|
+
*/
|
|
172
|
+
export type MissileAIFunction = (props: {
|
|
173
|
+
missileState: ProjectileState;
|
|
174
|
+
worldState: GameState;
|
|
175
|
+
random: () => number; // Seeded PRNG, isolated per entity, 0-1 range
|
|
176
|
+
}) => MissileActions;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Actions returned by missile each tick.
|
|
180
|
+
*/
|
|
181
|
+
export interface MissileActions
|
|
182
|
+
{
|
|
183
|
+
turnToward?: Position; // engine handles turn rate limit
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Main wizard function type.
|
|
188
|
+
*/
|
|
189
|
+
export type WizardFunction = (props: {
|
|
190
|
+
state: GameState;
|
|
191
|
+
config: GameConfig;
|
|
192
|
+
random: () => number; // Seeded PRNG, isolated per entity, 0-1 range
|
|
193
|
+
}) => WizardActions;
|
package/src/utils/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from './distance.js';
|
|
2
|
-
export * from './angles.js';
|
|
3
|
-
export * from './movement.js';
|
|
4
|
-
export * from './targeting.js';
|
|
5
|
-
export * from './random.js';
|
|
6
|
-
export * from './spatial.js';
|
|
1
|
+
export * from './distance.js';
|
|
2
|
+
export * from './angles.js';
|
|
3
|
+
export * from './movement.js';
|
|
4
|
+
export * from './targeting.js';
|
|
5
|
+
export * from './random.js';
|
|
6
|
+
export * from './spatial.js';
|
|
7
7
|
export * from './combat.js';
|