二觉红狗

//血魔·弒天
 
function checkExecutableSkill_bloodrivern(obj)
{
    if (!obj) return false;
 
    local isUseSkill = obj.sq_IsUseSkill(SKILL_BLOODRIVERN);
    if (isUseSkill) 
    {
        obj.getVar("size").clear_vector();
        obj.getVar("size").push_vector(100);
        //初始化大小
        obj.getVar("state").clear_vector();
        obj.getVar("state").push_vector(0);
        obj.sq_IsEnterSkillLastKeyUnits(SKILL_BLOODRIVERN);
        obj.sq_AddSetStatePacket(STATE_BLOODRIVERN, STATE_PRIORITY_USER, true);
        return true;
    }
    return false;
}
 
 
function checkCommandEnable_bloodrivern(obj)
{
 
    return true;
}
 
 
 
 
function onSetState_BLOODRIVERN(obj, state, datas, isResetTimer)
{
    local state = obj.getVar("state").get_vector(0);
    local size = obj.getVar("size").get_vector(0);
 
    obj.sq_StopMove();
    if (state == 0)
    {
        //鮮血包裹準備
        obj.sq_SetCurrentAnimation(CUSTOM_ANI_BLOODRIVERN_CASTING);
 
    }else if (state == 1)
    {
        //大球不斷旋轉
        obj.sq_SetCurrentAnimation(CUSTOM_ANI_BLOODRIVERN_GROUND);
        obj.sq_SetCurrentAttackInfo(ATTACKINFO_BLOODRIVERN_MUSHATTACK);
        obj.resetHitObjectList();
 
        local attT = obj.sq_GetIntData(SKILL_BLOODRIVERN, 0);
        //150
        local maxS = obj.sq_GetIntData(SKILL_BLOODRIVERN, 2);
        //蓄力最大的大小 size 200
        obj.getVar("mSize").clear_vector();
        obj.getVar("mSize").push_vector(maxS);
 
        obj.setTimeEvent(0,attT,0,false);       
 
        local attackBonusRate = obj.sq_GetBonusRateWithPassive(SKILL_BLOODRIVERN, STATE_BLOODRIVERN, 0, 1.0);
        obj.sq_SetCurrentAttackBonusRate(attackBonusRate);              
 
    }else if (state == 2)
    {
        //變成一條大狗
        obj.sq_SetCurrentAnimation(CUSTOM_ANI_BLOODRIVERN_READYOUT);
        sq_SetMyShake(obj,3,200);
 
        obj.sq_SetCurrentAttackInfo(ATTACKINFO_BLOODRIVERN_MUSHATTACK);
 
        local attackBonusRate = obj.sq_GetBonusRateWithPassive(SKILL_BLOODRIVERN, STATE_BLOODRIVERN, 0, 1.0);
        obj.sq_SetCurrentAttackBonusRate(attackBonusRate);              
 
        local level = sq_GetSkillLevel(obj, SKILL_BLOODRIVERN);     
        local xy_proc = sq_GetLevelData(obj, SKILL_BLOODRIVERN, 3, level);
        local xy_level = sq_GetLevelData(obj, SKILL_BLOODRIVERN, 4, level);
        local xy_time = sq_GetLevelData(obj,SKILL_BLOODRIVERN, 5, level);
        //眩暈參數
        local attackInfo = sq_GetCurrentAttackInfo(obj);
        sq_SetChangeStatusIntoAttackInfo(attackInfo, 0, ACTIVESTATUS_STUN, xy_proc, xy_level, xy_time );
        //震動
    }else if (state == 3)
    {
        //跳躍
        obj.sq_SetCurrentAnimation(CUSTOM_ANI_BLOODRIVERN_JUMP);
        obj.sq_SetCurrentAttackInfo(ATTACKINFO_BLOODRIVERN_JUMPATTACK);
 
        local len = obj.sq_GetIntData(SKILL_BLOODRIVERN, 3);
        //獲得前進距離 len = 300
//        len = ( len * obj.getVar("size").get_vector(0) ) / 100 ;
        //根據大小提升前進距離
        local ani = obj.sq_GetCurrentAni();
        local delay = ani.getDelaySum(false);
 
        obj.getVar("len").clear_vector();
        obj.getVar("len").push_vector(len);//0
        obj.getVar("len").push_vector(delay);//1
        obj.getVar("len").push_vector(obj.getXPos() );//2
 
        local attT = obj.sq_GetIntData(SKILL_BLOODRIVERN, 4);
        //攻擊間隔 150毫秒
        obj.setTimeEvent(0,attT,0,false);       
 
        local attackBonusRate = obj.sq_GetBonusRateWithPassive(SKILL_BLOODRIVERN, STATE_BLOODRIVERN, 1, 1.0);
        obj.sq_SetCurrentAttackBonusRate(attackBonusRate);              
        obj.sq_SetStaticSpeedInfo(SPEED_TYPE_ATTACK_SPEED, SPEED_TYPE_ATTACK_SPEED,
            SPEED_VALUE_DEFAULT, SPEED_VALUE_DEFAULT, 1.0, 1.0);
    }else if (state == 4)
    {
        //砸地 && 蹲下
        sq_SetMyShake(obj,8,500);
        sq_flashScreen(obj,100,2000,1000,150, sq_RGB(0,0,0), GRAPHICEFFECT_NONE, ENUM_DRAWLAYER_BOTTOM);
        //震動和閃屏
        local attackBonusRate = obj.sq_GetBonusRateWithPassive(SKILL_BLOODRIVERN, STATE_BLOODRIVERN, 2, 1.0 + (obj.getVar("size").get_vector(0) /100.0).tofloat() );
        //攻擊隨著大小的提升而提升
        obj.sq_StartWrite();
        obj.sq_WriteDword(attackBonusRate); // attackBonusRate
        obj.sq_WriteDword(61);  // attackBonusRate
        obj.sq_WriteDword(obj.getVar("size").get_vector(0) );   // attackBonusRate
        obj.sq_SendCreatePassiveObjectPacket(24357, 0, obj.sq_GetIntData(SKILL_BLOODRIVERN, 5), 1, 0);
 
        obj.getVar("size").clear_vector();
        obj.getVar("size").push_vector(100);
        //初始化大小100
        obj.sq_SetCurrentAnimation(CUSTOM_ANI_BLOODRIVERN_FINISH);
    }
    obj.sq_SetStaticSpeedInfo(SPEED_TYPE_ATTACK_SPEED, SPEED_TYPE_ATTACK_SPEED,
        SPEED_VALUE_DEFAULT, SPEED_VALUE_DEFAULT, 1.0, 1.0);
    if (state < 4)
    {
        //如果是砸地 && 蹲下狀態下不改變大小
        local currentAni = sq_GetCurrentAnimation(obj);
        local sizeRate = size.tofloat()/100.0;
        currentAni.setImageRateFromOriginal(sizeRate, sizeRate);
        currentAni.setAutoLayerWorkAnimationAddSizeRate(sizeRate);
        sq_SetAttackBoundingBoxSizeRate(currentAni, sizeRate, sizeRate, sizeRate);
    }
}
 
 
function onTimeEvent_BLOODRIVERN(obj, timeEventIndex, timeEventCount)
{
    local state = obj.getVar("state").get_vector(0);
    if (state == 1 || state == 3)
    {
        if (timeEventIndex == 0)
        {
            obj.resetHitObjectList();
        }
    }
}
function onProc_BLOODRIVERN(obj)
{
 
    local state = obj.getVar("state").get_vector(0);
    local pAni = obj.sq_GetCurrentAni();
    local currentT = sq_GetCurrentTime(pAni);
 
    if (state == 1 || state == 2)
    {
 
    }else if (state == 3)
    {//跳躍,根據len進行位移
 
 
        local posX = obj.getVar("len").get_vector(2);
        local delayT = obj.getVar("len").get_vector(1);
        local len = obj.getVar("len").get_vector(0);
 
 
        local v = sq_GetAccel(0, len, currentT, delayT, true);
        local srcX = posX;
         
        local dstX = sq_GetDistancePos(srcX, obj.getDirection(), v);
          
        if(obj.isMovablePos(dstX, obj.getYPos() ))
        {
            sq_setCurrentAxisPos(obj, 0, dstX);
        }
        //進行位移
    }
}
 
