Events
What happened in the last turn, in state.events.
Each item of state.events has a type:
| type | What happened |
|---|---|
hitByBullet |
You were hit: by, power, damage, bearing. |
bulletHit |
Your shot hit: target, power, damage. |
bulletMissed |
Your shot left the arena: power. |
hitRobot |
You bumped into another robot: other, bearing. |
robotDeath |
A robot was destroyed: robot. |
reflected |
The target’s reactive plates sent back part of your shot’s damage: by, damage. |
hitByHazard |
A scenery event hit you: hazard, damage, energy (drained), bearing. |
itemUsed |
One of your items was used. |
itemFailed |
The item couldn’t be used: the reason is missing, passive, empty, cooldown or energy. |
hitByItem |
You stepped on a mine or were hit by an EMP pulse. |
hitHelper |
Your shot hit a drone. |
helperDestroyed |
One of your drones went down. |
Example
const state = this.scan();
for (const event of state.events) {
if (event.type === "hitByBullet") this.turn(event.bearing);
}