function PetBaseExecIdleAction( PetMem, nStepOffset, tStepInfo, nRunSpeedRate ) cExecCheck( "PetBaseExecIdleAction" ) if PetMem == nil then ErrorLog( "PetBaseExecIdleAction::PetMem is nil" ) return false end if type( nStepOffset ) ~= "number" then ErrorLog( "PetBaseExecIdleAction::nStepOffset is not number" ) return false end if type( tStepInfo ) ~= "table" then ErrorLog( "PetBaseExecIdleAction::tStepInfo is not table" ) return false end if type( nRunSpeedRate ) ~= "number" then ErrorLog( "PetBaseExecIdleAction::nRunSpeedRate is not number" ) return false end local nHandle = PetMem["nHandle"] local tPetCoord = PetMem["PetInfo"]["Coord"]["Cur"] local tCenterCoord = PetMem["PetInfo"]["Coord"]["Center"] local tStepHeader = PetSystem_tIdleActionData["tHeader"] -- ÇØ´ç ´Ü°è°¡ À¯È¿ÇÏ¸é ½ÇÇà if PetMem["PetInfo"]["nIdleStep"] - nStepOffset <= #tStepInfo then local tCurStep = tStepInfo[ PetMem["PetInfo"]["nIdleStep"] - nStepOffset ] local nStepType = tCurStep[ tStepHeader["nStepType"] ] local nNextStepCondType = tCurStep[ tStepHeader["nNextStepCondType"] ] -- °¢ ½ºÅÜ Å¸ÀÔº° Çൿ ( °¢ ´Ü°è´ç 1ȸ¸¸ ½ÇÇàÇÑ´Ù ) if PetMem["PetInfo"]["bCurIdleStepActionDone"] ~= true then if nStepType == PISAT_MOVE -----------------------------------------------------------------------------------------------------------PISAT_MOVE then local nTargetX = tCurStep[ tStepHeader["nX"] ] + tCenterCoord["x"] local nTargetY = tCurStep[ tStepHeader["nY"] ] + tCenterCoord["y"] cRunTo( nHandle, nTargetX, nTargetY, nRunSpeedRate ) PetMem["PetInfo"]["Coord"]["Next"]["x"] = nTargetX PetMem["PetInfo"]["Coord"]["Next"]["y"] = nTargetY PetMem["PetInfo"]["bCurIdleStepActionDone"] = true CheckLog( "PetBaseExecIdleAction::nStepType == PISAT_MOVE" ) DebugLog( "PetBaseExecIdleAction::nStepType == PISAT_MOVE" ) elseif nStepType == PISAT_ROTATION -----------------------------------------------------------------------------------------------------------PISAT_ROTATION then local nCurDirect = cGetDirect( nHandle ); if nCurDirect ~= nil then local nDirect360 = tCurStep[ tStepHeader["nDir"] ] + nCurDirect -- 0~359 ¸ÂÃß±â if nDirect360 >= 360 then nDirect360 = nDirect360 - 360 end if nDirect360 < 0 then nDirect360 = nDirect360 + 360 end -- 0~179 ¸ÂÃß±â local nDirect180 = nDirect360 / 2 cSetObjectDirect( nHandle, nDirect180 ) end PetMem["PetInfo"]["Coord"]["Next"]["x"] = tPetCoord["x"] PetMem["PetInfo"]["Coord"]["Next"]["y"] = tPetCoord["y"] PetMem["PetInfo"]["bCurIdleStepActionDone"] = true CheckLog( "PetBaseExecIdleAction::nStepType == PISAT_ROTATION" ) DebugLog( "PetBaseExecIdleAction::nStepType == PISAT_ROTATION" ) elseif nStepType == PISAT_ATTACK -----------------------------------------------------------------------------------------------------------PISAT_ATTACK then -- ¾Ö´Ï¸ÞÀ̼ÇÀº Æê Á¾·ù¸¶´Ù ´Ù¸¥ °ÍÀ» »ç¿ëÇؾßÇÏ´Â ´ÜÁ¡ÀÌ À־ À̺¥Æ® Äڵ带 Á÷Á¢ »ç¿ëÇϱâ·Î ÇÔ if cActByEventCode( nHandle, PetSystem_ActionEventCode["Attack"] ) == nil then ErrorLog( "cActByEventCode failed ["..nHandle.."]'s Attack" ) end PetMem["PetInfo"]["bCurIdleStepActionDone"] = true CheckLog( "PetBaseExecIdleAction::nStepType == PISAT_ATTACK" ) DebugLog( "PetBaseExecIdleAction::nStepType == PISAT_ATTACK" ) elseif nStepType == PISAT_DANCE then if cActByEventCode( nHandle, PetSystem_ActionEventCode["Dance"] ) == nil then ErrorLog( "cActByEventCode failed ["..nHandle.."]'s Dance" ) end PetMem["PetInfo"]["bCurIdleStepActionDone"] = true else -- À߸øµÈ ¸ðµå : µ¥ÀÌÅÍ Á¡°Ë ¿äû ErrorLog( "PetBaseExecIdleAction::Please Check PetBaseActionData : nStepType Column" ) end end -- °¢ ´ÙÀ½ ½ºÅÜ Á¶°Çº° Çൿ if nNextStepCondType == PNIST_DISTANCE -----------------------------------------------------------------------------------------------------------PNIST_DISTANCE then local nDistanceSquare = cDistanceSquar( tPetCoord["x"], tPetCoord["y"], PetMem["PetInfo"]["Coord"]["Next"]["x"], PetMem["PetInfo"]["Coord"]["Next"]["y"] ) local nDistanceCond = tCurStep[ tStepHeader["nNextStepDistance"] ] local nDistanceSquareCond = GetSquare( nDistanceCond ) -- Á¶°ÇÀ¸·Î ÁöÁ¤ÇÑ °Å¸® ¾ÈÀ¸·Î µé¾î¿À¸é ´ÙÀ½ ½ºÅÜÀ¸·Î if ( nDistanceSquare <= nDistanceSquareCond ) then PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleStep"] + 1 if PetMem["PetInfo"]["nIdleStep"] == PetMem["PetInfo"]["nIdleEndStep"] then PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleStep"] - #tStepInfo end PetMem["PetInfo"]["Coord"]["Next"]["x"] = tPetCoord["x"] PetMem["PetInfo"]["Coord"]["Next"]["y"] = tPetCoord["y"] PetMem["PetInfo"]["bCurIdleStepActionDone"] = false end DebugLog( "PetBaseExecIdleAction::nNextStepCondType == PNIST_DISTANCE" ) elseif nNextStepCondType == PNIST_TIME -----------------------------------------------------------------------------------------------------------PNIST_TIME then local nTimeCond = tCurStep[ tStepHeader["dNextStepTime"] ] -- Çö ½ºÅÜ Ã¹ ÁøÀԽà ´ÙÀ½½ºÅÜ ½Ã°£ ¼³Á¤ if PetMem["PetInfo"]["dNextIdleStepTime"] == PetMem["InitialSec"] then PetMem["PetInfo"]["dNextIdleStepTime"] = PetMem["CurSec"] + nTimeCond end -- ½Ã°£ µÇ¸é ´ÙÀ½ ½ºÅÜÀ¸·Î if PetMem["PetInfo"]["dNextIdleStepTime"] < PetMem["CurSec"] then PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleStep"] + 1 if PetMem["PetInfo"]["nIdleStep"] == PetMem["PetInfo"]["nIdleEndStep"] then PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleStep"] - #tStepInfo end PetMem["PetInfo"]["Coord"]["Next"]["x"] = tPetCoord["x"] PetMem["PetInfo"]["Coord"]["Next"]["y"] = tPetCoord["y"] PetMem["PetInfo"]["bCurIdleStepActionDone"] = false -- üũ ½Ã°£ ÃʱâÈ­ PetMem["PetInfo"]["dNextIdleStepTime"] = PetMem["InitialSec"] end DebugLog( "PetBaseExecIdleAction::nNextStepCondType == PNIST_TIME" ) elseif nNextStepCondType == PNIST_END -- ½ºÅÜ Á¾·á-----------------------------------------------------------------------------------------------------------PNIST_END then PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"] DebugLog( "PetBaseExecIdleAction::nNextStepCondType == PNIST_END" ) else -- À߸øµÈ Á¶°Ç : µ¥ÀÌÅÍ Á¡°Ë ¿äû ErrorLog( "PetBaseExecIdleAction::Please Check PetBaseActionData : nNextStepCondType Column" ) end return true else ErrorLog( "PetBaseExecIdleAction::PetMem[\"PetInfo\"][\"nIdleStep\"] is too big" ) return false end end function PetBaseIdleAction( PetMem, tPetIdleActRecord ) cExecCheck( "PetBaseIdleAction" ) if PetMem == nil then DebugLog( "PetBaseIdleAction::PetMem is nil" ) return false end local nHandle = PetMem["PetInfo"]["nHandle"] local nMasterHandle = PetMem["MasterInfo"]["nHandle"] local tPetCoord = PetMem["PetInfo"]["Coord"]["Cur"] local tMasterCoord = PetMem["MasterInfo"]["Coord"]["Cur"] local tMasterLastCoord = PetMem["MasterInfo"]["Coord"]["Last"] if tPetIdleActRecord == nil then ErrorLog( "PetBaseIdleAction::tPetIdleActRecord == nil" ) return false end -- ¾×¼Ç Á¾·ù °¡Á®¿À±â local sAIType = tPetIdleActRecord[ 1 ] if sAIType == "none" then PetMem["PetInfo"]["PetMode"]["nIdleActionMode"] = PIAM_NONE DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_NONE:Selected - nHandle( "..nHandle.." )" ) elseif sAIType == "follow" then PetMem["PetInfo"]["PetMode"]["nIdleActionMode"] = PIAM_FOLLOW DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_FOLLOW:Selected - nHandle( "..nHandle.." )" ) elseif sAIType == "revolution" then PetMem["PetInfo"]["PetMode"]["nIdleActionMode"] = PIAM_REVOLUTION DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_REVOLUTION:Selected - nHandle( "..nHandle.." )" ) elseif sAIType == "dance" then PetMem["PetInfo"]["PetMode"]["nIdleActionMode"] = PIAM_DANCE DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_DANCE:Selected - nHandle( "..nHandle.." )" ) elseif sAIType == "attack" then PetMem["PetInfo"]["PetMode"]["nIdleActionMode"] = PIAM_ATTACK DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_ATTACK:Selected - nHandle( "..nHandle.." )" ) elseif sAIType == "roaming" then PetMem["PetInfo"]["PetMode"]["nIdleActionMode"] = PIAM_ROAMING DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_ROAMING:Selected - nHandle( "..nHandle.." )" ) elseif sAIType == "rotation" then PetMem["PetInfo"]["PetMode"]["nIdleActionMode"] = PIAM_ROTATION DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_ROTATION:Selected - nHandle( "..nHandle.." )" ) elseif sAIType == "talk" then PetMem["PetInfo"]["PetMode"]["nIdleActionMode"] = PIAM_TALK DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_TALK:Selected - nHandle( "..nHandle.." )" ) elseif sAIType == "die" then PetMem["PetInfo"]["PetMode"]["nIdleActionMode"] = PIAM_DIE DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_DIE:Selected - nHandle( "..nHandle.." )" ) else PetMem["PetInfo"]["PetMode"]["nIdleActionMode"] = PIAM_INVALID ErrorLog( "PetBaseIdleAction::sAIType is invalid" ) return false end ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- -- PetMem["PetInfo"]["PetMode"]["nIdleActionMode"] = PIAM_ROAMING -- DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_ROAMING:Forced - nHandle( "..nHandle.." )" ) ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- local nIdleActionMode = PetMem["PetInfo"]["PetMode"]["nIdleActionMode"] local sScriptMessageIndex = tPetIdleActRecord[ 2 ] local sHairEffect = tPetIdleActRecord[ 3 ] local sSoundFile = tPetIdleActRecord[ 4 ] if sScriptMessageIndex == nil then ErrorLog( "PetBaseIdleAction::sScriptMessageIndex is invalid" ) return false end if sHairEffect == nil then ErrorLog( "PetBaseIdleAction::sHairEffect is invalid" ) return false end if sSoundFile == nil then ErrorLog( "PetBaseIdleAction::sSoundFile is invalid" ) return false end -- ÆÐÅϺ° Çൿ if nIdleActionMode == PIAM_NONE -----------------------------------------------------------------------------------------------------------PIAM_NONE then -- ¾øÀ½ if PetMem["PetInfo"]["Time"]["EnterIdleAction"] == PetMem["InitialSec"] then -- ÁøÀÔ¼ÂÆà PetMem["PetInfo"]["Time"]["EnterIdleAction"] = PetMem["CurSec"] PetMem["PetInfo"]["nIdleStep"] = 1 PetMem["PetInfo"]["nIdleEndStep"] = 1 PetBaseScriptMessage( nHandle, sScriptMessageIndex ) PetBaseObjectEffect( nHandle, sHairEffect ) PetBaseObjectSound( nHandle, sSoundFile ) cExecCheck( "PetBaseIdleAction" ) end elseif nIdleActionMode == PIAM_FOLLOW -----------------------------------------------------------------------------------------------------------PIAM_FOLLOW then -- 5Ãʵ¿¾È µ¿ÀÛ, ÁÖÀΰúÀÇ °Å¸® 500Á¦ÇÑ -- Æê µû¶ó°¨ : 200À̳» Æê ¼±ÅÃ, 30°Å¸®±îÁö °è¼Ó Á¢±Ù, 80 ÀÌ»ó À̵¿½ÃÀÛ(ÀÓÀÇ·Î Á¤ÇÔ) if PetMem["PetInfo"]["Time"]["EnterIdleAction"] == PetMem["InitialSec"] then -- ÁøÀÔ¼ÂÆà PetMem["PetInfo"]["Time"]["EnterIdleAction"] = PetMem["CurSec"] PetMem["PetInfo"]["nIdleStep"] = 1 PetMem["PetInfo"]["nIdleEndStep"] = 3 -- ÁÖº¯ Æê Ž»ö local nTargetPetHandle = -1 local tHandleList = { cNearObjectList( nHandle, PetSystem_nDistanceIdleFollowingPetSelectMax, ObjectType["Pet"] ) } if #tHandleList > 0 then nTargetPetHandle = tHandleList[ cRandomInt( 1, #tHandleList ) ] -- ÁÖº¯ Æê µû¶ó´Ù´Ï±â ¾×¼ÇÀ» ÇÒ °æ¿ì ÁÖÀ§ Æê¿¡°Ô ¿µÇâ ÁÜ for i, nCurPetHandle in pairs( tHandleList ) do -- °¢ Æê¿¡´Ù°¡ ¸¶ÀÎµå º¯È­ ¸í·É ·ç¾Æ °í°í°í°í°í°í°í°í if nCurPetHandle ~= nHandle then cPet_ChangeMind( nCurPetHandle, "follow" ); end end end -- ¼±ÅÃµÈ Æê À§Ä¡ Ž»ö local tTargetPetCoord = {} tTargetPetCoord["x"], tTargetPetCoord["y"] = cObjectLocate( nTargetPetHandle ) if tTargetPetCoord["x"] == nil then nTargetPetHandle = -1 end PetMem["TargetInfo"]["nHandle"] = nTargetPetHandle PetMem["TargetInfo"]["Coord"]["Cur"]["x"] = tTargetPetCoord["x"] PetMem["TargetInfo"]["Coord"]["Cur"]["y"] = tTargetPetCoord["y"] PetBaseScriptMessage( nHandle, sScriptMessageIndex ) PetBaseObjectEffect( nHandle, sHairEffect ) PetBaseObjectSound( nHandle, sSoundFile ) cExecCheck( "PetBaseIdleAction" ) end -- ÇØ´ç ÆêÀÌ À¯È¿ÇÏ¸é ½ÇÇà if PetMem["TargetInfo"]["nHandle"] >= 0 then -- RubyFruit 2013.11.23 Àӽà ·Î±× DebugLog( "PetBaseIdleAction::PIAM_FOLLOW::nIdleStep = "..PetMem["PetInfo"]["nIdleStep"] ) local nDistanceSquarePet = cDistanceSquar( nHandle, PetMem["TargetInfo"]["nHandle"] ) local nDistanceSquareMaster = cDistanceSquar( nHandle, nMasterHandle ) ---------------------------------------------------------------------- ---------- //°Å¸®º° Pattern Decision --------------------------------- if nDistanceSquarePet < PS_nDS_IdleFollowingPetStop then -- ¾Æ¹«°Íµµ ¾ÈÇÔ DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_FOLLOW:STOP - nHandle( "..nHandle.." )" ) PetMem["PetInfo"]["nIdleStep"] = 2 elseif nDistanceSquareMaster < PS_nDS_IdleFollowingPetStayMax then -- Æê µû¶ó°¨ --cRunTo( nHandle, PetMem["TargetInfo"]["Coord"]["Cur"]["x"], PetMem["TargetInfo"]["Coord"]["Cur"]["y"], PetSystem_nSpeedRateFollowingMil ) cFollow( nHandle, PetMem["TargetInfo"]["nHandle"], PetFollowGap, PetFollowStop ) PetMem["PetInfo"]["Coord"]["Next"]["x"] = PetMem["TargetInfo"]["Coord"]["Cur"]["x"] PetMem["PetInfo"]["Coord"]["Next"]["y"] = PetMem["TargetInfo"]["Coord"]["Cur"]["y"] DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_FOLLOW:START - nHandle( "..nHandle.." )" ) PetMem["PetInfo"]["nIdleStep"] = 2 else -- Ãë¼Ò Á¶°Ç : °Å¸® DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_FOLLOW:CANCEL by Distance - nHandle( "..nHandle.." )" ) PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"] end ---------- °Å¸®º° Pattern Decision// --------------------------------- ---------------------------------------------------------------------- -- ½Ã°£Á¦ÇÑ Ã¼Å© if PetMem["PetInfo"]["Time"]["EnterIdleAction"] + PetSystem_nSecStayAtIdleFollow <= PetMem["CurSec"] then -- Ãë¼Ò Á¶°Ç : ½Ã°£ DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_FOLLOW:CANCEL by Time - nHandle( "..nHandle.." )" ) PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"] end else -- ÆêÀÌ ¹«È¿ - Çൿ Ãë¼Ò DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_FOLLOW:CANCEL by No Target Pet - nHandle( "..nHandle.." )" ) PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"] end elseif nIdleActionMode == PIAM_REVOLUTION -----------------------------------------------------------------------------------------------------------PIAM_REVOLUTION then -- 10Ãʵ¿¾È µ¿ÀÛ, ÁÖÀÎ ¸ØÃçÀÖÀ»¶§¸¸ µ¿ÀÛ, »ó´ë Æê ÁÖÀÎ ¸ØÃçÀÖÀ»¶§¸¸ µ¿ÀÛ -- 200À̳» Æê ¼±ÅÃ, 30°Å¸®±îÁö Á¢±Ù, Æê ÁÖÀ§¸¦ ºùºù µ¼ 30 ¹ÝÁö¸§À¸·Î if PetMem["PetInfo"]["Time"]["EnterIdleAction"] == PetMem["InitialSec"] then -- ÁøÀÔ¼ÂÆà PetMem["PetInfo"]["Time"]["EnterIdleAction"] = PetMem["CurSec"] PetMem["PetInfo"]["nIdleStep"] = 1 PetMem["PetInfo"]["nIdleEndStep"] = 3 + #PetSystem_tIdleActionData["tData"]["tRevolution"] -- ÁÖº¯ Æê Ž»ö local nTargetPetHandle = -1 local tHandleList = { cNearObjectList( nHandle, PetSystem_nDistanceIdleRevolutionPetSelectMax, ObjectType["Pet"] ) } if #tHandleList > 0 then nTargetPetHandle = tHandleList[ cRandomInt( 1, #tHandleList ) ] -- ÁÖº¯ Æê °øÀü ¾×¼ÇÀ» ÇÒ °æ¿ì ÁÖÀ§ Æê¿¡°Ô ¿µÇâ ÁÜ for i, nCurPetHandle in pairs( tHandleList ) do -- °¢ Æê¿¡´Ù°¡ ¸¶ÀÎµå º¯È­ ¸í·É ·ç¾Æ °í°í°í°í°í°í°í°í if nCurPetHandle ~= nHandle then cPet_ChangeMind( nCurPetHandle, "revolution" ); end end end -- ¼±ÅÃµÈ Æê À§Ä¡ Ž»ö local tTargetPetCoord = {} tTargetPetCoord["x"], tTargetPetCoord["y"] = cObjectLocate( nTargetPetHandle ) if tTargetPetCoord["x"] == nil then nTargetPetHandle = -1 end PetMem["TargetInfo"]["nHandle"] = nTargetPetHandle PetMem["TargetInfo"]["Coord"]["Cur"]["x"] = tTargetPetCoord["x"] PetMem["TargetInfo"]["Coord"]["Cur"]["y"] = tTargetPetCoord["y"] -- °øÀü Á᫐ ÁÂÇ¥ ¼ÂÆà PetMem["PetInfo"]["Coord"]["Center"]["x"] = PetMem["TargetInfo"]["Coord"]["Cur"]["x"] PetMem["PetInfo"]["Coord"]["Center"]["y"] = PetMem["TargetInfo"]["Coord"]["Cur"]["y"] local nTargetPetMasterHandle = cGetMaster( PetMem["TargetInfo"]["nHandle"] ) if nTargetPetMasterHandle == nil then nTargetPetMasterHandle = -1 end PetMem["TargetMasterInfo"]["nHandle"] = nTargetPetMasterHandle local nTargetMasterX, nTargetMasterY = cObjectLocate( PetMem["TargetMasterInfo"]["nHandle"] ) if nTargetMasterX == nil then nTargetPetMasterHandle = -1 end PetMem["TargetMasterInfo"]["Coord"]["Cur"]["x"] = nTargetMasterX PetMem["TargetMasterInfo"]["Coord"]["Cur"]["y"] = nTargetMasterY PetMem["TargetMasterInfo"]["Coord"]["Last"]["x"] = nTargetMasterX PetMem["TargetMasterInfo"]["Coord"]["Last"]["y"] = nTargetMasterY PetBaseScriptMessage( nHandle, sScriptMessageIndex ) PetBaseObjectEffect( nHandle, sHairEffect ) PetBaseObjectSound( nHandle, sSoundFile ) cExecCheck( "PetBaseIdleAction" ) end -- ÇØ´ç Æê°ú ÇØ´ç Æê ¸¶½ºÅÍ°¡ À¯È¿ÇÏ¸é ½ÇÇà if PetMem["TargetInfo"]["nHandle"] >= 0 and PetMem["TargetMasterInfo"]["nHandle"] >= 0 then -- RubyFruit 2013.11.23 Àӽà ·Î±× DebugLog( "PetBaseIdleAction::PIAM_REVOLUTION::nIdleStep = "..PetMem["PetInfo"]["nIdleStep"] ) ---------------------------------------------------------------------- -- ´Ü°èº° ½ÇÇà if PetMem["PetInfo"]["nIdleStep"] == 1 then -- ù ½ºÅÜ -- óÀ½¿¡¸¸ ÆêÀ¸·Î ÇâÇÔ local nDistanceSquare = cDistanceSquar( nHandle, PetMem["TargetInfo"]["nHandle"] ) ---------------------------------------------------------------------- ---------- //°Å¸®º° Pattern Decision --------------------------------- if nDistanceSquare > PS_nDS_IdleRevolutionPetStart then -- Æê µû¶ó°¨ local tTargetCoord = {} tTargetCoord["x"], tTargetCoord["y"] = cGetCoord_Circle( PetMem["TargetInfo"]["Coord"]["Cur"]["x"], PetMem["TargetInfo"]["Coord"]["Cur"]["y"], PetSystem_nDistanceIdleRevolutionPetStop ) cRunTo( nHandle, tTargetCoord["x"], tTargetCoord["y"], PetSystem_nSpeedRateFollowingMil ) PetMem["PetInfo"]["Coord"]["Next"]["x"] = tTargetCoord["x"] PetMem["PetInfo"]["Coord"]["Next"]["y"] = tTargetCoord["y"] DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_REVOLUTION:START Follow - nHandle( "..nHandle.." )" ) end ---------- °Å¸®º° Pattern Decision// --------------------------------- ---------------------------------------------------------------------- PetMem["PetInfo"]["nIdleStep"] = 2 elseif PetMem["PetInfo"]["nIdleStep"] == 2 then -- µÎ¹ø° ½ºÅÜ local nDistanceSquare = cDistanceSquar( PetMem["PetInfo"]["Coord"]["Cur"]["x"], PetMem["PetInfo"]["Coord"]["Cur"]["y"], PetMem["PetInfo"]["Coord"]["Next"]["x"], PetMem["PetInfo"]["Coord"]["Next"]["y"] ) ---------------------------------------------------------------------- ---------- //°Å¸®º° Pattern Decision --------------------------------- if nDistanceSquare <= PS_nDS_IdleRevolutionPetStop then PetMem["PetInfo"]["nIdleStep"] = 3 DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_REVOLUTION:STOP Follow - nHandle( "..nHandle.." )" ) end ---------- °Å¸®º° Pattern Decision// --------------------------------- ---------------------------------------------------------------------- elseif PetMem["PetInfo"]["nIdleStep"] > 2 and PetMem["PetInfo"]["nIdleStep"] < PetMem["PetInfo"]["nIdleEndStep"] then -- °øÀü½ºÅÜ 3 ~ 10 local nStepOffset = 2 local tStepInfo = PetSystem_tIdleActionData["tData"]["tRevolution"] if PetBaseExecIdleAction( PetMem, nStepOffset, tStepInfo, PetSystem_nSpeedRateFollowingMil ) ~= true then ErrorLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_REVOLUTION:PetBaseExecIdleAction Failed - nHandle( "..nHandle.." )" ) end cExecCheck( "PetBaseIdleAction" ) else -- PetMem["PetInfo"]["nIdleStep"] == PetMem["PetInfo"]["nIdleEndStep"] ÀÇ °æ¿ì -- ³¡À̹ǷΠ¾Æ¹«°Íµµ ¾ÈÇÏ°í µÚ·Î ³Ñ±è end -- ´Ü°èº° ½ÇÇà ±¸°£ Á¾·á ---------------------------------------------------------------------- -- ½Ã°£Á¦ÇÑ Ã¼Å© if PetMem["PetInfo"]["Time"]["EnterIdleAction"] + PetSystem_nSecStayAtIdleRevolution <= PetMem["CurSec"] then -- Ãë¼Ò Á¶°Ç : ½Ã°£ DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_REVOLUTION:CANCEL by Time - nHandle( "..nHandle.." )" ) PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"] end -- ¸¶½ºÅÍ ¿òÁ÷ÀÓ Ã¼Å© if IsPetMasterMoved( PetMem ) == true then -- Ãë¼Ò Á¶°Ç : ¸¶½ºÅÍ À̵¿ DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_REVOLUTION:CANCEL by Master Move - nHandle( "..nHandle.." )" ) PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"] end cExecCheck( "PetBaseIdleAction" ) -- »ó´ë¹æ Æê ¸¶½ºÅÍ ¿òÁ÷ÀÓ Ã¼Å© local tTargetPetMasterLastCoord = PetMem["TargetMasterInfo"]["Coord"]["Last"] local tTargetPetMasterCurCoord = PetMem["TargetMasterInfo"]["Coord"]["Cur"] tTargetPetMasterLastCoord["x"] = tTargetPetMasterCurCoord["x"] tTargetPetMasterLastCoord["y"] = tTargetPetMasterCurCoord["y"] tTargetPetMasterCurCoord["x"], tTargetPetMasterCurCoord["y"] = cObjectLocate( PetMem["TargetMasterInfo"]["nHandle"] ) if tTargetPetMasterCurCoord["x"] == nil then -- Ãë¼Ò Á¶°Ç : »ó´ë Æê ¸¶½ºÅÍ ¾îµð´Ï ErrorLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_REVOLUTION:CANCEL by Cannot Find Target Pet Master - nHandle( "..nHandle.." )" ) PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"] end if tTargetPetMasterLastCoord["x"] ~= tTargetPetMasterCurCoord["x"] or tTargetPetMasterLastCoord["y"] ~= tTargetPetMasterCurCoord["y"] then -- Ãë¼Ò Á¶°Ç : »ó´ë Æê ¸¶½ºÅÍ À̵¿ DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_REVOLUTION:CANCEL by Target Pet Master Move - nHandle( "..nHandle.." )" ) PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"] end else -- ÆêÀÌ ¹«È¿ - Çൿ Ãë¼Ò DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_REVOLUTION:CANCEL by No Target Pet - nHandle( "..nHandle.." )" ) PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"] end elseif nIdleActionMode == PIAM_DANCE -----------------------------------------------------------------------------------------------------------PIAM_DANCE then -- 10Ãʵ¿¾È µ¿ÀÛ, ÁÖÀÎ ¸ØÃçÀÖÀ»¶§¸¸ µ¿ÀÛ -- Á¦ÀÚ¸® Á嵄 ¿ìµÑ °ø°Ý : ¿ÞÂÊ º¸±â, °ø°Ý, °ø°Ý, ¿À¸¥Âʺ¸±â, °ø°Ý, °ø°Ý -- Á¦ÀÚ¸® 3¹øµ¹±â : ¹Ý¹ÙÄû¸¦ 1ÃÊ¿¡ µµ´Â ¼Óµµ·Î.. 0µµ 15µµ 30µµ 45µµ 60µµ 75µµ 90µµ 105µµ 120µµ 135µµ 150µµ 165µµ 0µµ... ¹Ýº¹ -- º°Ç¥±×¸®±â : °Å¸® 100 À̳» º°???????? ÁÂÇ¥ 5°³ Âï°í ±Ùó 30 À̳» °¥¶§¸¶´Ù À̵¿ À§Ä¡ Àüȯ -- Á¦ÀÚ¸®µ¹¸ç ¿ø±×¸®±â ÆØÀÌ°¡ ºù±Ûºù±Û : ¹Ý°æ 50 À̳» ¿øÀ» ÀÚÀü 1ÃÊ¿¡ ÇѹÙÄû °øÀü 1ÃÊ¿¡ 20% µ¹±â -- ¿ø±×¸®±â ±×³É ¿ø¸ð¾çÀ¸·Î À̵¿ : °øÀü 1ÃÊ¿¡ 33.3% µ¹±â if PetMem["PetInfo"]["Time"]["EnterIdleAction"] == PetMem["InitialSec"] then -- ÁøÀÔ¼ÂÆà PetMem["PetInfo"]["nCurDanceNo"] = cRandomInt( 1, #PetSystem_tIdleActionData["tData"]["ttDance"] ) DebugLog( "PetBaseIdleAction::PIAM_DANCE::nCurDanceNo = "..PetMem["PetInfo"]["nCurDanceNo"].." has been selected" ) PetMem["PetInfo"]["Time"]["EnterIdleAction"] = PetMem["CurSec"] PetMem["PetInfo"]["nIdleStep"] = 1 PetMem["PetInfo"]["nIdleEndStep"] = 2 + #PetSystem_tIdleActionData["tData"]["ttDance"][ PetMem["PetInfo"]["nCurDanceNo"] ] PetMem["PetInfo"]["Time"]["DanceStartTime"] = PetMem["CurSec"] -- ´í½º Á᫐ ÁÂÇ¥ ¼ÂÆà PetMem["PetInfo"]["Coord"]["Center"]["x"] = PetMem["PetInfo"]["Coord"]["Cur"]["x"] PetMem["PetInfo"]["Coord"]["Center"]["y"] = PetMem["PetInfo"]["Coord"]["Cur"]["y"] PetBaseScriptMessage( nHandle, sScriptMessageIndex ) PetBaseObjectEffect( nHandle, sHairEffect ) PetBaseObjectSound( nHandle, sSoundFile ) cExecCheck( "PetBaseIdleAction" ) end -- RubyFruit 2013.11.23 Àӽà ·Î±× DebugLog( "PetBaseIdleAction::PIAM_DANCE::nIdleStep = "..PetMem["PetInfo"]["nIdleStep"] ) ---------------------------------------------------------------------- -- ´Ü°èº° ½ÇÇà if PetMem["PetInfo"]["nIdleStep"] == 1 then -- ù ½ºÅÜ PetMem["PetInfo"]["nIdleStep"] = 2 DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_DANCE:START Dance - nHandle( "..nHandle.." )" ) elseif PetMem["PetInfo"]["nIdleStep"] > 1 and PetMem["PetInfo"]["nIdleStep"] < PetMem["PetInfo"]["nIdleEndStep"] then -- ´í½º½ºÅÜ : 2 ~ local nStepOffset = 1 local tStepInfo = PetSystem_tIdleActionData["tData"]["ttDance"][ PetMem["PetInfo"]["nCurDanceNo"] ] if PetBaseExecIdleAction( PetMem, nStepOffset, tStepInfo, PetSystem_nSpeedRateFollowingMil ) ~= true then ErrorLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_DANCE:PetBaseExecIdleAction Failed - nHandle( "..nHandle.." )" ) end cExecCheck( "PetBaseIdleAction" ) else -- PetMem["PetInfo"]["nIdleStep"] == PetMem["PetInfo"]["nIdleEndStep"] ÀÇ °æ¿ì -- ³¡À̹ǷΠ¾Æ¹«°Íµµ ¾ÈÇÏ°í µÚ·Î ³Ñ±è end -- ´Ü°èº° ½ÇÇà ±¸°£ Á¾·á ---------------------------------------------------------------------- -- ½Ã°£Á¦ÇÑ Ã¼Å© if PetMem["PetInfo"]["Time"]["EnterIdleAction"] + PetSystem_nSecStayAtIdleDance <= PetMem["CurSec"] then -- Ãë¼Ò Á¶°Ç : ½Ã°£ DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_DANCE:CANCEL by Time - nHandle( "..nHandle.." )" ) PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"] -- Á¦Çѽð£±îÁö Ãã ÃèÀ» °æ¿ì ÁÖÀ§ Æê¿¡°Ô ¿µÇâ ÁÜ local tHandleList = { cNearObjectList( nHandle, PetSystem_nDistanceIdleMindChangePetSelectMax, ObjectType["Pet"] ) } if #tHandleList > 0 then for i, nCurPetHandle in pairs( tHandleList ) do -- °¢ Æê¿¡´Ù°¡ ¸¶ÀÎµå º¯È­ ¸í·É ·ç¾Æ °í°í°í°í°í°í°í°í if nCurPetHandle ~= nHandle then cPet_ChangeMind( nCurPetHandle, "dance" ); end end end end -- ¸¶½ºÅÍ ¿òÁ÷ÀÓ Ã¼Å© if IsPetMasterMoved( PetMem ) == true then -- Ãë¼Ò Á¶°Ç : ¸¶½ºÅÍ À̵¿ DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_DANCE:CANCEL by Master Move - nHandle( "..nHandle.." )" ) PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"] end cExecCheck( "PetBaseIdleAction" ) elseif nIdleActionMode == PIAM_ATTACK -----------------------------------------------------------------------------------------------------------PIAM_ATTACK then -- 1·çƾ¸¸ µ¿ÀÛ, ÁÖÀÎ ¸ØÃçÀÖÀ»¶§¸¸ µ¿ÀÛ, »ó´ë Æê ÁÖÀÎ ¸ØÃçÀÖÀ»¶§¸¸ µ¿ÀÛ -- ÁÖº¯ Æê °ø°Ý : 200°Å¸® À̳» Æê ¼±ÅÃ, ¹æÇâÀüȯ, °ø°Ý, °ø°Ý, °ø°Ý if PetMem["PetInfo"]["Time"]["EnterIdleAction"] == PetMem["InitialSec"] then -- ÁøÀÔ¼ÂÆà PetMem["PetInfo"]["Time"]["EnterIdleAction"] = PetMem["CurSec"] PetMem["PetInfo"]["nIdleStep"] = 1 PetMem["PetInfo"]["nIdleEndStep"] = 3 + #PetSystem_tIdleActionData["tData"]["tAttack"] -- ÁÖº¯ Æê Ž»ö local nTargetPetHandle = -1 local tHandleList = { cNearObjectList( nHandle, PetSystem_nDistanceIdleAttackPetSelectMax, ObjectType["Pet"] ) } if #tHandleList > 0 then nTargetPetHandle = tHandleList[ cRandomInt( 1, #tHandleList ) ] -- ÁÖº¯ Æê °ø°Ý ¾×¼ÇÀ» ÇÒ °æ¿ì ÁÖÀ§ Æê¿¡°Ô ¿µÇâ ÁÜ for i, nCurPetHandle in pairs( tHandleList ) do -- °¢ Æê¿¡´Ù°¡ ¸¶ÀÎµå º¯È­ ¸í·É ·ç¾Æ °í°í°í°í°í°í°í°í if nCurPetHandle ~= nHandle then cPet_ChangeMind( nCurPetHandle, "attack" ); end end end -- ¼±ÅÃµÈ Æê À§Ä¡ Ž»ö local tTargetPetCoord = {} tTargetPetCoord["x"], tTargetPetCoord["y"] = cObjectLocate( nTargetPetHandle ) if tTargetPetCoord["x"] == nil then nTargetPetHandle = -1 end PetMem["TargetInfo"]["nHandle"] = nTargetPetHandle PetMem["TargetInfo"]["Coord"]["Cur"]["x"] = tTargetPetCoord["x"] PetMem["TargetInfo"]["Coord"]["Cur"]["y"] = tTargetPetCoord["y"] -- ¾îÅà Á᫐ ÁÂÇ¥ ¼ÂÆà PetMem["PetInfo"]["Coord"]["Center"]["x"] = tTargetPetCoord["x"] PetMem["PetInfo"]["Coord"]["Center"]["y"] = tTargetPetCoord["y"] local nTargetPetMasterHandle = cGetMaster( PetMem["TargetInfo"]["nHandle"] ) if nTargetPetMasterHandle == nil then nTargetPetMasterHandle = -1 end PetMem["TargetMasterInfo"]["nHandle"] = nTargetPetMasterHandle local nTargetMasterX, nTargetMasterY = cObjectLocate( PetMem["TargetMasterInfo"]["nHandle"] ) if nTargetMasterX == nil then nTargetPetMasterHandle = -1 end PetMem["TargetMasterInfo"]["Coord"]["Cur"]["x"] = nTargetMasterX PetMem["TargetMasterInfo"]["Coord"]["Cur"]["y"] = nTargetMasterY PetMem["TargetMasterInfo"]["Coord"]["Last"]["x"] = nTargetMasterX PetMem["TargetMasterInfo"]["Coord"]["Last"]["y"] = nTargetMasterY PetBaseScriptMessage( nHandle, sScriptMessageIndex ) PetBaseObjectEffect( nHandle, sHairEffect ) PetBaseObjectSound( nHandle, sSoundFile ) cExecCheck( "PetBaseIdleAction" ) end -- ÇØ´ç Æê°ú ÇØ´ç ÆêÀÇ ¸¶½ºÅÍ°¡ À¯È¿ÇÏ¸é ½ÇÇà if PetMem["TargetInfo"]["nHandle"] >= 0 and PetMem["TargetMasterInfo"]["nHandle"] >= 0 then -- RubyFruit 2013.11.23 Àӽà ·Î±× DebugLog( "PetBaseIdleAction::PIAM_ATTACK::nIdleStep = "..PetMem["PetInfo"]["nIdleStep"] ) ---------------------------------------------------------------------- -- ´Ü°èº° ½ÇÇà if PetMem["PetInfo"]["nIdleStep"] == 1 then local nDir4 = cRandomInt( 1, 90 ) local nGoalX, nGoalY = cGetAroundCoord( PetMem["TargetInfo"]["nHandle"], nDir4*4, PetFollowGap ) cRunTo( nHandle, nGoalX, nGoalY, PetSystem_nSpeedRateFollowingMil ) PetMem["PetInfo"]["Coord"]["Next"]["x"] = PetMem["TargetInfo"]["Coord"]["Cur"]["x"] PetMem["PetInfo"]["Coord"]["Next"]["y"] = PetMem["TargetInfo"]["Coord"]["Cur"]["y"] PetMem["PetInfo"]["nIdleStep"] = 2 elseif PetMem["PetInfo"]["nIdleStep"] == 2 then local nDistanceSquarePet = cDistanceSquar( nHandle, PetMem["TargetInfo"]["nHandle"] ) local nDistanceSquareMaster = cDistanceSquar( nHandle, nMasterHandle ) if nDistanceSquarePet < PS_nDS_IdleFollowingPetStop then -- ´Ù¸¥ Æê ÂÊÀ¸·Î ¹æÇâ Àüȯ local tTargetCoord = PetMem["TargetInfo"]["Coord"]["Cur"] cSetObjectDirect( nHandle, tTargetCoord["x"], tTargetCoord["y"] ) PetMem["PetInfo"]["Coord"]["Next"]["x"] = tPetCoord["x"] PetMem["PetInfo"]["Coord"]["Next"]["y"] = tPetCoord["y"] PetMem["PetInfo"]["nIdleStep"] = 3 elseif nDistanceSquareMaster < PS_nDS_IdleFollowingPetStayMax then PetMem["PetInfo"]["Coord"]["Next"]["x"] = PetMem["TargetInfo"]["Coord"]["Cur"]["x"] PetMem["PetInfo"]["Coord"]["Next"]["y"] = PetMem["TargetInfo"]["Coord"]["Cur"]["y"] else PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"] end elseif PetMem["PetInfo"]["nIdleStep"] > 2 and PetMem["PetInfo"]["nIdleStep"] < PetMem["PetInfo"]["nIdleEndStep"] then -- °ø°Ý½ºÅÜ 3 ~ 5 local nStepOffset = 2 local tStepInfo = PetSystem_tIdleActionData["tData"]["tAttack"] if PetBaseExecIdleAction( PetMem, nStepOffset, tStepInfo, 0 ) ~= true then ErrorLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_ATTACK:PetBaseExecIdleAction Failed - nHandle( "..nHandle.." )" ) end cExecCheck( "PetBaseIdleAction" ) else -- PetMem["PetInfo"]["nIdleStep"] == PetMem["PetInfo"]["nIdleEndStep"] ÀÇ °æ¿ì -- ³¡À̹ǷΠ¾Æ¹«°Íµµ ¾ÈÇÏ°í µÚ·Î ³Ñ±è end -- ´Ü°èº° ½ÇÇà ±¸°£ Á¾·á ---------------------------------------------------------------------- ---------------------------------------------------------------------- -- ¸¶½ºÅÍ ¿òÁ÷ÀÓ Ã¼Å© if IsPetMasterMoved( PetMem ) == true then -- Ãë¼Ò Á¶°Ç : ¸¶½ºÅÍ À̵¿ DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_ATTACK:CANCEL by Master Move - nHandle( "..nHandle.." )" ) PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"] end cExecCheck( "PetBaseIdleAction" ) -- »ó´ë¹æ Æê ¸¶½ºÅÍ ¿òÁ÷ÀÓ Ã¼Å© local tTargetPetMasterLastCoord = PetMem["TargetMasterInfo"]["Coord"]["Last"] local tTargetPetMasterCurCoord = PetMem["TargetMasterInfo"]["Coord"]["Cur"] tTargetPetMasterLastCoord["x"] = tTargetPetMasterCurCoord["x"] tTargetPetMasterLastCoord["y"] = tTargetPetMasterCurCoord["y"] tTargetPetMasterCurCoord["x"], tTargetPetMasterCurCoord["y"] = cObjectLocate( PetMem["TargetMasterInfo"]["nHandle"] ) if tTargetPetMasterCurCoord["x"] == nil then -- Ãë¼Ò Á¶°Ç : »ó´ë Æê ¸¶½ºÅÍ ¾îµð? ErrorLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_ATTACK:CANCEL by Cannot Find Target Pet Master - nHandle( "..nHandle.." )" ) PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"] end if tTargetPetMasterLastCoord["x"] ~= tTargetPetMasterCurCoord["x"] or tTargetPetMasterLastCoord["y"] ~= tTargetPetMasterCurCoord["y"] then -- Ãë¼Ò Á¶°Ç : »ó´ë Æê ¸¶½ºÅÍ À̵¿ DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_ATTACK:CANCEL by Target Pet Master Move - nHandle( "..nHandle.." )" ) PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"] end else -- ÆêÀÌ ¹«È¿ - Çൿ Ãë¼Ò DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_ATTACK:CANCEL by No Target Pet - nHandle( "..nHandle.." )" ) PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"] end elseif nIdleActionMode == PIAM_ROAMING -----------------------------------------------------------------------------------------------------------PIAM_ROAMING then -- ±×³É ó¸® -- 20Ãʵ¿¾È µ¿ÀÛ, ÁÖÀÎ ¸ØÃçÀÖÀ»¶§¸¸ µ¿ÀÛ -- ±×³É ¸· ¿òÁ÷¿© ¤»¤»¤»¤»¤»¤»¤»¤»¤» if PetMem["PetInfo"]["Time"]["EnterIdleAction"] == PetMem["InitialSec"] then -- ÁøÀÔ¼ÂÆà PetMem["PetInfo"]["Time"]["EnterIdleAction"] = PetMem["CurSec"] PetMem["PetInfo"]["nIdleStep"] = 1 PetMem["PetInfo"]["nIdleEndStep"] = 2 PetBaseScriptMessage( nHandle, sScriptMessageIndex ) PetBaseObjectEffect( nHandle, sHairEffect ) PetBaseObjectSound( nHandle, sSoundFile ) cExecCheck( "PetBaseIdleAction" ) end -- RubyFruit 2013.11.23 Àӽà ·Î±× DebugLog( "PetBaseIdleAction::PIAM_ROAMING::nIdleStep = "..PetMem["PetInfo"]["nIdleStep"] ) ---------------------------------------------------------------------- -- ´Ü°èº° ½ÇÇà if PetMem["PetInfo"]["nIdleStep"] == 1 then -- ù ½ºÅÜ -- ¾Æ¹«µ¥³ª Âï°í À̵¿ local tTargetCoord = {} tTargetCoord["x"], tTargetCoord["y"] = cGetCoord_Circle( tPetCoord["x"], tPetCoord["y"], PetSystem_nDistanceIdleRoamingMax ) if tTargetCoord["x"] ~= nil then cRunTo( nHandle, tTargetCoord["x"], tTargetCoord["y"], PetSystem_nSpeedRateFollowingMil ) PetMem["PetInfo"]["Coord"]["Next"]["x"] = tTargetCoord["x"] PetMem["PetInfo"]["Coord"]["Next"]["y"] = tTargetCoord["y"] DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_ROAMING:START Roaming - nHandle( "..nHandle.." )" ) PetMem["PetInfo"]["nIdleStep"] = 1 end else -- PetMem["PetInfo"]["nIdleStep"] == PetMem["PetInfo"]["nIdleEndStep"] ÀÇ °æ¿ì -- ³¡À̹ǷΠ¾Æ¹«°Íµµ ¾ÈÇÏ°í µÚ·Î ³Ñ±è end -- ´Ü°èº° ½ÇÇà ±¸°£ Á¾·á ---------------------------------------------------------------------- -- ½Ã°£Á¦ÇÑ Ã¼Å© if PetMem["PetInfo"]["Time"]["EnterIdleAction"] + PetSystem_nSecStayAtIdleRoaming <= PetMem["CurSec"] then -- Ãë¼Ò Á¶°Ç : ½Ã°£ DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_ROAMING:CANCEL by Time - nHandle( "..nHandle.." )" ) PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"] end -- ¸¶½ºÅÍ ¿òÁ÷ÀÓ Ã¼Å© if IsPetMasterMoved( PetMem ) == true then -- Ãë¼Ò Á¶°Ç : ¸¶½ºÅÍ À̵¿ DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_ROAMING:CANCEL by Master Move - nHandle( "..nHandle.." )" ) PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"] end cExecCheck( "PetBaseIdleAction" ) elseif nIdleActionMode == PIAM_ROTATION -----------------------------------------------------------------------------------------------------------PIAM_ROTATION then -- 10Ãʵ¿¾È µ¿ÀÛ, ÁÖÀÎ ¸ØÃçÀÖÀ»¶§¸¸ µ¿ÀÛ -- ÀÚÀü : 20%¸¦ 1ÃÊ¿¡ µµ´Â ¼Óµµ·Î.. 0µµ, 10µµ, 20µµ, 30µµ, 40µµ, ... , 350µµ, 0µµ... ¹Ýº¹ if PetMem["PetInfo"]["Time"]["EnterIdleAction"] == PetMem["InitialSec"] then -- ÁøÀÔ¼ÂÆà PetMem["PetInfo"]["Time"]["EnterIdleAction"] = PetMem["CurSec"] PetMem["PetInfo"]["nIdleStep"] = 1 PetMem["PetInfo"]["nIdleEndStep"] = 2 + #PetSystem_tIdleActionData["tData"]["tRotation"] -- ȸÀü Á᫐ ÁÂÇ¥ ¼ÂÆà PetMem["PetInfo"]["Coord"]["Center"]["x"] = PetMem["PetInfo"]["Coord"]["Cur"]["x"] PetMem["PetInfo"]["Coord"]["Center"]["y"] = PetMem["PetInfo"]["Coord"]["Cur"]["y"] PetBaseScriptMessage( nHandle, sScriptMessageIndex ) PetBaseObjectEffect( nHandle, sHairEffect ) PetBaseObjectSound( nHandle, sSoundFile ) cExecCheck( "PetBaseIdleAction" ) end -- RubyFruit 2013.11.23 Àӽà ·Î±× DebugLog( "PetBaseIdleAction::PIAM_ROTATION::nIdleStep = "..PetMem["PetInfo"]["nIdleStep"] ) ---------------------------------------------------------------------- -- ´Ü°èº° ½ÇÇà if PetMem["PetInfo"]["nIdleStep"] == 1 then -- ù ½ºÅÜ DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_ROTATION:START Pattern- nHandle( "..nHandle.." )" ) PetMem["PetInfo"]["nIdleStep"] = 2 elseif PetMem["PetInfo"]["nIdleStep"] > 1 and PetMem["PetInfo"]["nIdleStep"] < PetMem["PetInfo"]["nIdleEndStep"] then -- ÀÚÀü½ºÅÜ 2 ~ 41 local nStepOffset = 1 local tStepInfo = PetSystem_tIdleActionData["tData"]["tRotation"] if PetBaseExecIdleAction( PetMem, nStepOffset, tStepInfo, PetSystem_nSpeedRateFollowingMil ) ~= true then ErrorLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_ROTATION:PetBaseExecIdleAction Failed - nHandle( "..nHandle.." )" ) end cExecCheck( "PetBaseIdleAction" ) else -- PetMem["PetInfo"]["nIdleStep"] == PetMem["PetInfo"]["nIdleEndStep"] ÀÇ °æ¿ì -- ³¡À̹ǷΠ¾Æ¹«°Íµµ ¾ÈÇÏ°í µÚ·Î ³Ñ±è end -- ´Ü°èº° ½ÇÇà ±¸°£ Á¾·á ---------------------------------------------------------------------- -- ½Ã°£Á¦ÇÑ Ã¼Å© if PetMem["PetInfo"]["Time"]["EnterIdleAction"] + PetSystem_nSecStayAtIdleRotation <= PetMem["CurSec"] then -- Ãë¼Ò Á¶°Ç : ½Ã°£ DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_ROTATION:CANCEL by Time - nHandle( "..nHandle.." )" ) PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"] end -- ¸¶½ºÅÍ ¿òÁ÷ÀÓ Ã¼Å© if IsPetMasterMoved( PetMem ) == true then -- Ãë¼Ò Á¶°Ç : ¸¶½ºÅÍ À̵¿ DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_ROTATION:CANCEL by Master Move - nHandle( "..nHandle.." )" ) PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"] end cExecCheck( "PetBaseIdleAction" ) elseif nIdleActionMode == PIAM_TALK -----------------------------------------------------------------------------------------------------------PIAM_TALK then -- ±×³É ó¸® -- 1ȸ : ¸»ÇÏ´Â ½ºÅÜÀÌ Á¤ÇØÁ® ÀÖÀ½ ÇÏ°í³ª¼­ ÃʱâÈ­ -- ÁÖº¯ Æê ¿¡°Ô ´Ù°¡°¡¼­ ¸»Çϱâ : 200°Å¸® À̳» Æê ¼±ÅÃ, Æê¿¡°Ô 30°Å¸®±îÁö Á¢±Ù, ¹æÇâÀüȯ Åõ Æê, ¸»Çϱâ ÁÖÀΰú 300ÀÌ»ó¹ú¾îÁö¸é ³¡ if PetMem["PetInfo"]["Time"]["EnterIdleAction"] == PetMem["InitialSec"] then -- ÁøÀÔ¼ÂÆà PetMem["PetInfo"]["Time"]["EnterIdleAction"] = PetMem["CurSec"] PetMem["PetInfo"]["nIdleStep"] = 1 PetMem["PetInfo"]["nIdleEndStep"] = 5 -- ÁÖº¯ Æê Ž»ö local nTargetPetHandle = -1 local tHandleList = { cNearObjectList( nHandle, PetSystem_nDistanceIdleTalkPetSelectMax, ObjectType["Pet"] ) } if #tHandleList > 0 then nTargetPetHandle = tHandleList[ cRandomInt( 1, #tHandleList ) ] -- ÁÖº¯ Æê ¿¡°Ô ¸»ÇÏ´Â ¾×¼ÇÀ» ÇÒ °æ¿ì ÁÖÀ§ Æê¿¡°Ô ¿µÇâ ÁÜ for i, nCurPetHandle in pairs( tHandleList ) do -- °¢ Æê¿¡´Ù°¡ ¸¶ÀÎµå º¯È­ ¸í·É ·ç¾Æ °í°í°í°í°í°í°í°í if nCurPetHandle ~= nHandle then cPet_ChangeMind( nCurPetHandle, "talk" ); end end end -- ¼±ÅÃµÈ Æê À§Ä¡ Ž»ö local tTargetPetCoord = {} tTargetPetCoord["x"], tTargetPetCoord["y"] = cObjectLocate( nTargetPetHandle ) if tTargetPetCoord["x"] == nil then nTargetPetHandle = -1 end PetMem["TargetInfo"]["nHandle"] = nTargetPetHandle PetMem["TargetInfo"]["Coord"]["Cur"]["x"] = tTargetPetCoord["x"] PetMem["TargetInfo"]["Coord"]["Cur"]["y"] = tTargetPetCoord["y"] PetBaseObjectEffect( nHandle, sHairEffect ) PetBaseObjectSound( nHandle, sSoundFile ) cExecCheck( "PetBaseIdleAction" ) end -- ÇØ´ç ÆêÀÌ À¯È¿ÇÏ¸é ½ÇÇà if PetMem["TargetInfo"]["nHandle"] >= 0 then -- RubyFruit 2013.11.23 Àӽà ·Î±× DebugLog( "PetBaseIdleAction::PIAM_TALK::nIdleStep = "..PetMem["PetInfo"]["nIdleStep"] ) ---------------------------------------------------------------------- -- ´Ü°èº° ½ÇÇà if PetMem["PetInfo"]["nIdleStep"] == 1 then -- ù ½ºÅÜ -- óÀ½¿¡¸¸ ÆêÀ¸·Î ÇâÇÔ local nDistanceSquare = cDistanceSquar( nHandle, PetMem["TargetInfo"]["nHandle"] ) ---------------------------------------------------------------------- ---------- //°Å¸®º° Pattern Decision --------------------------------- if nDistanceSquare > PS_nDS_IdleTalkPetStart then -- Æê µû¶ó°¨ local tTargetCoord = {} tTargetCoord["x"], tTargetCoord["y"] = cGetCoord_Circle( PetMem["TargetInfo"]["Coord"]["Cur"]["x"], PetMem["TargetInfo"]["Coord"]["Cur"]["y"], PetSystem_nDistanceIdleRevolutionPetStop ) cRunTo( nHandle, tTargetCoord["x"], tTargetCoord["y"], PetSystem_nSpeedRateFollowingMil ) PetMem["PetInfo"]["Coord"]["Next"]["x"] = tTargetCoord["x"] PetMem["PetInfo"]["Coord"]["Next"]["y"] = tTargetCoord["y"] DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_TALK:START Follow - nHandle( "..nHandle.." )" ) end ---------- °Å¸®º° Pattern Decision// --------------------------------- ---------------------------------------------------------------------- PetMem["PetInfo"]["nIdleStep"] = 2 elseif PetMem["PetInfo"]["nIdleStep"] == 2 then -- µÎ¹ø° ½ºÅÜ : ¸¶½ºÅÍ¿ÍÀÇ °Å¸®¸¦ üũÇÏ¸ç ´Ù¸¥Æê¿¡°Ô ´Ù°¡°¨ local nDistanceSquare = cDistanceSquar( PetMem["PetInfo"]["Coord"]["Cur"]["x"], PetMem["PetInfo"]["Coord"]["Cur"]["y"], PetMem["PetInfo"]["Coord"]["Next"]["x"], PetMem["PetInfo"]["Coord"]["Next"]["y"] ) local nDistanceSquareMaster = cDistanceSquar( nHandle, nMasterHandle ) ---------------------------------------------------------------------- ---------- //°Å¸®º° Pattern Decision --------------------------------- if nDistanceSquare <= PS_nDS_IdleTalkPetStop then PetMem["PetInfo"]["nIdleStep"] = 3 DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_TALK:STOP Follow - nHandle( "..nHandle.." )" ) elseif nDistanceSquareMaster > PS_nDS_IdleTalkPetStayMax then -- Ãë¼Ò Á¶°Ç : ¸¶½ºÅÍ¿ÍÀÇ °Å¸® DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_TALK:CANCEL by Distance from Master - nHandle( "..nHandle.." )" ) PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"] end ---------- °Å¸®º° Pattern Decision// --------------------------------- ---------------------------------------------------------------------- elseif PetMem["PetInfo"]["nIdleStep"] == 3 then -- ´ë»ó Æê ÂÊÀ¸·Î ¹æÇâ Àüȯ local tTargetCoord = PetMem["TargetInfo"]["Coord"]["Cur"] cSetObjectDirect( nHandle, tTargetCoord["x"], tTargetCoord["y"] ) PetMem["PetInfo"]["Coord"]["Next"]["x"] = tPetCoord["x"] PetMem["PetInfo"]["Coord"]["Next"]["y"] = tPetCoord["y"] DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_TALK:START See - nHandle( "..nHandle.." )" ) PetMem["PetInfo"]["nIdleStep"] = 4 elseif PetMem["PetInfo"]["nIdleStep"] == 4 then -- ¸»Çϱâ PetBaseScriptMessage( nHandle, sScriptMessageIndex ) cExecCheck( "PetBaseIdleAction" ) DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_TALK:START Talk - nHandle( "..nHandle.." )" ) PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"] else -- PetMem["PetInfo"]["nIdleStep"] == PetMem["PetInfo"]["nIdleEndStep"] ÀÇ °æ¿ì -- ³¡À̹ǷΠ¾Æ¹«°Íµµ ¾ÈÇÏ°í µÚ·Î ³Ñ±è end -- ´Ü°èº° ½ÇÇà ±¸°£ Á¾·á ---------------------------------------------------------------------- else -- ÆêÀÌ ¹«È¿ - Çൿ Ãë¼Ò DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_TALK:CANCEL by No Target Pet - nHandle( "..nHandle.." )" ) PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"] end elseif nIdleActionMode == PIAM_DIE -----------------------------------------------------------------------------------------------------------PIAM_DIE then -- ±×³É ó¸® -- 10ÃÊ°£ Á×ÀºÃ´ if PetMem["PetInfo"]["Time"]["EnterIdleAction"] == PetMem["InitialSec"] then -- ÁøÀÔ¼ÂÆà PetMem["PetInfo"]["Time"]["EnterIdleAction"] = PetMem["CurSec"] PetMem["PetInfo"]["nIdleStep"] = 1 PetMem["PetInfo"]["nIdleEndStep"] = 3 PetBaseScriptMessage( nHandle, sScriptMessageIndex ) PetBaseObjectEffect( nHandle, sHairEffect ) PetBaseObjectSound( nHandle, sSoundFile ) cExecCheck( "PetBaseIdleAction" ) end -- RubyFruit 2013.11.23 Àӽà ·Î±× DebugLog( "PetBaseIdleAction::PIAM_DIE::nIdleStep = "..PetMem["PetInfo"]["nIdleStep"] ) ---------------------------------------------------------------------- -- ´Ü°èº° ½ÇÇà if PetMem["PetInfo"]["nIdleStep"] == 1 then -- ù ½ºÅÜ -- ¾Ö´Ï¸ÞÀ̼ÇÀº Æê Á¾·ù¸¶´Ù ´Ù¸¥ °ÍÀ» »ç¿ëÇؾßÇÏ´Â ´ÜÁ¡ÀÌ À־ À̺¥Æ® Äڵ带 Á÷Á¢ »ç¿ëÇϱâ·Î ÇÔ if cActByEventCode( nHandle, PetSystem_ActionEventCode["Die"] ) == nil then ErrorLog( "cActByEventCode failed ["..nHandle.."]'s Die" ) end DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_DIE:START Die animation - nHandle( "..nHandle.." )" ) PetMem["PetInfo"]["nIdleStep"] = 2 elseif PetMem["PetInfo"]["nIdleStep"] == 2 then DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_DIE:Not Do Anithing - nHandle( "..nHandle.." )" ) else -- PetMem["PetInfo"]["nIdleStep"] == PetMem["PetInfo"]["nIdleEndStep"] ÀÇ °æ¿ì -- ³¡À̹ǷΠ¾Æ¹«°Íµµ ¾ÈÇÏ°í µÚ·Î ³Ñ±è end -- ´Ü°èº° ½ÇÇà ±¸°£ Á¾·á ---------------------------------------------------------------------- -- ½Ã°£Á¦ÇÑ Ã¼Å© if PetMem["PetInfo"]["Time"]["EnterIdleAction"] + PetSystem_nSecStayAtIdleDie <= PetMem["CurSec"] then -- Ãë¼Ò Á¶°Ç : ½Ã°£ DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_DIE:CANCEL by Time - nHandle( "..nHandle.." )" ) PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"] -- Á×¾îÀÖ´Â ¸ð½ÀÀ¸·Î °è¼Ó ÀÖ´Â ¹®Á¦ ¶§¹®¿¡ Idle·Î º¯°æ cActByEventCode( nHandle, PetSystem_ActionEventCode["Idle"] ) end else -- logic error ErrorLog( "PetBaseIdleAction::nIdleActionMode is invalid - logic error" ) return false end -- ¸¶Áö¸· ½ºÅÜ Ã³¸® ÀÌÈÄ ÃʱâÈ­ : ¸¶Áö¸·À¸·Î Idle ÇൿÀ» Çß´Ù°í ÇÏ´Â ½Ã°£ °»½ÅÀ» À̶§ Çѹø ´õ ÇÑ´Ù.(´Ù¸¥ °÷¿¡¼­ ÇÏ´Â °Í°ú´Â °ü°è ¾øÀÌ Çѹø ´õ ÇØÁÖ´Â ¼À) if PetMem["PetInfo"]["nIdleStep"] >= PetMem["PetInfo"]["nIdleEndStep"] then if PetBaseInitIdleAction( PetMem ) ~= true then return false end cExecCheck( "PetBaseIdleAction" ) if PetBaseInitTarget( PetMem ) ~= true then return false end cExecCheck( "PetBaseIdleAction" ) if PetBaseInitTargetMaster( PetMem ) ~= true then return false end cExecCheck( "PetBaseIdleAction" ) -- PetMem["PetInfo"]["PetMode"]["nMasterMode"] = PMM_NONE PetMem["PetInfo"]["PetMode"]["nActionMode"] = PAM_NONE PetMem["PetInfo"]["Time"]["LastActIdleMode"] = PetMem["CurSec"] local nWaitIdleActSec = cRandomInt( PetSystem_nSecMinWaitActAtIdle, PetSystem_nSecMaxWaitActAtIdle ) PetMem["PetInfo"]["Time"]["ExecIdleActMode"] = PetMem["CurSec"] + nWaitIdleActSec return true end --PetMem["PetInfo"]["PetMode"]["nIdleActionMode"] end