Beispiel #1
0
        //技能命中,获取被击的信息,发给被击对象做表现
        public void OnBuffDamage(DamageParam damageParam, float phyAttackPercent, float magicAttackPercent, float addedValue, sbyte skillAttrib)
        {
            //攻击者的信息
            ActorObj attackActorObj = damageParam.attackActor;
            ActorObj behitActorObj  = damageParam.behitActor;

            if (behitActorObj.IsDeath())
            {
                return;
            }

            //LuaTable attackSkillDesc = attackActorObj.GetCurSkillDesc(damageParam.skillID);

            BehitParam behitParam = new BehitParam();

            behitParam.displayType = DamageDisplayType.DDT_NORMAL;

            float critRate = 0;

            if (critRate < 0)
            {
                critRate = 0;
            }
            critRate = Math.Min(critRate, 1.0f);

            if (UnityEngine.Random.value < critRate)  //暴击
            {
                behitParam.displayType = DamageDisplayType.DDT_DOUBLE;
            }

            int finalDmg = 0;

            //string strPhydmg = "";

            behitParam.hp = finalDmg;


#if !PUBLISH_RELEASE
            if (m_bMiaoGuai)
            {
                if (attackActorObj.mActorType == ActorType.AT_LOCAL_PLAYER)
                {
                    behitParam.hp += 1000000;
                }
            }
#endif

            //被击效果修正
            behitParam.damgageInfo = damageParam;
            behitParam.displayType = DamageDisplayType.DDT_BUFF;

            //给技能释放者发送回复信息



            // 发送被击消息给被击者
            behitActorObj.OnSkillBeHit(behitParam);
        }
Beispiel #2
0
        //触发器
        public override void OnTriggerEnter(Collider other)
        {
            if (other.transform != m_aimTransform)
            {
                return;
            }

            bool bIsMonster = false;

            ActorObj actorBase = other.transform.root.gameObject.GetComponent <ActorObj>();

            if (actorBase == null)
            {
                actorBase  = other.transform.gameObject.GetComponent <ActorObj>();
                bIsMonster = true;
            }

            //纠正被击表现
            DamageParam damageParam = new DamageParam();

            damageParam.skillID     = m_param.skillID;
            damageParam.attackActor = m_param.castObj.GetComponent <ActorObj>();

            if (bIsMonster)
            {
                damageParam.behitActor = actorBase;
            }
            else
            {
                damageParam.behitActor = actorBase;
            }

            CoreEntry.gSkillMgr.OnSkillDamage(damageParam);

            //是否有眩晕效果
            //if (m_param.dizzyTime != 0)
            //{
            //    DizzyParam param = new DizzyParam();
            //    param.keepTime = m_param.dizzyTime;

            //    actorBase.OnEnterDizzy(param);
            //}

            if (objEfx != null)
            {
                objEfx.SetActive(false);
            }

            Invoke("NextAim", 0f);
        }
Beispiel #3
0
        private void OnObjectDead(GameEvent ge, EventParameter parameter)
        {
            MsgData_sObjDeadInfo msg = parameter.msgParameter as MsgData_sObjDeadInfo;
            if (null == msg)
                return;

 
//             for (int i = 0; i < mSceneCache.Count; i++)
//             {
//                 if (mSceneCache[i].ObjGuid == msg.ID)
//                 {
//                     mSceneCache.RemoveAt(i);
//                     Debug.LogError("---------------------------------killid ___ 2:" + msg.KillerID + " bkill:" + msg.ID);
//                     return;
//                 }
//             }

            if (mObjRecord.ContainsKey(msg.ID))
            {
                mObjRecord.Remove(msg.ID);
            }

            ActorObj behitActor = CoreEntry.gActorMgr.GetActorByServerID(msg.ID);
            if (null == behitActor)
            {
                if (!mDeathCache.Contains(msg))
                {
                    mDeathCache.Add(msg);
                }
                //Debug.LogError("---------------------------------怪物死亡 1:" + msg.ID + " monst count:" + mObjRecord.Count);

                return;
            }
            //Debug.LogError("---------------------------------怪物死亡 2  :" + msg.ID + " monst count:" + mObjRecord.Count);
            ActorObj attackActor = CoreEntry.gActorMgr.GetActorByServerID(msg.KillerID);

            BehitParam behitParam = new BehitParam();
            DamageParam damageParam = new DamageParam();
            damageParam.attackActor = attackActor;
            damageParam.behitActor = behitActor;
            damageParam.skillID = msg.KillerSkillID;

            behitParam.damgageInfo = damageParam;
            behitActor.OnDead(msg.KillerSkillID, attackActor, behitParam, EventParameter.Get());
        }
Beispiel #4
0
        void SetTakeAwayTarget(DamageParam damageParam, bool bIsMonster)
        {
            if (bIsMonster)
            {
                if (damageParam.behitActor != null)
                {
                    ActorObj actor = damageParam.behitActor;
                    if (actor != null && actor.IsDeath() == false && actor.IsGod == false && actor.CanKnock == 0)
                    {
                        //只能被带走一次
                        if (actor.BeTakenAway == false)
                        {
                            if (!m_TakeAwayGameObjectMap.ContainsKey(actor.entityid))
                            {
                                m_TakeAwayGameObjectMap.Add(actor.entityid, damageParam.behitActor.gameObject);
                                actor.CanotCurveMove();

                                actor.BeTakenAway      = true;
                                actor.BeTakenAwayOwner = gameObject;

                                //带走的时候是否不能动
                                if (m_param.bCanNotMoveWhenTakenAway)
                                {
                                    actor.IgnoredGravityMotion = true;

                                    //需要打断技能
                                    StateParameter stateParm = new StateParameter();
                                    stateParm.state       = ACTOR_STATE.AS_BEHIT;
                                    stateParm.AttackActor = actor;

                                    actor.m_AttackState.BreakSkill(stateParm);

                                    //能否切换到被击状态
                                    actor.RequestChangeState(stateParm);

                                    actor.StopAll();
                                    actor.PlayAction("hit011", false);
                                }
                            }
                        }
                    }
                }
            }
        }
Beispiel #5
0
        IEnumerator DoDead(MsgData_sObjDeadInfo msg)
        {
            yield return new WaitForSeconds(0.3f);

            ActorObj behitActor = CoreEntry.gActorMgr.GetActorByServerID(msg.ID);
            if (null == behitActor)
                yield break;

            ActorObj attackActor = CoreEntry.gActorMgr.GetActorByServerID(msg.KillerID);

            BehitParam behitParam = new BehitParam();
            DamageParam damageParam = new DamageParam();
            damageParam.attackActor = attackActor;
            damageParam.behitActor = behitActor;
            damageParam.skillID = msg.KillerSkillID;

            behitParam.damgageInfo = damageParam;
            behitActor.OnDead(msg.KillerSkillID, attackActor, behitParam, EventParameter.Get());
        }
