BOOL TMonsterAIElement::ApplyElementCommon(int iIndex, int iTargetIndex, TMonsterAIState * pAIState) { LPOBJ lpObj = &gObj[iIndex]; KANTURU_UTIL.SendKanturuChattingMsg(iIndex, "앗싸 좆쿠나!"); return FALSE; }
BOOL TMonsterAIElement::ApplyElementAvoid(int iIndex, int iTargetIndex, TMonsterAIState * pAIState) { LPOBJ lpObj = &gObj[iIndex]; UTIL.SendCrywolfChattingMsg(iIndex, "Element-회피"); KANTURU_UTIL.SendKanturuChattingMsg(iIndex, "Element-회피"); BOOL bFindXY = MONSTER_UTIL.GetXYToEascape(lpObj); if ( bFindXY ) { MONSTER_UTIL.FindPathToMoveMonster(lpObj, lpObj->MTX, lpObj->MTY, 5, 1); } return FALSE; }
BOOL TMonsterAIElement::ApplyElementMove(int iIndex, int iTargetIndex, TMonsterAIState * pAIState) { LPOBJ lpObj = &gObj[iIndex]; UTIL.SendCrywolfChattingMsg(iIndex, "Element-이동"); KANTURU_UTIL.SendKanturuChattingMsg(iIndex, "Element-이동"); if ( lpObj->PathStartEnd ) return FALSE; BOOL bFindXY = FALSE; if ( pAIState->m_iTransitionType == 2 ) bFindXY = MONSTER_UTIL.GetXYToChase(lpObj); else bFindXY = MONSTER_UTIL.GetXYToPatrol(lpObj); if ( bFindXY ) MONSTER_UTIL.FindPathToMoveMonster(lpObj, lpObj->MTX, lpObj->MTY, 5, 1); return FALSE; }
BOOL TMonsterAIElement::ApplyElementMoveTarget(int iIndex, int iTargetIndex, TMonsterAIState * pAIState) { LPOBJ lpObj = &gObj[iIndex]; UTIL.SendCrywolfChattingMsg(iIndex, "Element-MoveTarget"); #if (__CUSTOM__ == 0) KANTURU_UTIL.SendKanturuChattingMsg(iIndex, "Element-타겟이동"); #endif if ( lpObj->PathStartEnd ) return FALSE; if ( lpObj->X == this->m_iX && lpObj->Y == this->m_iY ) { this->ApplyElementMove(iIndex, iTargetIndex, pAIState); return FALSE; } BOOL bFindXY = TRUE; int iTargetX = this->m_iX; int iTargetY = this->m_iY; int iTargetDistance = (int)sqrt(double(((lpObj->X - iTargetX)*(lpObj->X - iTargetX))+ ((lpObj->Y - iTargetY)*(lpObj->Y - iTargetY)))); if ( TMonsterAIElement::s_MonsterAIMovePath[lpObj->MapNumber].m_bDataLoad ) { if ( iTargetDistance > 10 ) { int iMinCost = 1000000; int iMidX = -1; int iMidY = -1; int iSpotNum = -1; for ( int i=0;i<MAX_MONSTER_AI_MOVE_PATH;i++) { TMonsterAIMovePathInfo & PathInfo = TMonsterAIElement::s_MonsterAIMovePath[lpObj->MapNumber].m_MovePathInfo[i]; float fDistX = (float)(lpObj->X - PathInfo.m_iPathX); float fDistY = (float)(lpObj->Y - PathInfo.m_iPathY); int iPathSpotDist = (int)sqrt( (fDistX*fDistX) + (fDistY*fDistY) ); if ( iPathSpotDist < 20 ) { fDistX = (float)(iTargetX - PathInfo.m_iPathX); fDistY = (float)(iTargetY - PathInfo.m_iPathY); int iMidDist = (int)sqrt( (fDistX*fDistX) + (fDistY*fDistY) ); if ( iMinCost > iMidDist ) { if ( iMidDist ) { iMinCost = iMidDist; iMidX = PathInfo.m_iPathX; iMidY = PathInfo.m_iPathY; iSpotNum = i; } } } } if ( iMinCost != 1000000 ) { iTargetX = iMidX; iTargetY = iMidY; } } } if ( bFindXY ) { if ( MONSTER_UTIL.FindPathToMoveMonster(lpObj, iTargetX, iTargetY, 7, FALSE) ) lpObj->PathStartEnd = 1; else lpObj->PathStartEnd = 0; } return FALSE; }