void LAi_type_guardian_Return_Event() { aref chr = GetEventData(); if(!TestRef(chr)) return; chr.chr_ai.type.wait = ""; chr.chr_ai.type.enemy = ""; LAi_tmpl_runto_InitTemplate(chr); LAi_tmpl_runto_SetLocator(chr, chr.chr_ai.type.group, chr.chr_ai.type.locator, -1.0); }
void LAi_type_guardian_CmdAttack_Event() { aref chr = GetEventData(); if(!TestRef(chr)) return; chr.chr_ai.type.wait = ""; if(chr.chr_ai.type.enemy == "") return; int trg = sti(chr.chr_ai.type.enemy); LAi_type_guardian_CmdAttack_Now(chr, trg); }
bool Group::IteraterToTestRef(TestIteratorType testIter, TestRef &tr) { size_t count = 0; size_t x = 0, y = 0, z = 0; // This loop is attempting to take the testIter, it should be pointing to // the next test to consider for execution. However that doesn't mean there // actually is a test object at the testIter index within mTests[][][]. // Start from the beginning and traverse the entire matrix to attain a // valid test object for execution. LOG_DBG("Parse mTest matrix %ld seeking test @ iter=%ld", mGrpNum, testIter); while (count < testIter) { if (TestExists(TestRef(mGrpNum, x, y, z+1))) { z++; count++; } else if (TestExists(TestRef(mGrpNum, x, y+1, 0))) { y++; z = 0; count++; } else if (TestExists(TestRef(mGrpNum, x+1, 0, 0))) { x++; y = 0; z = 0; count++; } else { // no next test, never found it break; } } if (count != testIter) return false; tr.group = mGrpNum; tr.xLev = x; tr.yLev = y; tr.zLev = z; return true; }