Beispiel #6
0
        public void CalculateDamage(GameObject obj)
        {
            bool     isDamageSuccess = true;
            ActorObj actorBase       = (obj.GetComponent <ActorObj>());

            //纠正被击表现
            DamageParam damageParam = new DamageParam();

            damageParam.skillID           = m_skillBase.m_skillID;
            damageParam.attackActor       = m_skillBase.m_actor;
            damageParam.behitActor        = actorBase;
            damageParam.weight            = m_oneDamageInfo.resetSkillWeight;
            damageParam.isNotUseCurveMove = m_oneDamageInfo.isNotUseCurveMove;

            CoreEntry.gSkillMgr.OnSkillDamage(damageParam);

            //是否有眩晕效果
            if (m_oneDamageInfo.dizzyParamDesc != null)
            {
                DizzyParam param = new DizzyParam();
                param.keepTime = m_oneDamageInfo.dizzyParamDesc.keepTime;

                actorBase.OnEnterDizzy(param);
            }

            if (isDamageSuccess && (actorBase.mActorType == ActorType.AT_MONSTER || actorBase.mActorType == ActorType.AT_MECHANICS))
            {
                m_isHadLoadFrameStop = true;


                GameObject frameStopObj = CoreEntry.gGameObjPoolMgr.InstantiateSkillCell("Skill/Cell/frameStop");
                frameStopObj.transform.parent = transform;

                ISkillCell skillCell = frameStopObj.GetComponent <ISkillCell>();

                skillCell.Init(m_oneDamageInfo.frameStopDesc, m_skillBase, actorBase);

                m_skillBase.AddSkillCell(frameStopObj);
            }
        }
Beispiel #7
0
        void EventFunction(GameEvent ge, EventParameter parameter)
        {
            switch (ge)
            {
            case GameEvent.GE_MOVE_COLLIDE_TARGET:
            {
                GameObject obj       = parameter.goParameter;
                ActorObj   actorBase = obj.GetComponent <ActorObj>();

                //临时判断
                if (actorBase.mActorType == m_skillBase.m_actor.mActorType)
                {
                    break;
                }


                if (!CoreEntry.gGameMgr.IsPvpState() && !m_skillBase.m_actor.IsAimActorType(actorBase))
                {
                    break;
                }

                if (!IsAimGameObject(obj.transform))
                {
                    m_aimTransformList.Add(obj.transform);

                    DamageParam damageParam = new DamageParam();
                    damageParam.skillID     = m_skillBase.m_skillID;
                    damageParam.attackActor = m_skillBase.m_actor;
                    damageParam.behitActor  = actorBase;

                    CoreEntry.gSkillMgr.OnSkillDamage(damageParam);
                }
            }
            break;

            default:
                break;
            }
        }
Beispiel #8
0
        void Update()
        {
            if (!bSceneLoaded)
            {
                return;
            }

            float time = 0.0f;
            float lastTime = Time.realtimeSinceStartup;
            while (mSceneCache.Count > 0)
            {
                if (time > mMaxPrcessingTime)
                {
                    return;
                }

                SceneObj sceneObj = mSceneCache[0];
                switch (sceneObj.ObjType)
                {
                    case EnEntType.EnEntType_Player:
                        MsgData_sSceneObjectEnterHuman humanStruct = sceneObj.ObjData as MsgData_sSceneObjectEnterHuman;
                        CoreEntry.gSceneLoader.LoadOtherPlayer(humanStruct);
                        if (sceneObj.PlayerData != null)
                        {
                            sceneObj.PlayerData = null;
                        }
                        break;
                    case EnEntType.EnEntType_Monster:
                        MsgData_sSceneObjectEnterMonster monsterStruct = sceneObj.ObjData as MsgData_sSceneObjectEnterMonster;
                        //Debug.LogError("创建怪物:" + monsterStruct.Guid);
                        if (!mObjRecord.ContainsKey(monsterStruct.Guid))
                        {
                            CoreEntry.gSceneLoader.LoadMonster(monsterStruct);
                            mObjRecord.Add(monsterStruct.Guid, CoreEntry.gActorMgr.GetActorByServerID(monsterStruct.Guid));
                        }
                        else
                        {
                            //Debug.LogError("重复怪物:" + monsterStruct.Guid);
                        }
                        break;
                    case EnEntType.EnEntType_NPC:
                        MsgData_sSceneObjectEnterNPC npcStruct = sceneObj.ObjData as MsgData_sSceneObjectEnterNPC;
                        CoreEntry.gSceneLoader.LoadNPC(npcStruct);
                        break;
                    case EnEntType.EnEntType_StaticObj:
                        MsgData_sSceneObjectEnterStaticObj sstaticStruct = sceneObj.ObjData as MsgData_sSceneObjectEnterStaticObj;
                        CoreEntry.gSceneLoader.LoadStaticObj(sstaticStruct);
                        break;
                    case EnEntType.EnEntType_Item:
                        MsgData_sSceneObjectEnterItem itemStruct = sceneObj.ObjData as MsgData_sSceneObjectEnterItem;
                        EventParameter param = EventParameter.Get();
                        param.objParameter = itemStruct;
                        CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_OBJ_ITEM_ENTER, param);
                        break;
                    case EnEntType.EnEntType_GatherObj:
                        MsgData_sSceneObjectEnterCollection collectionStruct = sceneObj.ObjData as MsgData_sSceneObjectEnterCollection;
                        CoreEntry.gSceneLoader.LoadCollection(collectionStruct);
                        break;
                    case EnEntType.EnEntType_Pet:
                        MsgData_sSceneObjectEnterPet petStruct = sceneObj.ObjData as MsgData_sSceneObjectEnterPet;
                        CoreEntry.gSceneLoader.LoadPet(petStruct);
                        break;
                    case EnEntType.EnEntType_BiaoChe:
                        MsgData_sSceneObjectEnterBiaoChe cheStruct = sceneObj.ObjData as MsgData_sSceneObjectEnterBiaoChe;
                        CoreEntry.gSceneLoader.LoadBiaoChe(cheStruct);
                        break;
                    case EnEntType.EnEntType_Trap:
                        MsgData_sSceneObjectEnterTrap trapStruct = sceneObj.ObjData as MsgData_sSceneObjectEnterTrap;
                        CoreEntry.gSceneLoader.LoadTrap(trapStruct);
                        break;
                    case EnEntType.EntType_VirtualPlayer:
                        MsgData_sSceneObjectEnterVirtualPlayer vpStruct = sceneObj.ObjData as MsgData_sSceneObjectEnterVirtualPlayer;
                        CoreEntry.gSceneLoader.LoadVirtualPlayer(vpStruct);
                        break;
                    default:
                        break;
                }
                
                mSceneCache.RemoveAt(0);

                time += Time.realtimeSinceStartup - lastTime;
            }

            for (int i = 0; i < mDeathCache.Count; i++)
            {
                MsgData_sObjDeadInfo msg = mDeathCache[i];
                ActorObj behitActor = CoreEntry.gActorMgr.GetActorByServerID(msg.ID);
                if (null == behitActor)
                {
                    continue;
                }

                ActorObj attackActor = CoreEntry.gActorMgr.GetActorByServerID(msg.KillerID);

                BehitParam behitParam = new BehitParam();
                DamageParam damageParam = new DamageParam();
                damageParam.attackActor = attackActor;
                damageParam.behitActor = behitActor;
                damageParam.skillID = msg.KillerSkillID;

                behitParam.damgageInfo = damageParam;
                behitActor.OnDead(msg.KillerSkillID, attackActor, behitParam, EventParameter.Get());

                mDeathCache.RemoveAt(i);
                i--;
            }

            for (int i = 0; i < mLeaveCache.Count; i++)
            {
                ActorObj actor = mLeaveCache[i];
                if (null != actor)
                {
                    if (actor.mActorState.IsDeathEnd())
                    {
                        CoreEntry.gActorMgr.RemoveActorByServerID(actor.ServerID);
                        actor.RecycleObj();

                        EventParameter param = EventParameter.Get();
                        param.longParameter = actor.ServerID;
                        CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_ACTOR_REMOVE, param);

                        if (actor is OtherPlayer)
                        {
                            param = EventParameter.Get();
                            param.longParameter = actor.ServerID;
                            CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_OTHERPLAYER_LEAVE, param);
                        }
                    }
                    else
                    {
                        continue;
                    }
                }
                mLeaveCache.RemoveAt(i);
                i--;
            }
        }
