neon-sprawl/bruno/neon-sprawl-server/combat-targets/Get combat targets after on...

95 lines
2.7 KiB
Plaintext

meta {
name: GET combat targets after one cast (NEO-83)
type: http
seq: 2
}
docs {
Fast cast→GET smoke: one pulse on prototype_npc_melee, no cooldown waits. Four-pulse defeat spine is seq 3.
}
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" } };
await resetPrototypeCombatTargets(bru);
await axios.post(
`${baseUrl}/game/players/${playerId}/move`,
{ schemaVersion: 1, target: { x: -5, y: 0.9, z: -5 } },
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_melee" },
jsonHeaders,
);
const castResponse = await axios.post(
`${baseUrl}/game/players/${playerId}/ability-cast`,
{
schemaVersion: 1,
slotIndex: 0,
abilityId: "prototype_pulse",
targetId: "prototype_npc_melee",
},
jsonHeaders,
);
const castBody = castResponse.data;
if (!castBody?.accepted || !castBody?.combatResolution) {
throw new Error(`neo83 one-pulse cast failed: ${JSON.stringify(castBody)}`);
}
bru.setVar("neo83OnePulseCast", JSON.stringify(castBody));
}
get {
url: {{baseUrl}}/game/world/combat-targets
body: none
auth: none
}
tests {
test("one-pulse cast body shows 75 HP remaining", function () {
const castBody = JSON.parse(bru.getVar("neo83OnePulseCast"));
expect(castBody.combatResolution.targetRemainingHp).to.equal(75);
expect(castBody.combatResolution.targetDefeated).to.equal(false);
});
test("GET melee reflects cast damage authoritatively", function () {
const body = res.getBody();
const melee = body.targets.find(
(x) => x.targetId === "prototype_npc_melee",
);
expect(melee).to.be.an("object");
expect(melee.currentHp).to.equal(75);
expect(melee.maxHp).to.equal(100);
expect(melee.defeated).to.equal(false);
});
test("ranged unchanged after melee-only cast", function () {
const body = res.getBody();
const ranged = body.targets.find(
(x) => x.targetId === "prototype_npc_ranged",
);
expect(ranged).to.be.an("object");
expect(ranged.currentHp).to.equal(80);
expect(ranged.maxHp).to.equal(80);
expect(ranged.defeated).to.equal(false);
});
}