Skip to content

Commit

Permalink
refactor: simplify test of #193
Browse files Browse the repository at this point in the history
  • Loading branch information
szapp committed Apr 19, 2021
1 parent d771131 commit 78fff41
Showing 1 changed file with 7 additions and 30 deletions.
37 changes: 7 additions & 30 deletions src/Ninja/G1CP/Content/Tests/test193.d
Expand Up @@ -7,39 +7,16 @@
* Expected behavior: The gate (that the PC is teleported to) can be opened again after closing it, saving and loading.
*/
func void G1CP_Test_193() {
const string ROUTINE = "OMFull";
G1CP_Testsuite_CheckManual();

// Check status of the test
var int passed; passed = TRUE;

// Find the gate guard
var int symbId; symbId = MEM_GetSymbolIndex("GRD_230_Gardist");
if (symbId == -1) {
G1CP_TestsuiteErrorDetail("NPC 'GRD_230_Gardist' not found");
return;
};

// Check if gate guard exists in the world
var C_Npc npc; npc = Hlp_GetNpc(symbId);
if (!Hlp_IsValidNpc(npc)) {
G1CP_TestsuiteErrorDetail("NPC 'GRD_230_Gardist' not valid");
passed = FALSE;
};

// Find the daily routine
if (MEM_GetSymbolIndex("Rtn_OMFull_230") == -1) {
G1CP_TestsuiteErrorDetail("Daily routine function 'Rtn_OMFull_230' not found");
passed = FALSE;
};

// At the latest now, we need to stop if there are fails already
if (!passed) {
return;
};
var zCWaypoint wp; wp = G1CP_Testsuite_FindWaypoint("OCC_MAINGATE_VWHEEL");
var C_Npc npc; npc = G1CP_Testsuite_FindNpc("GRD_230_Gardist");
G1CP_Testsuite_CheckFunc("Rtn_OMFull_230", "void|none", "Daily routine function");
G1CP_Testsuite_CheckPassed();

// Change the routine of the NPC to leave the player alone
Npc_ExchangeRoutine(npc, "OMFull");
Npc_ExchangeRoutine(npc, ROUTINE);

// Teleport the player to the gate
AI_Teleport(hero, "OCC_MAINGATE_VWHEEL");
AI_Teleport(hero, wp.name);
};

0 comments on commit 78fff41

Please sign in to comment.