Beispiel #9
0
        //触发器
        public virtual void OnTriggerEnter(Collider other)
        {
            if (bAutoEnd)
            {
                return;
            }

            int groundLayer = LayerMask.NameToLayer("ground");

            //碰到地面就消失
            if (IsRunning && other.gameObject.layer == groundLayer)
            {
                AutoEnd(other.gameObject.transform);
                return;
            }

            if (m_param.disappearWhenTouchWall)
            {
                int wallLayer = LayerMask.NameToLayer("wall");

                //被带走的,碰到墙壁就消失
                if (other.gameObject.layer == wallLayer)
                {
                    AutoEnd(other.gameObject.transform);
                    return;
                }
            }

            bool bIsMonster = false;

            ActorObj actorBase = other.transform.root.gameObject.GetComponent <ActorObj>();

            if (actorBase == null)
            {
                actorBase  = other.transform.gameObject.GetComponent <ActorObj>();
                bIsMonster = true;
            }

            if (actorBase == null)
            {
                //判断是否是破碎物体
                if ((other.gameObject.CompareTag("broked") || other.gameObject.layer == 13) && m_param.m_skillBase.m_actor.mActorType == ActorType.AT_LOCAL_PLAYER)
                {
                    GameObject[] brokedObjs = CoreEntry.gSceneMgr.brokedObjArray;
                    for (int i = 0; i < brokedObjs.Length; ++i)
                    {
                        if (brokedObjs[i] == null)
                        {
                            continue;
                        }

                        //伤害对象

                        Broked broked = brokedObjs[i].GetComponent <Broked>();
                        int    weight = 0; //m_param.m_skillBase.m_skillDesc.weight;
                        broked.DoBroked(m_param.m_skillBase.m_actor.thisGameObject, weight);
                    }


                    if (!m_param.bThroughFlag)
                    {
                        AutoEnd( );
                    }
                }

                return;
            }

            //临时判断
            ActorObj castBase = m_param.castObj.GetComponent <ActorObj>();

            //if (actorBase.mActorType == castBase.mActorType)
            //{
            //    return;
            //}


            if (!castBase.IsAimActorType(actorBase))//IsAimActorType(actorBase.mActorType))
            {
                return;
            }


            if (m_param.bAttackMoreThanOnce == false)
            {
                //增加个判断,判断是不是受过此子弹技能的伤害
                for (int i = 0; i < m_param.m_skillBase.m_AttackList.Count; i++)
                {
                    if (actorBase.entityid == m_param.m_skillBase.m_AttackList[i].entityid)
                    {
                        return;
                    }
                }
            }

            // m_param.m_skillBase.m_AttackList.Find(actorBase);

            //增加到攻击列表
            m_param.m_skillBase.m_AttackList.Add(actorBase);


            //纠正被击表现
            DamageParam damageParam = new DamageParam();

            damageParam.skillID     = m_param.skillID;
            damageParam.attackActor = castBase;// m_param.castObj;

            if (bIsMonster)
            {
                damageParam.behitActor = actorBase;
            }
            else
            {
                damageParam.behitActor = actorBase;
            }

            CoreEntry.gSkillMgr.OnSkillDamage(damageParam);

            m_baseTool = CoreEntry.gBaseTool;

            //是否被带走
            if (m_param.bTakeAwayTarget)
            {
                bool shouldTakeAway = true;
                if (actorBase != null)
                {
                    //boss在气绝状态下才能被带走
                    if (actorBase.CheckIfBossNotQiJue())
                    {
                        shouldTakeAway = false;
                    }

                    //无敌状态不被带走
                    if (actorBase.IsRecoverHealth)
                    {
                        shouldTakeAway = false;
                    }
                }

                if (shouldTakeAway)
                {
                    SetTakeAwayTarget(damageParam, bIsMonster);
                }
            }

            if (!m_param.bThroughFlag)
            {
                AutoEnd( );
            }
        }
