|
|
|
|
|
|
|
|
|
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"]
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD>ش<EFBFBD> <EFBFBD>ܰ谡 <EFBFBD><EFBFBD>ȿ<EFBFBD>ϸ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if PetMem["PetInfo"]["nIdleStep"] - nStepOffset <= #tStepInfo
|
|
|
|
|
then
|
|
|
|
|
local tCurStep = tStepInfo[ PetMem["PetInfo"]["nIdleStep"] - nStepOffset ]
|
|
|
|
|
|
|
|
|
|
local nStepType = tCurStep[ tStepHeader["nStepType"] ]
|
|
|
|
|
local nNextStepCondType = tCurStep[ tStepHeader["nNextStepCondType"] ]
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ÿ<EFBFBD>Ժ<EFBFBD> <EFBFBD>ൿ ( <EFBFBD><EFBFBD> <EFBFBD>ܰ<EFBFBD><EFBFBD><EFBFBD> 1ȸ<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD> )
|
|
|
|
|
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 <EFBFBD><EFBFBD><EFBFBD>߱<EFBFBD>
|
|
|
|
|
if nDirect360 >= 360
|
|
|
|
|
then
|
|
|
|
|
nDirect360 = nDirect360 - 360
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if nDirect360 < 0
|
|
|
|
|
then
|
|
|
|
|
nDirect360 = nDirect360 + 360
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 0~179 <EFBFBD><EFBFBD><EFBFBD>߱<EFBFBD>
|
|
|
|
|
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
|
|
|
|
|
-- <EFBFBD>ִϸ<EFBFBD><EFBFBD>̼<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ٸ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؾ<EFBFBD><EFBFBD>ϴ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>־ <EFBFBD>̺<EFBFBD>Ʈ <EFBFBD>ڵ带 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϱ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>
|
|
|
|
|
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
|
|
|
|
|
-- <EFBFBD>߸<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>û
|
|
|
|
|
ErrorLog( "PetBaseExecIdleAction::Please Check PetBaseActionData : nStepType Column" )
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>Ǻ<EFBFBD> <EFBFBD>ൿ
|
|
|
|
|
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 )
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>Ÿ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
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"] ]
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> ù <EFBFBD><EFBFBD><EFBFBD>Խ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ð<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if PetMem["PetInfo"]["dNextIdleStepTime"] == PetMem["InitialSec"]
|
|
|
|
|
then
|
|
|
|
|
PetMem["PetInfo"]["dNextIdleStepTime"] = PetMem["CurSec"] + nTimeCond
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD>ð<EFBFBD> <EFBFBD>Ǹ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
-- üũ <EFBFBD>ð<EFBFBD> <EFBFBD>ʱ<EFBFBD>ȭ
|
|
|
|
|
PetMem["PetInfo"]["dNextIdleStepTime"] = PetMem["InitialSec"]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
DebugLog( "PetBaseExecIdleAction::nNextStepCondType == PNIST_TIME" )
|
|
|
|
|
|
|
|
|
|
elseif nNextStepCondType == PNIST_END -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>-----------------------------------------------------------------------------------------------------------PNIST_END
|
|
|
|
|
then
|
|
|
|
|
PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"]
|
|
|
|
|
|
|
|
|
|
DebugLog( "PetBaseExecIdleAction::nNextStepCondType == PNIST_END" )
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
-- <EFBFBD>߸<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>û
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD>Ϻ<EFBFBD> <EFBFBD>ൿ
|
|
|
|
|
if nIdleActionMode == PIAM_NONE -----------------------------------------------------------------------------------------------------------PIAM_NONE
|
|
|
|
|
then
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if PetMem["PetInfo"]["Time"]["EnterIdleAction"] == PetMem["InitialSec"]
|
|
|
|
|
then
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
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<EFBFBD>ʵ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD>ΰ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD>Ÿ<EFBFBD> 500<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
-- <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : 200<EFBFBD>̳<EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>, 30<EFBFBD>Ÿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>, 80 <EFBFBD>̻<EFBFBD> <EFBFBD>̵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|
|
|
|
|
|
|
|
|
if PetMem["PetInfo"]["Time"]["EnterIdleAction"] == PetMem["InitialSec"]
|
|
|
|
|
then
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
PetMem["PetInfo"]["Time"]["EnterIdleAction"] = PetMem["CurSec"]
|
|
|
|
|
PetMem["PetInfo"]["nIdleStep"] = 1
|
|
|
|
|
PetMem["PetInfo"]["nIdleEndStep"] = 3
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD>ֺ<EFBFBD> <EFBFBD><EFBFBD> Ž<EFBFBD><EFBFBD>
|
|
|
|
|
local nTargetPetHandle = -1
|
|
|
|
|
local tHandleList = { cNearObjectList( nHandle, PetSystem_nDistanceIdleFollowingPetSelectMax, ObjectType["Pet"] ) }
|
|
|
|
|
if #tHandleList > 0
|
|
|
|
|
then
|
|
|
|
|
nTargetPetHandle = tHandleList[ cRandomInt( 1, #tHandleList ) ]
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD>ֺ<EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٴϱ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>꿡<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>
|
|
|
|
|
for i, nCurPetHandle in pairs( tHandleList )
|
|
|
|
|
do
|
|
|
|
|
-- <EFBFBD><EFBFBD> <EFBFBD>꿡<EFBFBD>ٰ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ε<EFBFBD> <EFBFBD><EFBFBD>ȭ <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if nCurPetHandle ~= nHandle
|
|
|
|
|
then
|
|
|
|
|
cPet_ChangeMind( nCurPetHandle, "follow" );
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ġ Ž<EFBFBD><EFBFBD>
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD>ش<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ȿ<EFBFBD>ϸ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if PetMem["TargetInfo"]["nHandle"] >= 0
|
|
|
|
|
then
|
|
|
|
|
-- RubyFruit 2013.11.23 <EFBFBD>ӽ<EFBFBD> <EFBFBD>α<EFBFBD>
|
|
|
|
|
DebugLog( "PetBaseIdleAction::PIAM_FOLLOW::nIdleStep = "..PetMem["PetInfo"]["nIdleStep"] )
|
|
|
|
|
|
|
|
|
|
local nDistanceSquarePet = cDistanceSquar( nHandle, PetMem["TargetInfo"]["nHandle"] )
|
|
|
|
|
local nDistanceSquareMaster = cDistanceSquar( nHandle, nMasterHandle )
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
---------- //<EFBFBD>Ÿ<EFBFBD><EFBFBD><EFBFBD> Pattern Decision ---------------------------------
|
|
|
|
|
if nDistanceSquarePet < PS_nDS_IdleFollowingPetStop
|
|
|
|
|
then
|
|
|
|
|
-- <EFBFBD>ƹ<EFBFBD><EFBFBD>͵<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_FOLLOW:STOP - nHandle( "..nHandle.." )" )
|
|
|
|
|
|
|
|
|
|
PetMem["PetInfo"]["nIdleStep"] = 2
|
|
|
|
|
|
|
|
|
|
elseif nDistanceSquareMaster < PS_nDS_IdleFollowingPetStayMax
|
|
|
|
|
then
|
|
|
|
|
-- <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
--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
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <EFBFBD>Ÿ<EFBFBD>
|
|
|
|
|
DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_FOLLOW:CANCEL by Distance - nHandle( "..nHandle.." )" )
|
|
|
|
|
|
|
|
|
|
PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"]
|
|
|
|
|
end
|
|
|
|
|
---------- <EFBFBD>Ÿ<EFBFBD><EFBFBD><EFBFBD> Pattern Decision// ---------------------------------
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD>ð<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> üũ
|
|
|
|
|
if PetMem["PetInfo"]["Time"]["EnterIdleAction"] + PetSystem_nSecStayAtIdleFollow <= PetMem["CurSec"]
|
|
|
|
|
then
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <EFBFBD>ð<EFBFBD>
|
|
|
|
|
DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_FOLLOW:CANCEL by Time - nHandle( "..nHandle.." )" )
|
|
|
|
|
|
|
|
|
|
PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ȿ - <EFBFBD>ൿ <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
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<EFBFBD>ʵ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
-- 200<EFBFBD>̳<EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>, 30<EFBFBD>Ÿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> 30 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if PetMem["PetInfo"]["Time"]["EnterIdleAction"] == PetMem["InitialSec"]
|
|
|
|
|
then
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
PetMem["PetInfo"]["Time"]["EnterIdleAction"] = PetMem["CurSec"]
|
|
|
|
|
PetMem["PetInfo"]["nIdleStep"] = 1
|
|
|
|
|
PetMem["PetInfo"]["nIdleEndStep"] = 3 + #PetSystem_tIdleActionData["tData"]["tRevolution"]
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD>ֺ<EFBFBD> <EFBFBD><EFBFBD> Ž<EFBFBD><EFBFBD>
|
|
|
|
|
local nTargetPetHandle = -1
|
|
|
|
|
local tHandleList = { cNearObjectList( nHandle, PetSystem_nDistanceIdleRevolutionPetSelectMax, ObjectType["Pet"] ) }
|
|
|
|
|
if #tHandleList > 0
|
|
|
|
|
then
|
|
|
|
|
nTargetPetHandle = tHandleList[ cRandomInt( 1, #tHandleList ) ]
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD>ֺ<EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>꿡<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>
|
|
|
|
|
for i, nCurPetHandle in pairs( tHandleList )
|
|
|
|
|
do
|
|
|
|
|
-- <EFBFBD><EFBFBD> <EFBFBD>꿡<EFBFBD>ٰ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ε<EFBFBD> <EFBFBD><EFBFBD>ȭ <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if nCurPetHandle ~= nHandle
|
|
|
|
|
then
|
|
|
|
|
cPet_ChangeMind( nCurPetHandle, "revolution" );
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ġ Ž<EFBFBD><EFBFBD>
|
|
|
|
|
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"]
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>߽<EFBFBD> <EFBFBD><EFBFBD>ǥ <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD>ش<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ش<EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͱ<EFBFBD> <EFBFBD><EFBFBD>ȿ<EFBFBD>ϸ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if PetMem["TargetInfo"]["nHandle"] >= 0 and PetMem["TargetMasterInfo"]["nHandle"] >= 0
|
|
|
|
|
then
|
|
|
|
|
|
|
|
|
|
-- RubyFruit 2013.11.23 <EFBFBD>ӽ<EFBFBD> <EFBFBD>α<EFBFBD>
|
|
|
|
|
DebugLog( "PetBaseIdleAction::PIAM_REVOLUTION::nIdleStep = "..PetMem["PetInfo"]["nIdleStep"] )
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
-- <EFBFBD>ܰ躰 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if PetMem["PetInfo"]["nIdleStep"] == 1
|
|
|
|
|
then
|
|
|
|
|
-- ù <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
-- ó<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
local nDistanceSquare = cDistanceSquar( nHandle, PetMem["TargetInfo"]["nHandle"] )
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
---------- //<EFBFBD>Ÿ<EFBFBD><EFBFBD><EFBFBD> Pattern Decision ---------------------------------
|
|
|
|
|
if nDistanceSquare > PS_nDS_IdleRevolutionPetStart
|
|
|
|
|
then
|
|
|
|
|
-- <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
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
|
|
|
|
|
---------- <EFBFBD>Ÿ<EFBFBD><EFBFBD><EFBFBD> Pattern Decision// ---------------------------------
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
PetMem["PetInfo"]["nIdleStep"] = 2
|
|
|
|
|
|
|
|
|
|
elseif PetMem["PetInfo"]["nIdleStep"] == 2
|
|
|
|
|
then
|
|
|
|
|
-- <EFBFBD>ι<EFBFBD>° <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
local nDistanceSquare = cDistanceSquar( PetMem["PetInfo"]["Coord"]["Cur"]["x"], PetMem["PetInfo"]["Coord"]["Cur"]["y"], PetMem["PetInfo"]["Coord"]["Next"]["x"], PetMem["PetInfo"]["Coord"]["Next"]["y"] )
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
---------- //<EFBFBD>Ÿ<EFBFBD><EFBFBD><EFBFBD> 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
|
|
|
|
|
---------- <EFBFBD>Ÿ<EFBFBD><EFBFBD><EFBFBD> Pattern Decision// ---------------------------------
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
elseif PetMem["PetInfo"]["nIdleStep"] > 2 and PetMem["PetInfo"]["nIdleStep"] < PetMem["PetInfo"]["nIdleEndStep"]
|
|
|
|
|
then
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 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"] <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD>̹Ƿ<EFBFBD> <EFBFBD>ƹ<EFBFBD><EFBFBD>͵<EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD> <EFBFBD>ڷ<EFBFBD> <EFBFBD>ѱ<EFBFBD>
|
|
|
|
|
end
|
|
|
|
|
-- <EFBFBD>ܰ躰 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD>ð<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> üũ
|
|
|
|
|
if PetMem["PetInfo"]["Time"]["EnterIdleAction"] + PetSystem_nSecStayAtIdleRevolution <= PetMem["CurSec"]
|
|
|
|
|
then
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <EFBFBD>ð<EFBFBD>
|
|
|
|
|
DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_REVOLUTION:CANCEL by Time - nHandle( "..nHandle.." )" )
|
|
|
|
|
|
|
|
|
|
PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> üũ
|
|
|
|
|
if IsPetMasterMoved( PetMem ) == true
|
|
|
|
|
then
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>̵<EFBFBD>
|
|
|
|
|
DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_REVOLUTION:CANCEL by Master Move - nHandle( "..nHandle.." )" )
|
|
|
|
|
|
|
|
|
|
PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"]
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
cExecCheck( "PetBaseIdleAction" )
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> üũ
|
|
|
|
|
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
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
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
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>̵<EFBFBD>
|
|
|
|
|
DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_REVOLUTION:CANCEL by Target Pet Master Move - nHandle( "..nHandle.." )" )
|
|
|
|
|
|
|
|
|
|
PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"]
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ȿ - <EFBFBD>ൿ <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
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<EFBFBD>ʵ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD>ڸ<EFBFBD> <EFBFBD>µ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʺ<EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD>ڸ<EFBFBD> 3<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <EFBFBD>ݹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1<EFBFBD>ʿ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ӵ<EFBFBD><EFBFBD><EFBFBD>.. 0<EFBFBD><EFBFBD> 15<EFBFBD><EFBFBD> 30<EFBFBD><EFBFBD> 45<EFBFBD><EFBFBD> 60<EFBFBD><EFBFBD> 75<EFBFBD><EFBFBD> 90<EFBFBD><EFBFBD> 105<EFBFBD><EFBFBD> 120<EFBFBD><EFBFBD> 135<EFBFBD><EFBFBD> 150<EFBFBD><EFBFBD> 165<EFBFBD><EFBFBD> 0<EFBFBD><EFBFBD>... <EFBFBD>ݺ<EFBFBD>
|
|
|
|
|
-- <EFBFBD><EFBFBD>ǥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <EFBFBD>Ÿ<EFBFBD> 100 <EFBFBD>̳<EFBFBD> <EFBFBD><EFBFBD>???????? <EFBFBD><EFBFBD>ǥ 5<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ó 30 <EFBFBD>̳<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>̵<EFBFBD> <EFBFBD><EFBFBD>ġ <EFBFBD><EFBFBD>ȯ
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD>ڸ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>̰<EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ۺ<EFBFBD><EFBFBD><EFBFBD> : <EFBFBD>ݰ<EFBFBD> 50 <EFBFBD>̳<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1<EFBFBD>ʿ<EFBFBD> <EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1<EFBFBD>ʿ<EFBFBD> 20% <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>׳<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>̵<EFBFBD> : <EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1<EFBFBD>ʿ<EFBFBD> 33.3% <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if PetMem["PetInfo"]["Time"]["EnterIdleAction"] == PetMem["InitialSec"]
|
|
|
|
|
then
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
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"]
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>߽<EFBFBD> <EFBFBD><EFBFBD>ǥ <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
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 <EFBFBD>ӽ<EFBFBD> <EFBFBD>α<EFBFBD>
|
|
|
|
|
DebugLog( "PetBaseIdleAction::PIAM_DANCE::nIdleStep = "..PetMem["PetInfo"]["nIdleStep"] )
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
-- <EFBFBD>ܰ躰 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if PetMem["PetInfo"]["nIdleStep"] == 1
|
|
|
|
|
then
|
|
|
|
|
-- ù <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : 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"] <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD>̹Ƿ<EFBFBD> <EFBFBD>ƹ<EFBFBD><EFBFBD>͵<EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD> <EFBFBD>ڷ<EFBFBD> <EFBFBD>ѱ<EFBFBD>
|
|
|
|
|
end
|
|
|
|
|
-- <EFBFBD>ܰ躰 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD>ð<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> üũ
|
|
|
|
|
if PetMem["PetInfo"]["Time"]["EnterIdleAction"] + PetSystem_nSecStayAtIdleDance <= PetMem["CurSec"]
|
|
|
|
|
then
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <EFBFBD>ð<EFBFBD>
|
|
|
|
|
DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_DANCE:CANCEL by Time - nHandle( "..nHandle.." )" )
|
|
|
|
|
|
|
|
|
|
PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"]
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD>ѽð<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>꿡<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>
|
|
|
|
|
local tHandleList = { cNearObjectList( nHandle, PetSystem_nDistanceIdleMindChangePetSelectMax, ObjectType["Pet"] ) }
|
|
|
|
|
if #tHandleList > 0
|
|
|
|
|
then
|
|
|
|
|
for i, nCurPetHandle in pairs( tHandleList )
|
|
|
|
|
do
|
|
|
|
|
-- <EFBFBD><EFBFBD> <EFBFBD>꿡<EFBFBD>ٰ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ε<EFBFBD> <EFBFBD><EFBFBD>ȭ <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if nCurPetHandle ~= nHandle
|
|
|
|
|
then
|
|
|
|
|
cPet_ChangeMind( nCurPetHandle, "dance" );
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> üũ
|
|
|
|
|
if IsPetMasterMoved( PetMem ) == true
|
|
|
|
|
then
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>̵<EFBFBD>
|
|
|
|
|
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<EFBFBD><EFBFBD>ƾ<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
-- <EFBFBD>ֺ<EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> : 200<EFBFBD>Ÿ<EFBFBD> <EFBFBD>̳<EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȯ, <EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if PetMem["PetInfo"]["Time"]["EnterIdleAction"] == PetMem["InitialSec"]
|
|
|
|
|
then
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
PetMem["PetInfo"]["Time"]["EnterIdleAction"] = PetMem["CurSec"]
|
|
|
|
|
PetMem["PetInfo"]["nIdleStep"] = 1
|
|
|
|
|
PetMem["PetInfo"]["nIdleEndStep"] = 3 + #PetSystem_tIdleActionData["tData"]["tAttack"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD>ֺ<EFBFBD> <EFBFBD><EFBFBD> Ž<EFBFBD><EFBFBD>
|
|
|
|
|
local nTargetPetHandle = -1
|
|
|
|
|
local tHandleList = { cNearObjectList( nHandle, PetSystem_nDistanceIdleAttackPetSelectMax, ObjectType["Pet"] ) }
|
|
|
|
|
if #tHandleList > 0
|
|
|
|
|
then
|
|
|
|
|
nTargetPetHandle = tHandleList[ cRandomInt( 1, #tHandleList ) ]
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD>ֺ<EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>꿡<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>
|
|
|
|
|
for i, nCurPetHandle in pairs( tHandleList )
|
|
|
|
|
do
|
|
|
|
|
-- <EFBFBD><EFBFBD> <EFBFBD>꿡<EFBFBD>ٰ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ε<EFBFBD> <EFBFBD><EFBFBD>ȭ <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if nCurPetHandle ~= nHandle
|
|
|
|
|
then
|
|
|
|
|
cPet_ChangeMind( nCurPetHandle, "attack" );
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ġ Ž<EFBFBD><EFBFBD>
|
|
|
|
|
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"]
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>߽<EFBFBD> <EFBFBD><EFBFBD>ǥ <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD>ش<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ش<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͱ<EFBFBD> <EFBFBD><EFBFBD>ȿ<EFBFBD>ϸ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if PetMem["TargetInfo"]["nHandle"] >= 0 and PetMem["TargetMasterInfo"]["nHandle"] >= 0
|
|
|
|
|
then
|
|
|
|
|
-- RubyFruit 2013.11.23 <EFBFBD>ӽ<EFBFBD> <EFBFBD>α<EFBFBD>
|
|
|
|
|
DebugLog( "PetBaseIdleAction::PIAM_ATTACK::nIdleStep = "..PetMem["PetInfo"]["nIdleStep"] )
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
-- <EFBFBD>ܰ躰 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD>ٸ<EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ȯ
|
|
|
|
|
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
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD>ݽ<EFBFBD><EFBFBD><EFBFBD> 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"] <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD>̹Ƿ<EFBFBD> <EFBFBD>ƹ<EFBFBD><EFBFBD>͵<EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD> <EFBFBD>ڷ<EFBFBD> <EFBFBD>ѱ<EFBFBD>
|
|
|
|
|
end
|
|
|
|
|
-- <EFBFBD>ܰ躰 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> üũ
|
|
|
|
|
if IsPetMasterMoved( PetMem ) == true
|
|
|
|
|
then
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>̵<EFBFBD>
|
|
|
|
|
DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_ATTACK:CANCEL by Master Move - nHandle( "..nHandle.." )" )
|
|
|
|
|
|
|
|
|
|
PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"]
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
cExecCheck( "PetBaseIdleAction" )
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> üũ
|
|
|
|
|
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
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>?
|
|
|
|
|
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
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>̵<EFBFBD>
|
|
|
|
|
DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_ATTACK:CANCEL by Target Pet Master Move - nHandle( "..nHandle.." )" )
|
|
|
|
|
|
|
|
|
|
PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"]
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ȿ - <EFBFBD>ൿ <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
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
|
|
|
|
|
-- <EFBFBD>׳<EFBFBD> ó<EFBFBD><EFBFBD>
|
|
|
|
|
-- 20<EFBFBD>ʵ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
-- <EFBFBD>׳<EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if PetMem["PetInfo"]["Time"]["EnterIdleAction"] == PetMem["InitialSec"]
|
|
|
|
|
then
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
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 <EFBFBD>ӽ<EFBFBD> <EFBFBD>α<EFBFBD>
|
|
|
|
|
DebugLog( "PetBaseIdleAction::PIAM_ROAMING::nIdleStep = "..PetMem["PetInfo"]["nIdleStep"] )
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
-- <EFBFBD>ܰ躰 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if PetMem["PetInfo"]["nIdleStep"] == 1
|
|
|
|
|
then
|
|
|
|
|
-- ù <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD>ƹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>̵<EFBFBD>
|
|
|
|
|
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"] <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD>̹Ƿ<EFBFBD> <EFBFBD>ƹ<EFBFBD><EFBFBD>͵<EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD> <EFBFBD>ڷ<EFBFBD> <EFBFBD>ѱ<EFBFBD>
|
|
|
|
|
end
|
|
|
|
|
-- <EFBFBD>ܰ躰 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD>ð<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> üũ
|
|
|
|
|
if PetMem["PetInfo"]["Time"]["EnterIdleAction"] + PetSystem_nSecStayAtIdleRoaming <= PetMem["CurSec"]
|
|
|
|
|
then
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <EFBFBD>ð<EFBFBD>
|
|
|
|
|
DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_ROAMING:CANCEL by Time - nHandle( "..nHandle.." )" )
|
|
|
|
|
|
|
|
|
|
PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> üũ
|
|
|
|
|
if IsPetMasterMoved( PetMem ) == true
|
|
|
|
|
then
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>̵<EFBFBD>
|
|
|
|
|
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<EFBFBD>ʵ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> : 20%<EFBFBD><EFBFBD> 1<EFBFBD>ʿ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ӵ<EFBFBD><EFBFBD><EFBFBD>.. 0<EFBFBD><EFBFBD>, 10<EFBFBD><EFBFBD>, 20<EFBFBD><EFBFBD>, 30<EFBFBD><EFBFBD>, 40<EFBFBD><EFBFBD>, ... , 350<EFBFBD><EFBFBD>, 0<EFBFBD><EFBFBD>... <EFBFBD>ݺ<EFBFBD>
|
|
|
|
|
if PetMem["PetInfo"]["Time"]["EnterIdleAction"] == PetMem["InitialSec"]
|
|
|
|
|
then
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
PetMem["PetInfo"]["Time"]["EnterIdleAction"] = PetMem["CurSec"]
|
|
|
|
|
PetMem["PetInfo"]["nIdleStep"] = 1
|
|
|
|
|
PetMem["PetInfo"]["nIdleEndStep"] = 2 + #PetSystem_tIdleActionData["tData"]["tRotation"]
|
|
|
|
|
|
|
|
|
|
-- ȸ<EFBFBD><EFBFBD> <EFBFBD>߽<EFBFBD> <EFBFBD><EFBFBD>ǥ <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
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 <EFBFBD>ӽ<EFBFBD> <EFBFBD>α<EFBFBD>
|
|
|
|
|
DebugLog( "PetBaseIdleAction::PIAM_ROTATION::nIdleStep = "..PetMem["PetInfo"]["nIdleStep"] )
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
-- <EFBFBD>ܰ躰 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if PetMem["PetInfo"]["nIdleStep"] == 1
|
|
|
|
|
then
|
|
|
|
|
-- ù <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
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
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 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"] <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD>̹Ƿ<EFBFBD> <EFBFBD>ƹ<EFBFBD><EFBFBD>͵<EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD> <EFBFBD>ڷ<EFBFBD> <EFBFBD>ѱ<EFBFBD>
|
|
|
|
|
end
|
|
|
|
|
-- <EFBFBD>ܰ躰 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD>ð<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> üũ
|
|
|
|
|
if PetMem["PetInfo"]["Time"]["EnterIdleAction"] + PetSystem_nSecStayAtIdleRotation <= PetMem["CurSec"]
|
|
|
|
|
then
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <EFBFBD>ð<EFBFBD>
|
|
|
|
|
DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_ROTATION:CANCEL by Time - nHandle( "..nHandle.." )" )
|
|
|
|
|
|
|
|
|
|
PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> üũ
|
|
|
|
|
if IsPetMasterMoved( PetMem ) == true
|
|
|
|
|
then
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>̵<EFBFBD>
|
|
|
|
|
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
|
|
|
|
|
-- <EFBFBD>׳<EFBFBD> ó<EFBFBD><EFBFBD>
|
|
|
|
|
-- 1ȸ : <EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ϰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ʱ<EFBFBD>ȭ
|
|
|
|
|
-- <EFBFBD>ֺ<EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ٰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ϱ<EFBFBD> : 200<EFBFBD>Ÿ<EFBFBD> <EFBFBD>̳<EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD>꿡<EFBFBD><EFBFBD> 30<EFBFBD>Ÿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȯ <EFBFBD><EFBFBD> <EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD>ϱ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ΰ<EFBFBD> 300<EFBFBD>̻<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>
|
|
|
|
|
if PetMem["PetInfo"]["Time"]["EnterIdleAction"] == PetMem["InitialSec"]
|
|
|
|
|
then
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
PetMem["PetInfo"]["Time"]["EnterIdleAction"] = PetMem["CurSec"]
|
|
|
|
|
PetMem["PetInfo"]["nIdleStep"] = 1
|
|
|
|
|
PetMem["PetInfo"]["nIdleEndStep"] = 5
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD>ֺ<EFBFBD> <EFBFBD><EFBFBD> Ž<EFBFBD><EFBFBD>
|
|
|
|
|
local nTargetPetHandle = -1
|
|
|
|
|
local tHandleList = { cNearObjectList( nHandle, PetSystem_nDistanceIdleTalkPetSelectMax, ObjectType["Pet"] ) }
|
|
|
|
|
if #tHandleList > 0
|
|
|
|
|
then
|
|
|
|
|
nTargetPetHandle = tHandleList[ cRandomInt( 1, #tHandleList ) ]
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD>ֺ<EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>꿡<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>
|
|
|
|
|
for i, nCurPetHandle in pairs( tHandleList )
|
|
|
|
|
do
|
|
|
|
|
-- <EFBFBD><EFBFBD> <EFBFBD>꿡<EFBFBD>ٰ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ε<EFBFBD> <EFBFBD><EFBFBD>ȭ <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if nCurPetHandle ~= nHandle
|
|
|
|
|
then
|
|
|
|
|
cPet_ChangeMind( nCurPetHandle, "talk" );
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ġ Ž<EFBFBD><EFBFBD>
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD>ش<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ȿ<EFBFBD>ϸ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if PetMem["TargetInfo"]["nHandle"] >= 0
|
|
|
|
|
then
|
|
|
|
|
|
|
|
|
|
-- RubyFruit 2013.11.23 <EFBFBD>ӽ<EFBFBD> <EFBFBD>α<EFBFBD>
|
|
|
|
|
DebugLog( "PetBaseIdleAction::PIAM_TALK::nIdleStep = "..PetMem["PetInfo"]["nIdleStep"] )
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
-- <EFBFBD>ܰ躰 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if PetMem["PetInfo"]["nIdleStep"] == 1
|
|
|
|
|
then
|
|
|
|
|
-- ù <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
-- ó<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
local nDistanceSquare = cDistanceSquar( nHandle, PetMem["TargetInfo"]["nHandle"] )
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
---------- //<EFBFBD>Ÿ<EFBFBD><EFBFBD><EFBFBD> Pattern Decision ---------------------------------
|
|
|
|
|
if nDistanceSquare > PS_nDS_IdleTalkPetStart
|
|
|
|
|
then
|
|
|
|
|
-- <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
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
|
|
|
|
|
---------- <EFBFBD>Ÿ<EFBFBD><EFBFBD><EFBFBD> Pattern Decision// ---------------------------------
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
PetMem["PetInfo"]["nIdleStep"] = 2
|
|
|
|
|
|
|
|
|
|
elseif PetMem["PetInfo"]["nIdleStep"] == 2
|
|
|
|
|
then
|
|
|
|
|
-- <EFBFBD>ι<EFBFBD>° <EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϳ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD>Ÿ<EFBFBD><EFBFBD><EFBFBD> üũ<EFBFBD>ϸ<EFBFBD> <EFBFBD>ٸ<EFBFBD><EFBFBD>꿡<EFBFBD><EFBFBD> <EFBFBD>ٰ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
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 )
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
---------- //<EFBFBD>Ÿ<EFBFBD><EFBFBD><EFBFBD> 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
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϳ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD>Ÿ<EFBFBD>
|
|
|
|
|
DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_TALK:CANCEL by Distance from Master - nHandle( "..nHandle.." )" )
|
|
|
|
|
|
|
|
|
|
PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"]
|
|
|
|
|
end
|
|
|
|
|
---------- <EFBFBD>Ÿ<EFBFBD><EFBFBD><EFBFBD> Pattern Decision// ---------------------------------
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
elseif PetMem["PetInfo"]["nIdleStep"] == 3
|
|
|
|
|
then
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ȯ
|
|
|
|
|
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
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD>ϱ<EFBFBD>
|
|
|
|
|
|
|
|
|
|
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"] <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD>̹Ƿ<EFBFBD> <EFBFBD>ƹ<EFBFBD><EFBFBD>͵<EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD> <EFBFBD>ڷ<EFBFBD> <EFBFBD>ѱ<EFBFBD>
|
|
|
|
|
end
|
|
|
|
|
-- <EFBFBD>ܰ躰 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ȿ - <EFBFBD>ൿ <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
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
|
|
|
|
|
-- <EFBFBD>׳<EFBFBD> ó<EFBFBD><EFBFBD>
|
|
|
|
|
-- 10<EFBFBD>ʰ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô
|
|
|
|
|
if PetMem["PetInfo"]["Time"]["EnterIdleAction"] == PetMem["InitialSec"]
|
|
|
|
|
then
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
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 <EFBFBD>ӽ<EFBFBD> <EFBFBD>α<EFBFBD>
|
|
|
|
|
DebugLog( "PetBaseIdleAction::PIAM_DIE::nIdleStep = "..PetMem["PetInfo"]["nIdleStep"] )
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
-- <EFBFBD>ܰ躰 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if PetMem["PetInfo"]["nIdleStep"] == 1
|
|
|
|
|
then
|
|
|
|
|
-- ù <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
-- <EFBFBD>ִϸ<EFBFBD><EFBFBD>̼<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ٸ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؾ<EFBFBD><EFBFBD>ϴ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>־ <EFBFBD>̺<EFBFBD>Ʈ <EFBFBD>ڵ带 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϱ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>
|
|
|
|
|
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"] <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD>̹Ƿ<EFBFBD> <EFBFBD>ƹ<EFBFBD><EFBFBD>͵<EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD> <EFBFBD>ڷ<EFBFBD> <EFBFBD>ѱ<EFBFBD>
|
|
|
|
|
end
|
|
|
|
|
-- <EFBFBD>ܰ躰 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD>ð<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> üũ
|
|
|
|
|
if PetMem["PetInfo"]["Time"]["EnterIdleAction"] + PetSystem_nSecStayAtIdleDie <= PetMem["CurSec"]
|
|
|
|
|
then
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <EFBFBD>ð<EFBFBD>
|
|
|
|
|
DebugLog( "PetBaseIdleAction::PET_IDLE_ACTION_MODE-PIAM_DIE:CANCEL by Time - nHandle( "..nHandle.." )" )
|
|
|
|
|
|
|
|
|
|
PetMem["PetInfo"]["nIdleStep"] = PetMem["PetInfo"]["nIdleEndStep"]
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ִ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Idle<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
cActByEventCode( nHandle, PetSystem_ActionEventCode["Idle"] )
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
-- logic error
|
|
|
|
|
ErrorLog( "PetBaseIdleAction::nIdleActionMode is invalid - logic error" )
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> ó<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ʱ<EFBFBD>ȭ : <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Idle <EFBFBD>ൿ<EFBFBD><EFBFBD> <EFBFBD>ߴٰ<EFBFBD> <EFBFBD>ϴ<EFBFBD> <EFBFBD>ð<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>̶<EFBFBD> <EFBFBD>ѹ<EFBFBD> <EFBFBD><EFBFBD> <EFBFBD>Ѵ<EFBFBD>.(<EFBFBD>ٸ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ϴ<EFBFBD> <EFBFBD>Ͱ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ѹ<EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD> <EFBFBD><EFBFBD>)
|
|
|
|
|
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
|