function onEndCurrentAni_BLOODRIVERN(obj)
{
    local state = obj.getVar("state").get_vector(0);
    if (state == 0)
    {
        obj.getVar("state").clear_vector();
        obj.getVar("state").push_vector(1);
        obj.sq_AddSetStatePacket(STATE_BLOODRIVERN, STATE_PRIORITY_USER, true);
    }else if (state == 1)
    {
        local maxSize = obj.getVar("mSize").get_vector(0);
        if( !obj.isDownSkillLastKey() || obj.getVar("size").get_vector(0) > maxSize)
        {//如果我沒有按下技能鍵或者我的大小已經超過了最大值了就化身大狗,反之提升大小
          
            obj.getVar("state").clear_vector();
            obj.getVar("state").push_vector(2);
            obj.sq_AddSetStatePacket(STATE_BLOODRIVERN, STATE_PRIORITY_USER, true);
        }else{
            local currSize = obj.getVar("size").get_vector(0);
            obj.getVar("size").set_vector(0,currSize + obj.sq_GetIntData(SKILL_BLOODRIVERN, 1) );
 
            obj.getVar("state").clear_vector();
            obj.getVar("state").push_vector(1);
            obj.sq_AddSetStatePacket(STATE_BLOODRIVERN, STATE_PRIORITY_USER, true);
        }
    }else if (state == 2)
    {
        obj.getVar("state").clear_vector();
        obj.getVar("state").push_vector(3);
        obj.sq_AddSetStatePacket(STATE_BLOODRIVERN, STATE_PRIORITY_USER, true);
    }else if (state == 3)
    {
        obj.getVar("state").clear_vector();
        obj.getVar("state").push_vector(4);
        obj.sq_AddSetStatePacket(STATE_BLOODRIVERN, STATE_PRIORITY_USER, true);
    }else if (state == 4)
    {
 
        obj.sq_AddSetStatePacket(STATE_STAND, STATE_PRIORITY_USER, false);
    }
        obj.sq_SetCurrentAnimation(CUSTOM_ANI_EMPERORCOMBINATIONBODY_01);
        obj.sq_SetCurrentAttackInfo(ATTACKINFO_EMPERORCOMBINATIONATTACK1);
        obj.sq_SetCurrentAnimation(CUSTOM_ANI_EMPERORCOMBINATIONBODY_02);
        obj.sq_SetCurrentAttackInfo(ATTACKINFO_EMPERORCOMBINATIONATTACK2);
        obj.sq_SetCurrentAnimation(CUSTOM_ANI_EMPERORCOMBINATIONBODY_03);
        obj.sq_SetCurrentAttackInfo(ATTACKINFO_EMPERORCOMBINATIONATTACK3);
        obj.sq_SetCurrentAttackInfo(ATTACKINFO_EMPERORCOMBINATIONSTUNATTACK);
}
© 版权声明
THE END
喜欢就支持一下吧
点赞2 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容