Beispiel #10
0
        protected virtual void CalculateDamage()
        {
            // System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            //  sw.Start();
            CancelInvoke("CalculateDamage");

            bool isDamageSuccess = false;

            LuaTable skillDesc = ConfigManager.Instance.Skill.GetSkillConfig(m_skillBase.m_skillID);

            if (skillDesc == null)
            {
                return;
            }

            if (m_skillMgr.m_bShowSkillScope)
            {
                Vector3 pos = m_skillBase.m_actor.transform.position;
                if (null == m_SkillScope)
                {
                    if (m_skillBase.m_actor.mActorType == ActorType.AT_LOCAL_PLAYER || m_skillBase.m_actor.mActorType == ActorType.AT_BOSS)
                    {
                        if (DamageTypeID.DTID_FUN == m_oneDamageInfo.type)
                        {
                            if (m_oneDamageInfo.damageNode.funDamage.angle >= 360)
                            {
                                m_SkillScope = WarningDecel.CreateSectorDecal("Effect/skill/remain/fx_yujing_yuan", pos,
                                                                              m_oneDamageInfo.damageNode.funDamage.radius * 2, m_oneDamageInfo.damageNode.funDamage.angle);
                            }
                            else
                            {
                                m_SkillScope = WarningDecel.CreateSectorDecal("Effect/skill/remain/fx_yujing_shanxing", pos,
                                                                              m_oneDamageInfo.damageNode.funDamage.radius * 2, m_oneDamageInfo.damageNode.funDamage.angle);
                            }


                            if (m_oneDamageInfo.damageNode.funDamage.angle < 360)
                            {
                                float   ActorAngle = 0.0f;
                                Vector3 ActorAxis  = Vector3.zero;
                                m_skillBase.m_actor.transform.rotation.ToAngleAxis(out ActorAngle, out ActorAxis);
                                if (m_SkillScope != null)
                                {
                                    float angle = Mathf.Acos(Vector3.Dot(m_skillBase.m_actor.transform.forward.normalized, new Vector3(1.0f, 0f, 0f))) * Mathf.Rad2Deg;
                                    if (ActorAngle >= 90 && ActorAngle <= 270)
                                    {
                                        m_SkillScope.transform.RotateAround(pos, Vector3.up, angle);
                                    }
                                    else
                                    {
                                        m_SkillScope.transform.RotateAround(pos, Vector3.up, -angle);
                                    }
                                }

                                //LogMgr.UnityLog("angle="+angle.ToString());


                                // m_SkillScope.transform.position += m_SkillScope.transform.up * 0.1f;
                            }
                        }
                        else if (DamageTypeID.DTID_RECT == m_oneDamageInfo.type)
                        {
                            m_SkillScope = WarningDecel.CreateRectangleDecal("Effect/skill/remain/fx_yujing_changfang", pos,
                                                                             m_oneDamageInfo.damageNode.rectDamage.width, m_oneDamageInfo.damageNode.rectDamage.length);
                            if (m_SkillScope != null)
                            {
                                m_SkillScope.transform.rotation  = m_skillBase.m_actor.transform.rotation;
                                m_SkillScope.transform.position += m_oneDamageInfo.damageNode.rectDamage.length / 2 * m_skillBase.m_actor.transform.forward;
                            }
                        }
                    }
                    //Invoke("HideSkillScope", m_oneDamageInfo.hitTime);
                }
            }

            //单体伤害
            if (!m_bIsAoe)
            {
                ActorObj targetObj = m_skillBase.m_actor.GetSelTarget();

                if (targetObj != null && m_skillBase.m_actor.IsSkillAim((sbyte)m_skillBase.m_skillDesc.Get <int>("faction_limit"), targetObj))
                {
                    ActorObj actorBase = targetObj;

                    //按伤害范围算出受伤害对象,具体有没有伤害,还要看对应的属性(免疫等)
                    bool isSkillSuccess = m_skillMgr.IsSkillDamageRange(skillDesc.Get <int>("effect_1"), m_transform,
                                                                        targetObj.transform, actorBase.GetColliderRadius());

                    //伤害对象
                    if (isSkillSuccess)
                    {
                        isDamageSuccess = true;

                        //纠正被击表现
                        DamageParam damageParam = new DamageParam();
                        damageParam.skillID = m_skillBase.m_skillID;
                        //damageParam.attackObj = m_skillBase.m_castOwnObj;
                        damageParam.attackActor = m_skillBase.m_actor;

                        //damageParam.behitObj = attackObj.gameObject;
                        damageParam.behitActor = actorBase;
                        damageParam.IsClient   = true;

                        damageParam.weight            = m_oneDamageInfo.resetSkillWeight;
                        damageParam.isNotUseCurveMove = m_oneDamageInfo.isNotUseCurveMove;

                        CoreEntry.gSkillMgr.OnSkillDamage(damageParam);

                        //是否有眩晕效果
                        if (m_oneDamageInfo.dizzyParamDesc != null)
                        {
                            DizzyParam param = new DizzyParam();
                            param.keepTime = m_oneDamageInfo.dizzyParamDesc.keepTime;

                            actorBase.OnEnterDizzy(param);
                        }
                    }
                }
            }
            else
            {
                //计算伤害  群体
                if (m_skillBase.m_actor == null)
                {
                    return;
                }

                ActorObj actor = null;

                for (int k = 0; k < m_skillBase.m_actor.m_TargetList.Count; ++k)
                {
                    actor = CoreEntry.gActorMgr.GetActorByServerID(m_skillBase.m_actor.m_TargetList[k]);

                    if (ArenaMgr.Instance.IsArenaFight)
                    {
                        actor = CoreEntry.gActorMgr.GetPlayerActorByServerID(m_skillBase.m_actor.m_TargetList[k]);
                    }

                    if (actor == null)
                    {
                        continue;
                    }

                    //对IOS出现怪物不动 报错的异常  进行错误处理
                    if (GameLogicMgr.checkValid(actor.gameObject) == false)
                    {
                        continue;
                    }

                    {
                        isDamageSuccess = true;

                        //纠正被击表现
                        DamageParam damageParam = new DamageParam();
                        damageParam.skillID = m_skillBase.m_skillID;
                        // damageParam.attackObj = m_skillBase.m_castOwnObj;
                        damageParam.attackActor = m_skillBase.m_actor;
                        // damageParam.behitObj = obj.gameObject;
                        damageParam.behitActor        = actor;
                        damageParam.weight            = m_oneDamageInfo.resetSkillWeight;
                        damageParam.isNotUseCurveMove = m_oneDamageInfo.isNotUseCurveMove;

                        damageParam.IsClient = true;

                        CoreEntry.gSkillMgr.OnSkillDamage(damageParam);

                        //是否有眩晕效果
                        if (m_oneDamageInfo.dizzyParamDesc != null)
                        {
                            DizzyParam param = new DizzyParam();
                            param.keepTime = m_oneDamageInfo.dizzyParamDesc.keepTime;

                            actor.OnEnterDizzy(param);
                        }

                        if (isDamageSuccess && actor.mActorType == ActorType.AT_BOSS && m_skillBase.m_actor.IsMainPlayer())
                        {
                            m_isHadLoadFrameStop = true;

                            //顿帧
                            if (m_oneDamageInfo.frameStopDesc != null)
                            {
                                //GameObject frameStopObj = Instantiate(
                                //    CoreEntry.gResLoader.LoadResource(m_oneDamageInfo.frameStopDesc.prefabPath)) as GameObject;
                                GameObject frameStopObj = CoreEntry.gGameObjPoolMgr.InstantiateSkillCell(m_oneDamageInfo.frameStopDesc.prefabPath);

                                ISkillCell skillCell = frameStopObj.GetComponent <ISkillCell>();
                                if (skillCell)
                                {
                                    skillCell.Init(m_oneDamageInfo.frameStopDesc, m_skillBase, actor);
                                    m_skillBase.AddSkillCell(frameStopObj);
                                }
                                else
                                {
                                    //没有skillcell说明,坏掉了马上清理掉
                                    Destroy(frameStopObj);
                                }
                            }
                        }
                    }
                }
            }


            LuaTable skill_action = CoreEntry.gSkillMgr.GetSkillActon(m_skillBase.m_skillID);


            string remanEfx = null;

            if (skill_action != null)
            {
                remanEfx = skill_action.Get <string>("remain");
            }


            //地表残留
            if (remanEfx.Length > 0 && m_oneDamageInfo.m_bUseRemain)
            {
                //GameObject efxObj = (GameObject)Object.Instantiate(CoreEntry.gResLoader.LoadResource(remanEfx));//CoreEntry.gGameObjPoolMgr.InstantiateEffect(remanEfx);
                GameObject efxObj = CoreEntry.gGameObjPoolMgr.InstantiateEffect(remanEfx);


                if (efxObj == null)
                {
                    //efxObj = (GameObject)Object.Instantiate(CoreEntry.gResLoader.LoadResource(remanEfx));//CoreEntry.gGameObjPoolMgr.InstantiateEffect(remanEfx);
                    efxObj = CoreEntry.gGameObjPoolMgr.InstantiateEffect(remanEfx);
                }


                //yy 特效和模型按等比例缩放
                //if (m_skillBase.m_actor.actorCreatureDisplayDesc.sacle > 1.0f)
                //{
                //    ParticleScaler ScaleComponet = efxObj.GetComponent<ParticleScaler>();
                //    if (ScaleComponet == null)
                //        ScaleComponet = efxObj.AddComponent<ParticleScaler>();

                //    ScaleComponet.particleScale = m_skillBase.m_actor.actorCreatureDisplayDesc.sacle;

                //}


                float maxEfxTime = 0;

                if (efxObj)
                {
                    NcCurveAnimation[] efxAnimations = efxObj.GetComponentsInChildren <NcCurveAnimation>();
                    for (int i = 0; i < efxAnimations.Length; ++i)
                    {
                        // efxAnimations[i].m_fDelayTime /= m_speed;
                        // efxAnimations[i].m_fDurationTime /= m_speed;

                        float efxTime = efxAnimations[i].m_fDelayTime + efxAnimations[i].m_fDurationTime;
                        if (efxTime > maxEfxTime)
                        {
                            maxEfxTime = efxTime;
                        }
                    }
                }

                if (skill_action != null)
                {
                    if (skill_action.Get <float>("skillEfxLength") > 0)
                    {
                        maxEfxTime = skill_action.Get <float>("skillEfxLength");
                    }

                    //特效存在时间
                    if (maxEfxTime <= 0.001)
                    {
                        maxEfxTime = m_skillBase.m_actor.GetActionLength(skill_action.Get <string>("animation"));
                    }
                }


                EfxAttachActionPool efx = efxObj.GetComponent <EfxAttachActionPool>();
                if (efx == null)
                {
                    efx = efxObj.AddComponent <EfxAttachActionPool>();
                }

                //yy test

                efx.InitRemain(m_skillBase.m_actor.transform, maxEfxTime, false);


                m_RemainEfx = efx;
            }



            //场景物件,主角破坏
            if (m_skillBase.m_actor.mActorType == ActorType.AT_LOCAL_PLAYER)
            {
                GameObject[] brokedObjs = CoreEntry.gSceneMgr.brokedObjArray;
                for (int i = 0; i < brokedObjs.Length; ++i)
                {
                    if (brokedObjs[i] == null)
                    {
                        continue;
                    }

                    bool isSkillSuccess = m_skillMgr.IsSkillDamageRange(skillDesc.Get <int>("effect_1"), m_transform, brokedObjs[i].transform, 0.5f);

                    //伤害对象
                    if (isSkillSuccess)
                    {
                        Broked broked = brokedObjs[i].GetComponent <Broked>();
                        int    weight = 3;//m_skillBase.m_skillDesc.weight;
                        if (m_oneDamageInfo.resetSkillWeight > 0)
                        {
                            weight = m_oneDamageInfo.resetSkillWeight;
                        }

                        broked.DoBroked(m_skillBase.m_actor.thisGameObject, weight);
                    }
                }
            }

            //if (isDamageSuccess && !m_isHadLoadFrameStop)
            //{
            //    m_isHadLoadFrameStop = true;

            //    //顿帧
            //    if (m_oneDamageInfo.frameStopDesc != null)
            //    {
            //        GameObject frameStopObj = Instantiate(
            //            CoreEntry.gResLoader.LoadResource(m_oneDamageInfo.frameStopDesc.prefabPath)) as GameObject;

            //        ISkillCell skillCell = frameStopObj.GetComponent<ISkillCell>();

            //        skillCell.Init(m_oneDamageInfo.frameStopDesc,m_skillBase.m_actor);

            //        m_skillBase.AddSkillCell(frameStopObj);
            //    }

            //}

            //屏震    不是主玩家 , 就不震屏幕
            if (m_skillBase.m_actor.IsMainPlayer() || m_skillBase.m_actor.mActorType == ActorType.AT_BOSS)
            {
                if (m_oneDamageInfo.cameraShakeDesc != null)
                {
                    if (m_oneDamageInfo.cameraShakeDesc.activeWhenHit == false ||
                        (m_oneDamageInfo.cameraShakeDesc.activeWhenHit == true && isDamageSuccess == true)
                        )
                    {
                        //GameObject cellObj = Instantiate(
                        //    CoreEntry.gResLoader.LoadResource(m_oneDamageInfo.cameraShakeDesc.prefabPath)) as GameObject;

                        GameObject cellObj = CoreEntry.gGameObjPoolMgr.InstantiateSkillCell(m_oneDamageInfo.cameraShakeDesc.prefabPath);
                        cellObj.transform.parent = transform;

                        // m_oneDamageInfo.cameraShakeDesc.playTime = m_oneDamageInfo.hitTime;

                        ISkillCell skillCell = cellObj.GetComponent <ISkillCell>();
                        skillCell.Init(m_oneDamageInfo.cameraShakeDesc, m_skillBase);

                        m_skillBase.AddSkillCell(cellObj);
                    }
                }
            }



            //是否持续伤害
            if (m_oneDamageInfo.isRepeatedly && m_repeateKeep > 0)
            {
                Invoke("CalculateDamage", m_oneDamageInfo.damageDiff / m_skillBase.m_speed);
                --m_repeateKeep;
            }

            // sw.Stop();
            if (m_skillBase.m_actor.IsLocalPlayer())
            {
                // Debug.LogError("3....." + sw.ElapsedMilliseconds + "毫秒.....");
            }
        }
