Beispiel #1
0
    public override int     OnHit(sdActorInterface _gameActor, List <sdActorInterface> lstMonster, int iHitPointIndex, object userdata, HeaderProto.ESkillEffect skilleffect)
    {
        int nRet = 0;

        if (lstMonster.Count == 0)
        {
            return(nRet);
        }
        List <Bubble.BubbleType> lstBubbleType = new List <Bubble.BubbleType>();

        if (bCalcDamage)
        {
            sdTuiTuLogic tuiTuLogic = sdGameLevel.instance.battleSystem.tuiTuLogic;
            bool         bMaincChar = (_gameActor == sdGameLevel.instance.mainChar);
            lstMonster.ForEach(delegate(sdActorInterface monster)
            {
                CallStateEvent(eStateEventType.eSET_hit);

                sdBattleSystem bs = sdGameLevel.instance.battleSystem;
                DamageResult dr   = bs.testHurt(
                    _gameActor,
                    stateData,
                    monster,
                    iHitPointIndex,
                    skilleffect
                    );

                //播放命中特效.闪避buff的不播放命中特效aaa
                if (dr.damage > 0)
                {
                    PlayHitEffect(monster);
                }
                lstBubbleType.Add(dr.bubbleType);
                if (Bubble.IsHurtOther(dr.bubbleType))
                {
                    nRet++;
                }
            });
        }
        AddSkillEffect(_gameActor, lstMonster, lstBubbleType, skillEffect, null, ((int)stateData["ParentID"]) / 100);
        return(nRet);
    }
Beispiel #2
0
    // @describe 统一的攻击判定aa
    public override int DoSDAttack(sdActorInterface kAttacker,
                                   Hashtable kSkillInfo,
                                   int iStrikeType,
                                   Vector3 kStrikeCenter,
                                   float fStrikeDistance,
                                   int iStrikeAngle,
                                   int iHitPointIndex,
                                   sdAttackCB kCallback)
    {
        int nRet = 0;

        if (tuiTuLogic == null)
        {
            return(nRet);
        }

        if (gameLevel == null)
        {
            return(nRet);
        }

        if (kAttacker == null)
        {
            return(nRet);
        }

        if (kSkillInfo == null)
        {
            return(nRet);
        }

        HeaderProto.ESkillObjType objType     = (HeaderProto.ESkillObjType)kSkillInfo["byTargetType"];
        List <sdActorInterface>   kTargetList = gameLevel.actorMgr.FindActor(
            kAttacker,
            objType,
            kStrikeCenter,
            kAttacker.GetDirection(),
            iStrikeType,
            iStrikeAngle,
            fStrikeDistance,
            true);

        if (kTargetList == null)
        {
            return(nRet);
        }

        // AOE技能最大攻击目标aa
        if (kSkillInfo.ContainsKey("wAoeAimNum"))
        {
            int nMaxTarget = (int)kSkillInfo["wAoeAimNum"];
            if (kTargetList.Count > nMaxTarget)
            {
                kTargetList.RemoveRange(nMaxTarget, kTargetList.Count - nMaxTarget);
            }
        }

        // 技能特效aa
        HeaderProto.ESkillEffect skilleffect = HeaderProto.ESkillEffect.SKILL_EFFECT_DAMAGE_HP;
        if (kSkillInfo.ContainsKey("bySkillEffect"))
        {
            skilleffect = (HeaderProto.ESkillEffect)(kSkillInfo["bySkillEffect"]);
        }

        // 判定伤害aa
        if (kCallback != null)
        {
            return(kCallback.OnHit(kAttacker, kTargetList, iHitPointIndex, null, skilleffect));
        }
        else
        {
            sdBattleSystem kBattleSystem = sdGameLevel.instance.battleSystem;
            kTargetList.ForEach(delegate(sdActorInterface kActor)
            {
                DamageResult dr = kBattleSystem.testHurt(
                    kAttacker,
                    kSkillInfo,
                    kActor,
                    iHitPointIndex,
                    skilleffect
                    );
                if (Bubble.IsHurtOther(dr.bubbleType))
                {
                    ++nRet;
                }
            });
            return(nRet);
        }
    }
    public override int     OnHit(sdActorInterface _gameActor, List <sdActorInterface> lstMonster, int iHitPointIndex, object userdata, HeaderProto.ESkillEffect skilleffect)
    {
        int nRet = 0;

        if (lstMonster.Count == 0)
        {
            sdGameActor ga = (sdGameActor)_gameActor;
            //如果没有怪物,停止闪电连...
            if (ga.logicTSM.nextState == null)
            {
                ga.logicTSM.nextState = ga.logicTSM.GetCurrentPassiveState();
            }
            if (control != null)
            {
                control.SetPositionArray(null);
            }
            return(nRet);
        }
        List <sdActorInterface> lstMonserHit = new List <sdActorInterface>();


        Vector3          vPos        = _gameActor.transform.position;
        sdActorInterface tempMonster = GetNearestMonster(lstMonserHit, vPos, lstMonster);

        lstMonserHit.Add(tempMonster);

        Vector3 v = lstMonserHit[0].transform.position - _gameActor.transform.position;

        v.y = 0.0f;
        v.Normalize();
        ((sdMainChar)_gameActor).spinToTargetDirection(v, true);

        int Count = 1;

        for (int i = 1; i < iMaxMonster; i++)
        {
            tempMonster = GetNearestMonster(lstMonserHit, vPos, lstMonster);
            if (tempMonster != null)
            {
                lstMonserHit.Add(tempMonster);
                Count++;
            }
        }


        GameObject[] vMonsterPos = new GameObject[Count];
        for (int i = 0; i < Count; i++)
        {
            sdActorInterface monster = lstMonserHit[i];
            vMonsterPos[i] = monster.gameObject;
        }
        if (control != null)
        {
            control.SetPositionArray(vMonsterPos);
        }
        //base.OnHit(_gameActor,lstMonserHit,iHitPointIndex,userdata);
        sdTuiTuLogic             tuiTuLogic    = sdGameLevel.instance.battleSystem.tuiTuLogic;
        List <Bubble.BubbleType> lstBubbleType = new List <Bubble.BubbleType>();

        for (int i = 0; i < lstMonserHit.Count; i++)
        {
            sdActorInterface monster = lstMonserHit[i];

            CallStateEvent(eStateEventType.eSET_hit);

            sdBattleSystem bs = sdGameLevel.instance.battleSystem;
            DamageResult   dr = bs.testHurt(
                _gameActor,
                stateData,
                monster,
                i,
                skilleffect
                );
            //播放命中特效.
            if (dr.damage > 0)
            {
                PlayHitEffect(monster);
            }
            lstBubbleType.Add(dr.bubbleType);
            if (Bubble.IsHurtOther(dr.bubbleType))
            {
                nRet++;
            }
        }
        AddSkillEffect(_gameActor, lstMonserHit, lstBubbleType, skillEffect, null, ((int)stateData["ParentID"]) / 100);
        return(nRet);
    }