neon-sprawl/bruno/neon-sprawl-server/combat-health/Get combat health after eli...

91 lines
2.6 KiB
Plaintext

meta {
name: Get combat health after elite attack
type: http
seq: 2
}
docs {
E5M2-09 AC smoke: lock prototype_npc_elite, damaging cast, wait attackCooldownSeconds (5.0s) + telegraphWindupSeconds (2.5s), GET combat-health.
Integration tests own precise timing via FakeClock; Bruno uses sleep(8000) against dev server real clock.
}
script:pre-request {
const axios = require("axios");
const { resetPrototypeCombatTargets } = require("./scripts/combat-targets-reset-helper.js");
const baseUrl = bru.getEnvVar("baseUrl") || bru.getVar("baseUrl");
const playerId = bru.getEnvVar("playerId") || bru.getVar("playerId");
const jsonHeaders = { headers: { "Content-Type": "application/json" } };
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
await resetPrototypeCombatTargets(bru);
await axios.post(
`${baseUrl}/game/players/${playerId}/move`,
{ schemaVersion: 1, target: { x: -2, y: 0.9, z: -2 } },
jsonHeaders,
);
await axios.post(
`${baseUrl}/game/players/${playerId}/hotbar-loadout`,
{
schemaVersion: 1,
slots: [{ slotIndex: 0, abilityId: "prototype_pulse" }],
},
jsonHeaders,
);
await axios.post(
`${baseUrl}/game/players/${playerId}/target/select`,
{ schemaVersion: 1, targetId: "prototype_npc_elite" },
jsonHeaders,
);
const castResponse = await axios.post(
`${baseUrl}/game/players/${playerId}/ability-cast`,
{
schemaVersion: 1,
slotIndex: 0,
abilityId: "prototype_pulse",
targetId: "prototype_npc_elite",
},
jsonHeaders,
);
const castBody = castResponse.data;
if (!castBody?.accepted || !castBody?.combatResolution) {
throw new Error(`neo95 cast failed: ${JSON.stringify(castBody)}`);
}
await axios.get(`${baseUrl}/game/world/npc-runtime-snapshot`);
await sleep(8000);
bru.setVar("neo95CastBody", JSON.stringify(castBody));
}
get {
url: {{baseUrl}}/game/players/dev-local-1/combat-health
body: none
auth: none
}
tests {
test("cast body shows accepted damaging pulse on elite", function () {
const castBody = JSON.parse(bru.getVar("neo95CastBody"));
expect(castBody.accepted).to.equal(true);
expect(castBody.combatResolution.targetRemainingHp).to.equal(175);
});
test("player HP decreased by elite attackDamage (25)", function () {
const body = res.getBody();
expect(body.schemaVersion).to.equal(1);
expect(body.playerId).to.equal("dev-local-1");
expect(body.maxHp).to.equal(100);
expect(body.currentHp).to.equal(75);
expect(body.defeated).to.equal(false);
});
}