Beispiel #11
0
        void CalculateDamage()
        {
            CancelInvoke("CalculateDamage");

            OneCurveDamageInfo curveInfo = m_curveDamageCellDesc.curveDamageInfoList[m_curIndex];

            //旋转偏移
            m_transform.Rotate(Vector3.up, curveInfo.offsetAngle * Mathf.Deg2Rad);

            //debug
#if UNITY_EDITOR
            GameObject efxObj = Instantiate(
                CoreEntry.gResLoader.LoadResource("Skill/Cube")) as GameObject;
            efxObj.transform.position = m_transform.position;
            efxObj.transform.rotation = m_transform.rotation;
            efxObj.name = m_curIndex.ToString();

            SceneEfx efx = efxObj.AddComponent <SceneEfx>();
            efx.Init(m_transform.position, 5);
#endif

            //计算伤害monster
            System.Collections.Generic.List <ActorObj> actors = CoreEntry.gActorMgr.GetAllMonsterActors();
            foreach (ActorObj obj in actors)
            {
                //对IOS出现怪物不动 报错的异常  进行错误处理
                if (GameLogicMgr.checkValid(obj.gameObject) == false)
                {
                    continue;
                }
                ActorObj actorBase = obj;

                //临时判断
                if (actorBase.mActorType == m_skillBase.m_actor.mActorType)
                {
                    continue;
                }


                if (!CoreEntry.gGameMgr.IsPvpState() && !m_skillBase.m_actor.IsAimActorType(actorBase))
                {
                    continue;
                }

                bool isSkillSuccess = BaseTool.instance.IsPointInRectangleXZ(m_transform.position,
                                                                             m_transform.rotation.eulerAngles, curveInfo.damageLength,
                                                                             curveInfo.damageWidth, obj.transform.position);

                //伤害对象
                if (isSkillSuccess)
                {
                    //纠正被击表现
                    DamageParam damageParam = new DamageParam();
                    damageParam.skillID     = m_skillBase.m_skillID;
                    damageParam.attackActor = m_skillBase.m_actor;
                    damageParam.behitActor  = actorBase;

                    CoreEntry.gSkillMgr.OnSkillDamage(damageParam);
                }
            }

            //场景物件,主角破坏
            if (m_skillBase.m_actor.mActorType == ActorType.AT_LOCAL_PLAYER)
            {
                GameObject[] brokedObjs = CoreEntry.gSceneMgr.brokedObjArray;
                for (int i = 0; i < brokedObjs.Length; ++i)
                {
                    bool isSkillSuccess = BaseTool.instance.IsPointInRectangleXZ(m_transform.position,
                                                                                 m_transform.rotation.eulerAngles, curveInfo.damageLength,
                                                                                 curveInfo.damageWidth, brokedObjs[i].transform.position);

                    //伤害对象
                    if (isSkillSuccess)
                    {
                        Broked broked = brokedObjs[i].GetComponent <Broked>();
                        int    weight = 3;//m_skillBase.m_skillDesc.weight;

                        broked.DoBroked(m_skillBase.m_actor.thisGameObject, weight);
                    }
                }
            }

            if (m_curIndex < m_curveDamageCellDesc.curveDamageInfoList.Count - 1)
            {
                m_curIndex++;

                //设置位置
                m_transform.position += m_transform.forward.normalized * curveInfo.length;

                Invoke("CalculateDamage", m_curveDamageCellDesc.curveDamageInfoList[m_curIndex].hitTime);
            }
        }
