110 lines
3.3 KiB
Plaintext
110 lines
3.3 KiB
Plaintext
meta {
|
|
name: Get snapshot after cast telegraph
|
|
type: http
|
|
seq: 2
|
|
}
|
|
|
|
docs {
|
|
E5M2-08 AC smoke: lock prototype_npc_melee, damaging cast, wait attackCooldownSeconds (3.0s), GET snapshot.
|
|
Integration tests own precise timing via FakeClock; Bruno uses sleep(3100) 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: -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(`neo94 cast failed: ${JSON.stringify(castBody)}`);
|
|
}
|
|
|
|
await axios.get(`${baseUrl}/game/world/npc-runtime-snapshot`);
|
|
|
|
await sleep(3100);
|
|
|
|
bru.setVar("neo94CastBody", JSON.stringify(castBody));
|
|
}
|
|
|
|
get {
|
|
url: {{baseUrl}}/game/world/npc-runtime-snapshot
|
|
body: none
|
|
auth: none
|
|
}
|
|
|
|
tests {
|
|
test("cast body shows accepted damaging pulse on melee", function () {
|
|
const castBody = JSON.parse(bru.getVar("neo94CastBody"));
|
|
expect(castBody.accepted).to.equal(true);
|
|
expect(castBody.combatResolution.targetRemainingHp).to.equal(75);
|
|
});
|
|
|
|
test("melee shows telegraph_windup with activeTelegraph after cooldown", function () {
|
|
const body = res.getBody();
|
|
const melee = body.npcInstances.find(
|
|
(x) => x.npcInstanceId === "prototype_npc_melee",
|
|
);
|
|
expect(melee).to.be.an("object");
|
|
expect(melee.state).to.equal("telegraph_windup");
|
|
expect(melee.aggroHolderPlayerId).to.equal("dev-local-1");
|
|
expect(melee.activeTelegraph).to.be.an("object");
|
|
expect(melee.activeTelegraph.archetypeKind).to.equal("melee_pressure");
|
|
expect(melee.activeTelegraph.windupRemainingSeconds).to.be.above(0);
|
|
expect(melee.activeTelegraph.npcInstanceId).to.equal("prototype_npc_melee");
|
|
});
|
|
|
|
test("non-target NPCs remain idle", function () {
|
|
const body = res.getBody();
|
|
const ranged = body.npcInstances.find(
|
|
(x) => x.npcInstanceId === "prototype_npc_ranged",
|
|
);
|
|
const elite = body.npcInstances.find(
|
|
(x) => x.npcInstanceId === "prototype_npc_elite",
|
|
);
|
|
expect(ranged.state).to.equal("idle");
|
|
expect(ranged.activeTelegraph).to.equal(null);
|
|
expect(elite.state).to.equal("idle");
|
|
expect(elite.activeTelegraph).to.equal(null);
|
|
});
|
|
}
|