Sqr/character/atmage/icecrash/ap_icecrash.nut

128 lines
2.9 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

function sq_AddFunctionName(appendage)
{
appendage.sq_AddFunctionName("proc", "proc_appendage_IceCrash")
appendage.sq_AddFunctionName("onStart", "onStart_appendage_IceCrash")
appendage.sq_AddFunctionName("onEnd", "onEnd_appendage_IceCrash")
}
function sq_AddEffect(appendage)
{
}
function proc_appendage_IceCrash(appendage)
{
if(!appendage) {
return;
}
local parentObj = appendage.getParent();
local sourceObj = appendage.getSource();
if(!sourceObj || !parentObj) {
appendage.setValid(false);
return;
}
local x = sq_GetDistancePos(sourceObj.getXPos(), sourceObj.getDirection(), 155);
local t = sq_GetShuttleValue(0, 10,sq_GetObjectTime(parentObj),50)-5;
x = x + (t >= 0 ? 3 : -3);
local z = sourceObj.getZPos() + 50 - parentObj.getObjectHeight()/2;
if(z < 0)
z = 0;
sq_SetCurrentPos(parentObj, x, sourceObj.getYPos()-1,z);
}
function onStart_appendage_IceCrash(appendage)
{
if(!appendage) {
return;
}
local parentObj = appendage.getParent();
local sourceObj = appendage.getSource();
if(!sourceObj || !parentObj) {
appendage.setValid(false);
return;
}
}
function onEnd_appendage_IceCrash(appendage)
{
if(!appendage) {
return;
}
local obj = appendage.getParent();
local sourceObj = appendage.getSource();
if(obj && sq_IsMyControlObject(obj) ) {
local xPos = obj.getXPos();
local yPos = obj.getYPos();
// 霜摹鼻 桧翕 陛栋? 谢?蒂 琼朝棻
if (moveDamagerLinerMovablepos(obj, sourceObj.getDirection(), 50) == false)
{
// 霜摹鼻 陛栋? 谢?蒂 跤琼擎 唳办 卫瞪濠暧 嫔纂陛 姜鼻瞳樯 唳办 卫瞪濠暧 嫔纂煎 桧翕
if (obj.isMovablePos(sourceObj.getXPos(), sourceObj.getYPos()) == true)
{
sq_SetCurrentPos(obj, sourceObj.getXPos(), sourceObj.getYPos(), obj.getZPos());
}
// 卫瞪濠暧 嫔纂紫 桧鼻? 唳办 舆渗暧 瞳渡? 嫔纂 摹姜
else
{
sq_SimpleMoveToNearMovablePos(obj,200);
}
}
}
}
function moveDamagerLinerMovablepos(damager, dir, movableRange)
{
local xPos = damager.getXPos();
local yPos = damager.getYPos();
local toXPos = xPos
if (dir == ENUM_DIRECTION_LEFT)
{
toXPos = xPos - movableRange;
}
else
{
toXPos = xPos + movableRange;
}
toXPos = damager.sq_findNearLinearMovableXPos(xPos, yPos, toXPos, yPos, 10);
if (damager.isMovablePos(toXPos, yPos) == true)
{
sq_SetCurrentPos(damager, toXPos, yPos, damager.getZPos());
return true;
}
else
{
if (dir == ENUM_DIRECTION_LEFT)
{
toXPos = xPos + movableRange;
}
else
{
toXPos = xPos - movableRange;
}
toXPos = damager.sq_findNearLinearMovableXPos(xPos, yPos, toXPos, yPos, 10);
if (damager.isMovablePos(toXPos, yPos) == true)
{
sq_SetCurrentPos(damager, toXPos, yPos, damager.getZPos());
return true;
}
}
return false;
}