Beispiel #12
0
        //技能命中,获取被击的信息,发给被击对象做表现
        public void OnSkillDamage(DamageParam damageParam)
        {
            if (ArenaMgr.Instance.IsArenaFight)
            {
                ArenaMgr.Instance.OnSkillDamage(damageParam);

                return;
            }

            //攻击者的信息
            ActorObj attackActorObj = damageParam.attackActor;
            ActorObj behitActorObj  = damageParam.behitActor;

            if (null == attackActorObj || null == behitActorObj)
            {
                return;
            }

            if (behitActorObj.IsDeath())
            {
                return;
            }


            BehitParam behitParam = new BehitParam();


            behitParam.displayType = DamageDisplayType.DDT_NORMAL;
            behitParam.hp          = damageParam.Damage;

#if !PUBLISH_RELEASE
            if (m_bMiaoGuai)
            {
                if (attackActorObj.mActorType == ActorType.AT_LOCAL_PLAYER)
                {
                    behitParam.hp += 1000000;
                }
            }
            else
            {
                if (m_bWuShang && attackActorObj.mActorType == ActorType.AT_LOCAL_PLAYER)
                {
                    behitParam.hp = 1;
                }
            }
#endif

            //被击效果修正
            behitParam.damgageInfo = damageParam;

#if !PUBLISH_RELEASE
            if (m_bWuShang && behitActorObj.mActorType == ActorType.AT_LOCAL_PLAYER)
            {
                behitParam.hp = 1;
            }
#endif


            //给技能释放者发送回复信息

            // 发送被击消息给被击者
            //  if (behitParam.hp != 0)
            {
                behitActorObj.OnSkillBeHit(behitParam);
            }

            if (attackActorObj.mActorType == ActorType.AT_LOCAL_PLAYER)
            {
                behitActorObj.Health.ShowHPBar(5);
            }

            //受到其它玩家攻击时,提示开启善恶模式
            if (behitParam.hp > 0 && behitActorObj.mActorType == ActorType.AT_LOCAL_PLAYER)
            {
                if (attackActorObj.mActorType == ActorType.AT_REMOTE_PLAYER)
                {
                    if (PlayerData.Instance.CurPKMode == PKMode.PK_MODE_PEACE && (PlayerData.LastNoteSwitchPKTime <= 0 || (Time.realtimeSinceStartup - PlayerData.LastNoteSwitchPKTime) >= 60))
                    {
                        bool autosetpk = false;
                        if (autosetpk)
                        {
                            UITips.ShowTips("受到攻击,切换善恶模式");
                            PlayerData.Instance.SendSetPKRuleRequest(PKMode.PK_MODE_EVIL);
                        }
                        else
                        {
                            MainPanelMgr.Instance.ShowDialog("TipSwitchPKNote");
                            PlayerData.LastNoteSwitchPKTime = Time.realtimeSinceStartup;
                        }
                    }

                    //没有目标则选中攻击者
                    ActorObj mainplayer = CoreEntry.gActorMgr.MainPlayer;
                    if (mainplayer.m_SelectTargetObject == null)
                    {
                        mainplayer.SelectTarget(attackActorObj);
                    }

                    EventParameter ep = EventParameter.Get();
                    ep.objParameter = attackActorObj;
                    CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_PLAYER_PK_HURT, ep);
                }

                //玩家收到了攻击
                AutoAIMgr automgr = CoreEntry.gAutoAIMgr;
                if (automgr.Config.AutoStrikeBack && TaskMgr.RunTaskType == 0 && !automgr.AutoFight && !behitActorObj.AutoPathFind)
                {
                    float gap = Time.realtimeSinceStartup - automgr.LastOPTime;
                    //LogMgr.Log("Last op gap {0}", gap);
                    if (gap > automgr.Config.StrikeBackGapWithIdle)
                    {
                        automgr.AutoFight = true;
                    }
                }
            }
        }
Beispiel #13
0
        public void EventFunction(GameEvent ge, EventParameter parameter)
        {
            switch (ge)
            {
            case GameEvent.GE_NOTIFY_CAST_SKILL:
            {
                //释放技能
                int        skillID = (int)parameter.intParameter;
                GameObject actor   = parameter.goParameter;

                //调用actorbase释放技能
                ActorObj actorObj = actor.GetComponent <ActorObj>();

                //是否学习了该技能
                if (actorObj.IsHadLearnSkill(skillID))
                {
                    //玩家释放技能前选择目标
                    if (actorObj.mActorType == ActorType.AT_LOCAL_PLAYER)
                    {
                        //若没有目标则马上选择目标
                        CoreEntry.gActorMgr.MainPlayer.CheckSkillTarget();
                    }

                    actorObj.OnRunToAttack(skillID);
                    //actorObj.OnCastSkill(skillID);
                }
            }
            break;

            case GameEvent.GE_NOTIFY_SHOW_SKILL_SCOPE:
            {
                //释放技能
                int        skillID = (int)parameter.intParameter;
                GameObject actor   = parameter.goParameter;

                //调用actorbase释放技能
                ActorObj actorObj = actor.GetComponent <ActorObj>();

                //是否学习了该技能
                if (actorObj.IsHadLearnSkill(skillID))
                {
                    actorObj.OnShowSkillScope(skillID);
                    //actorObj.OnCastSkill(skillID);
                }
            }
            break;

            case GameEvent.GE_NOTIFY_HIDE_SKILL_SCOPE:
            {
                //释放技能
                int        skillID = (int)parameter.intParameter;
                GameObject actor   = parameter.goParameter;

                //调用actorbase释放技能
                ActorObj actorObj = actor.GetComponent <ActorObj>();

                //是否学习了该技能
                if (actorObj.IsHadLearnSkill(skillID))
                {
                    actorObj.OnHideSkillScope(skillID);
                    //actorObj.OnCastSkill(skillID);
                }
            }
            break;

            //
            case GameEvent.GE_SC_SKILLEFFECT:
            {
                MsgData_sCastEffect data = parameter.msgParameter as MsgData_sCastEffect;

                if (data == null)
                {
                    return;
                }


                //服务器这里只冒伤害数字
                bool bIsMainPlayer = false;

                BehitParam behitParam = new BehitParam();

                DamageParam damageParam = new DamageParam();
                damageParam.attackActor = CoreEntry.gActorMgr.GetActorByServerID(data.CasterID);
                damageParam.behitActor  = CoreEntry.gActorMgr.GetActorByServerID(data.TargetID);
                damageParam.skillID     = data.SkillID;
                damageParam.Flags       = data.Flags;
                damageParam.DamagaType  = data.DamagaType;
                damageParam.Damage      = (int)data.Damage;
                damageParam.IsClient    = false;


                behitParam.damgageInfo = damageParam;
                behitParam.displayType = (DamageDisplayType)data.DamagaType;
                behitParam.hp          = (int)data.Damage;


                if (behitParam.damgageInfo.attackActor != null &&
                    behitParam.damgageInfo.attackActor.mActorType == ActorType.AT_LOCAL_PLAYER)
                {
                    bIsMainPlayer = true;
                }

                if (behitParam.damgageInfo.attackActor != null)
                {
                    if (bIsMainPlayer)
                    {
                        behitParam.damgageInfo.attackActor.OnDamage((int)data.Damage, data.SkillID, bIsMainPlayer, behitParam);
                    }
                    else
                    {
                        //其他人要播受击动作
                        OnSkillDamage(damageParam);
                    }
                }
            }
            break;


            case GameEvent.GE_SC_OTHER_CASTSKILL_BEGIN:
            {
                MsgData_sCastBegan data = parameter.msgParameter as MsgData_sCastBegan;
                if (data == null)
                {
                    return;
                }
                ActorObj attackObj = CoreEntry.gActorMgr.GetActorByServerID(data.CasterID);

                if (attackObj == null)
                {
                    return;
                }

                if (attackObj != null && attackObj.mActorType == ActorType.AT_LOCAL_PLAYER)
                {
                    return;
                }



                //todo ,先强行同步位置
                attackObj.SetServerPosition(new Vector2(data.CasterPosX, data.CasterPosY));
                attackObj.OnCastSkill(data.SkillID, data.CasterID, data.TargetID, data.PosX, data.PosY);
            }
            break;


            case GameEvent.GE_SC_OTHER_CASTSKILL_END:
            {
                MsgData_sCastEnd data = parameter.msgParameter as MsgData_sCastEnd;
                if (data == null)
                {
                    return;
                }
                ActorObj attackObj = CoreEntry.gActorMgr.GetActorByServerID(data.CasterID);

                if (attackObj == null)
                {
                    return;
                }

                attackObj.SkillEnd(data.SkillID);
            }
            break;


            //hitback
            case GameEvent.GE_SC_KNOCKBACK:
            {
                MsgData_sKnockBack data = parameter.msgParameter as MsgData_sKnockBack;
                if (data == null)
                {
                    return;
                }
                ActorObj beHitActor  = CoreEntry.gActorMgr.GetActorByServerID(data.TargetID);
                ActorObj attackActor = CoreEntry.gActorMgr.GetActorByServerID(data.CasterID);

                if (beHitActor == null || attackActor == null)
                {
                    return;
                }

                beHitActor.OnHitBack(attackActor, data.MotionSpeed, data.PosX, data.PosY, data.MotionTime);
            }
            break;

            case GameEvent.GE_SC_ADDBUFFList:
            {
                MsgData_sAddBufferList data = parameter.msgParameter as MsgData_sAddBufferList;
                if (data == null)
                {
                    return;
                }
                ActorObj targetObj = CoreEntry.gActorMgr.GetActorByServerID(data.TargetID);
                if (targetObj == null)
                {
                    return;
                }
                for (int i = 0; i < data.BufferList.Count; i++)
                {
                    MsgData_sBuffer _buff    = data.BufferList[i];
                    BuffData        buffdata = new BuffData();
                    buffdata.BufferInstanceID = _buff.BufferInstanceID;
                    buffdata.buffType         = _buff.BufferTemplateID;
                    buffdata.Life             = _buff.Life;
                    buffdata.Count            = 1;
                    //buffdata.Param[0] = data.Param;
                    CoreEntry.gBuffMgr.AddBuff(buffdata, targetObj);
                }
            }
            break;

            case GameEvent.GE_SC_ADDBUFF:
            {
                MsgData_sAddBuffer data = parameter.msgParameter as MsgData_sAddBuffer;

                if (data == null)
                {
                    return;
                }

                /*
                 * if (data.BufferTemplateID == 24100001 || data.BufferTemplateID == 24100002)
                 * {
                 *  Debug.LogError("target目标 "+ data.TargetID +"  添加 iBuffId = " + data.BufferTemplateID);
                 * }
                 */
                // Debug.LogError("target目标 " + data.TargetID + "  添加 iBuffId = " + data.BufferTemplateID);
                ActorObj targetObj = CoreEntry.gActorMgr.GetActorByServerID(data.TargetID);

                if (targetObj == null)
                {
                    return;
                }

                BuffData buffdata = new BuffData();
                buffdata.BufferInstanceID = data.BufferInstanceID;
                buffdata.buffType         = data.BufferTemplateID;
                buffdata.Life             = data.Life;
                buffdata.Count            = 1;

                buffdata.Param[0] = data.Param;
                //LogMgr.LogError("SkillMgr AddBuff " + buffdata.buffType);
                CoreEntry.gBuffMgr.AddBuff(buffdata, targetObj);
            }
            break;

            case GameEvent.GE_SC_UPDATEBUFF:
            {
                MsgData_sUpdateBuffer data = parameter.msgParameter as MsgData_sUpdateBuffer;

                if (data == null)
                {
                    return;
                }

                BuffData buffdata = new BuffData();
                buffdata.BufferInstanceID = data.BufferInstanceID;
                buffdata.Life             = data.Life;
                buffdata.Count            = data.Count;
                buffdata.Param            = data.Param;
                //LogMgr.LogError("SkillMgr UpdateBuff " + buffdata.buffType);
                CoreEntry.gBuffMgr.UpdateBuff(buffdata);
            }
            break;

            case GameEvent.GE_SC_DELBUFF:
            {
                MsgData_sDelBuffer data = parameter.msgParameter as MsgData_sDelBuffer;
                if (data == null)
                {
                    return;
                }
                if (data.BufferTemplateID == 24100001 || data.BufferTemplateID == 24100002)
                {
                    //LogMgr.DebugLog("target目标 "+ data.TargetID + "  删除 iBuffId = " + data.BufferTemplateID);
                }

                //LogMgr.LogError("SkillMgr DelBuff " + data.BufferTemplateID);
                //  if(data.BufferInstanceID)
                ActorObj targetObj = CoreEntry.gActorMgr.GetActorByServerID(data.TargetID);

                if (targetObj != null)
                {
                    //LogMgr.LogError("SKillMgr CoreEntry.gBuffMgr.RemoveBuff " + data.BufferTemplateID);
                    CoreEntry.gBuffMgr.RemoveBuff(data.BufferInstanceID, targetObj);
                    if (targetObj.ServerID == CoreEntry.gActorMgr.MainPlayer.ServerID)
                    {
                        EventParameter msg = new EventParameter();
                        msg.longParameter = data.BufferTemplateID;
                        //Debug.LogError("删除BUFF  " + data.BufferTemplateID);
                        CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_CC_DELEBUFF, msg);
                    }
                }
            }
            break;

            case GameEvent.GE_SC_CAST_MOVE_EFFECRT:
            {
                MsgData_sCastMoveEffect data = parameter.msgParameter as MsgData_sCastMoveEffect;
                if (null == data)
                {
                    return;
                }

                if (data.caseterID == CoreEntry.gActorMgr.MainPlayer.ServerID)
                {
                    return;
                }

                ActorObj casterObj = CoreEntry.gActorMgr.GetActorByServerID(data.caseterID);
                if (null == casterObj)
                {
                    return;
                }

                LuaTable skill_action = CoreEntry.gSkillMgr.GetSkillActon(data.skillID);
                if (null == skill_action)
                {
                    return;
                }

                float   posX    = (float)data.posX;
                float   posZ    = (float)data.posY;
                Vector3 destPos = new Vector3(posX, CommonTools.GetTerrainHeight(new Vector2(posX, posZ)), posZ);

                AnimationCurveData curveData = casterObj.GetComponent <AnimationCurveData>();
                if (null == curveData)
                {
                    LogMgr.LogError(casterObj.gameObject.name + " has no AnimationCurveBase, skill id:" + data.skillID);

                    return;
                }

                casterObj.UseCurveData3(skill_action.Get <string>("animation"), destPos, null);
            }
            break;

            default:
                break;
            }
        }
Beispiel #14
0
        public void OnSkillDamage(DamageParam damageParam)
        {
            long attkerID   = damageParam.attackActor.ServerID;
            int  behitIndex = 0;

            MsgData_sResArenaMemVo attker  = null;
            MsgData_sResArenaMemVo beAtker = null;

            if (attkerID == mArenaFighters[0].RoleID)
            {
                attker     = mArenaFighters[0];
                beAtker    = mArenaFighters[1];
                behitIndex = 1;
            }
            else
            {
                attker     = mArenaFighters[1];
                beAtker    = mArenaFighters[0];
                behitIndex = 0;
            }

            double dmg_value      = .0f;
            double extra_attr_dmg = .0f;
            double attack_dmg     = attker.Atk;

            //1.�����Ƿ�����,Э��û�������ֶΣ���ȥ��

            int src_level = (int)attker.Level;
            int dst_level = (int)beAtker.Level;
            //2.��������,����������
            // ����������;
            string dmgParam = ConfigManager.Instance.Consts.GetValue <string>(3, "param");

            string[] param1 = dmgParam.Split(',');
            float    nVal1  = .0f;
            float    nVal2  = .0f;

            if (param1.Length == 2)
            {
                if (!float.TryParse(param1[0], out nVal1))
                {
                    nVal1 = .0f;
                }
                if (!float.TryParse(param1[1], out nVal2))
                {
                    nVal2 = .0f;
                }
            }

            LuaTable lvupCfg      = ConfigManager.Instance.Actor.GetLevelUpConfig(dst_level);
            double   aviod_param1 = lvupCfg.Get <float>("lv_pvesubdamage");

            dmgParam = ConfigManager.Instance.Consts.GetValue <string>(61, "param");
            param1   = dmgParam.Split('#');
            double aviod_param2 = 0.8f;
            double aviod_param3 = 0.0f;

            string[] param2 = null;
            if (param1.Length > 1)
            {
                param2 = param1[1].Split(',');
            }
            if (null != param2 && param2.Length == 2)
            {
                if (!double.TryParse(param2[0], out aviod_param2))
                {
                    aviod_param2 = 0.8f;
                }
                if (!double.TryParse(param2[1], out aviod_param3))
                {
                    aviod_param3 = 0.0f;
                }
            }

            double damage_f1 = 0.0f;
            double damage_f2 = 0.0f;
            double damage_f3 = 0.0f;
            double dst_def   = Math.Max(1, beAtker.Def - attker.SubDef);

            double dst_avoid_rate = (dst_def / (dst_def + dst_level * aviod_param1)) * aviod_param2 + aviod_param3;

            damage_f1 = (attack_dmg * UnityEngine.Random.Range(nVal1, nVal2) * (1.0f) + extra_attr_dmg) * (1 - dst_avoid_rate);

            // �����Ƿ񱩻�;
            param2 = null;
            if (param1.Length > 2)
            {
                param2 = param1[2].Split(',');
            }
            double critical_param1 = 0.6f;
            double critical_param2 = 0.0f;
            double critical_param3 = 3.0f;

            if (null != param2 && param2.Length == 3)
            {
                if (!double.TryParse(param2[0], out critical_param1))
                {
                    critical_param1 = 0.6f;
                }
                if (!double.TryParse(param2[1], out critical_param2))
                {
                    critical_param2 = 0.0f;
                }
                if (!double.TryParse(param2[2], out critical_param3))
                {
                    critical_param3 = 3.0f;
                }
            }


            double cridam_param1 = 0.5f;
            double cridam_param2 = 0.2f;

            param2 = null;
            if (param1.Length > 3)
            {
                param2 = param1[3].Split(',');
            }
            if (null != param2 && param2.Length == 2)
            {
                if (!double.TryParse(param2[0], out cridam_param1))
                {
                    cridam_param1 = 0.5f;
                }
                if (!double.TryParse(param2[1], out cridam_param2))
                {
                    cridam_param2 = 0.2f;
                }
            }

            double src_critical     = attker.Cri;
            double src_critical_dmg = attker.CriValue;
            double puncture         = attker.AbsAtk;
            double dst_tenacity     = beAtker.DefCri;
            double dst_critical_def = beAtker.SubCri;
            double critical_rate    = 0.0f;

            critical_rate = (src_critical / (src_critical + dst_tenacity * critical_param3)) * critical_param1 + critical_param2;

            double critical_dmg = Math.Max((src_critical_dmg - dst_critical_def + cridam_param1), cridam_param2);             // ����;
            bool   isCritical   = false;

            if (UnityEngine.Random.Range(0.0f, 1.0f) < critical_rate)
            {
                isCritical = true;
                damage_f2  = (damage_f1 + puncture) * (1 + critical_dmg);
            }
            else
            {
                isCritical = false;
                damage_f2  = (damage_f1 + puncture);
            }

            // �����Ƿ񷢶�����,Э��û�������ֶΣ���ȥ��

            // �����˺�;
            double mindmg_param = 0.5f;             //��С�˺�ϵ��;

            damage_f3 = Math.Max(src_level * mindmg_param, damage_f2);

            dmg_value = damage_f3;

            //3.�˺������ͼ���;
            dmg_value = dmg_value * (1 + (attker.DmgAdd * 0.01f));
            dmg_value = dmg_value * (1 - (beAtker.DmgSub * 0.01f));

            //4.�˺�ֵ�����ָ���;
            if (dmg_value <= 1)
            {
                dmg_value = 100.0;
            }

            ActorObj   behitActorObj = damageParam.behitActor;
            BehitParam behitParam    = new BehitParam();

            behitParam.displayType = DamageDisplayType.DDT_NORMAL;
            behitParam.hp          = (int)dmg_value;
            behitParam.damgageInfo = damageParam;
            behitActorObj.OnSkillBeHit(behitParam);

            DoCalHP(behitIndex, dmg_value, isCritical);
        }