Exemple #1
0
        internal static Msg_RC_NpcMove BuildNpcMoveMessage(NpcInfo npc)
        {
            Msg_RC_NpcMove npcMoveBuilder = new Msg_RC_NpcMove();

            if (npc.GetMovementStateInfo().IsMoving)
            {
                npcMoveBuilder.npc_id         = npc.GetId();
                npcMoveBuilder.is_moving      = true;
                npcMoveBuilder.move_direction = (float)npc.GetMovementStateInfo().GetMoveDir();
                npcMoveBuilder.face_direction = (float)npc.GetMovementStateInfo().GetFaceDir();
                npcMoveBuilder.cur_pos_x      = npc.GetMovementStateInfo().GetPosition3D().X;
                npcMoveBuilder.cur_pos_z      = npc.GetMovementStateInfo().GetPosition3D().Z;
                NpcAiStateInfo data = npc.GetAiStateInfo();
                npcMoveBuilder.target_pos_x         = npc.GetMovementStateInfo().TargetPosition.X;
                npcMoveBuilder.target_pos_z         = npc.GetMovementStateInfo().TargetPosition.Z;
                npcMoveBuilder.velocity_coefficient = (float)npc.VelocityCoefficient;
                npcMoveBuilder.velocity             = npc.GetActualProperty().MoveSpeed;
                npcMoveBuilder.move_mode            = (int)npc.GetMovementStateInfo().MovementMode;
            }
            else
            {
                npcMoveBuilder.npc_id    = npc.GetId();
                npcMoveBuilder.is_moving = false;
                npcMoveBuilder.cur_pos_x = npc.GetMovementStateInfo().GetPosition3D().X;
                npcMoveBuilder.cur_pos_z = npc.GetMovementStateInfo().GetPosition3D().Z;
            }
            return(npcMoveBuilder);
        }
        internal void DestroyEntities(int[] unit_ids)
        {
            Msg_RC_DestroyNpc destroyNpcBuilder = new Msg_RC_DestroyNpc();

            for (int i = 0; i < unit_ids.Length; i++)
            {
                NpcInfo npc = NpcManager.GetNpcInfoByUnitId(unit_ids[i]);
                if (npc != null)
                {
                    destroyNpcBuilder.npc_id = npc.GetId();
                    NotifyAllUser(destroyNpcBuilder);
                    NpcManager.RemoveNpc(npc.GetId());
                }
            }
        }
Exemple #3
0
        internal static Msg_RC_CreateNpc BuildCreateNpcMessage(NpcInfo npc)
        {
            Msg_RC_CreateNpc bder = new Msg_RC_CreateNpc();

            bder.npc_id  = npc.GetId();
            bder.unit_id = npc.GetUnitId();
            Vector3 pos = npc.GetMovementStateInfo().GetPosition3D();

            ArkCrossEngineMessage.Position pos_bd = new ArkCrossEngineMessage.Position();
            pos_bd.x            = (float)pos.X;
            pos_bd.z            = (float)pos.Z;
            bder.cur_pos        = pos_bd;
            bder.face_direction = (float)npc.GetMovementStateInfo().GetFaceDir();
            bder.link_id        = npc.GetLinkId();
            if (npc.GetUnitId() <= 0)
            {
                bder.camp_id = npc.GetCampId();
            }
            if (npc.OwnerId > 0)
            {
                bder.owner_id = npc.OwnerId;
            }
            bder.level = npc.GetLevel();
            return(bder);
        }
        private void NpcLeaveCampSight(NpcInfo npc, int campid)
        {
            Msg_RC_NpcDisappear bder = new Msg_RC_NpcDisappear();

            bder.npc_id = npc.GetId();
            NotifyCampUsers(campid, bder);
        }
Exemple #5
0
        private static void MoveToNext(NpcInfo npc, AiData_ForMoveCommand data)
        {
            if (++data.Index >= data.WayPoints.Count)
            {
                data.IsFinish = true;
                return;
            }

            var     move_info = npc.GetMovementStateInfo();
            Vector3 from      = move_info.GetPosition3D();
            Vector3 to        = data.WayPoints[data.Index];
            float   move_dir  = MoveDirection(from, to);

            float now      = TimeUtility.GetServerMilliseconds();
            float distance = Geometry.Distance(from, to);
            float speed    = npc.GetActualProperty().MoveSpeed;

            data.EstimateFinishTime = now + 1000 * (distance / speed);
            DLog._("ai_move", "[{0}]: now({1}), from({2}), to({3}), distance({4}), speed({5}), move_time({6}), estimate({7})",
                   npc.GetId(), now, from.ToString(), to.ToString(), distance, speed, 1000 * (distance / speed), data.EstimateFinishTime);

            move_info.IsMoving = true;
            move_info.SetMoveDir(move_dir);
            move_info.SetFaceDir(move_dir);
        }
Exemple #6
0
        internal static Msg_RC_NpcFace BuildNpcFaceMessage(NpcInfo npc)
        {
            Msg_RC_NpcFace npcFaceBuilder = new Msg_RC_NpcFace();

            npcFaceBuilder.npc_id         = npc.GetId();
            npcFaceBuilder.face_direction = (float)npc.GetMovementStateInfo().GetFaceDir();
            return(npcFaceBuilder);
        }
Exemple #7
0
        internal static Msg_RC_SyncNpcOwnerId BuildSyncNpcOwnerIdMessage(NpcInfo npc)
        {
            Msg_RC_SyncNpcOwnerId builder = new Msg_RC_SyncNpcOwnerId();

            builder.npc_id   = npc.GetId();
            builder.owner_id = npc.OwnerId;
            return(builder);
        }
Exemple #8
0
        private void OnNpcMeetEnemy(NpcInfo npc, Animation_Type animType)
        {
            CharacterView view = EntityManager.Instance.GetCharacterViewById(npc.GetId());

            if (null != view)
            {
                GfxSystem.SendMessage(view.Actor, "OnMeetEnemy", null);
            }
            view.PlayAnimation(animType);
            view.PlayQueuedAnimation(Animation_Type.AT_Stand);
        }
        private void OnNpcStopSkill(NpcInfo npc)
        {
            Scene scene = npc.SceneContext.CustomData as Scene;

            if (null != scene)
            {
                SkillInfo skillInfo = npc.GetSkillStateInfo().GetCurSkillInfo();
                if (null == skillInfo || skillInfo.IsSkillActivated)
                {
                    scene.SkillSystem.StopSkill(npc.GetId());
                }

                Msg_CRC_NpcStopSkill skillBuilder = new Msg_CRC_NpcStopSkill();
                skillBuilder.npc_id = npc.GetId();

                LogSystem.Debug("Send Msg_RC_NpcStopSkill, EntityId={0}",
                                npc.GetId());
                scene.NotifyAreaUser(npc, skillBuilder);
            }
        }
Exemple #10
0
        private void ReleaseControl(NpcInfo npc)
        {
            if (null != npc.ControllerObject)
            {
                int controller = npc.ControllerObject.GetId();
                int controlled = npc.GetId();
                CharacterInfo.ReleaseControlObject(npc.ControllerObject, npc);

                Msg_RC_ControlObject builder = DataSyncUtility.BuildControlObjectMessage(controller, controlled, false);
                NotifyAllUser(builder);
            }
        }
        private void OnNpcImpact(NpcInfo npc, int impactId)
        {
            Scene scene = npc.SceneContext.CustomData as Scene;

            if (null != scene)
            {
                Msg_CRC_SendImpactToEntity sendImpactBuilder = new Msg_CRC_SendImpactToEntity();
                sendImpactBuilder.duration   = -1;
                sendImpactBuilder.impact_id  = impactId;
                sendImpactBuilder.sender_dir = npc.GetMovementStateInfo().GetFaceDir();
                sendImpactBuilder.sender_id  = npc.GetId();
                Vector3 pos = npc.GetMovementStateInfo().GetPosition3D();
                sendImpactBuilder.sender_pos   = new Position3D();
                sendImpactBuilder.sender_pos.x = pos.X;
                sendImpactBuilder.sender_pos.y = pos.Y;
                sendImpactBuilder.sender_pos.z = pos.Z;
                sendImpactBuilder.skill_id     = -1;
                sendImpactBuilder.target_id    = npc.GetId();
                scene.NotifyAreaUser(npc, sendImpactBuilder);
            }
        }
Exemple #12
0
        internal static Msg_RC_NpcEnter BuildNpcEnterMessage(NpcInfo npc)
        {
            Msg_RC_NpcEnter bder = new Msg_RC_NpcEnter();

            bder.npc_id = npc.GetId();
            Vector3 pos = npc.GetMovementStateInfo().GetPosition3D();

            bder.cur_pos_x      = (float)pos.X;
            bder.cur_pos_z      = (float)pos.Z;
            bder.face_direction = (float)npc.GetMovementStateInfo().GetFaceDir();
            return(bder);
        }
Exemple #13
0
 private static bool WayPointArrived(NpcInfo npc, AiData_ForMoveCommand data)
 {
     if (TimeUtility.GetServerMilliseconds() >= data.EstimateFinishTime)
     {
         var     move_info = npc.GetMovementStateInfo();
         Vector3 to        = data.WayPoints[data.Index];
         Vector3 now       = move_info.GetPosition3D();
         float   distance  = Geometry.Distance(now, to);
         DLog._("ai_move", "[{0}]: closest distance({1}) ", npc.GetId(), distance);
         return(true);
     }
     return(false);
 }
Exemple #14
0
        internal static Msg_RC_NpcTarget BuildNpcTargetMessage(NpcInfo npc)
        {
            Msg_RC_NpcTarget npcFaceTargetBuilder = null;
            NpcAiStateInfo   data = npc.GetAiStateInfo();

            if (null != data && data.Target > 0)
            {
                npcFaceTargetBuilder           = new Msg_RC_NpcTarget();
                npcFaceTargetBuilder.npc_id    = npc.GetId();
                npcFaceTargetBuilder.target_id = data.Target;
            }
            return(npcFaceTargetBuilder);
        }
Exemple #15
0
        private void OnSetNpcIdleAnim(NpcInfo npc, List <int> anims)
        {
            NpcView view = EntityManager.Instance.GetNpcViewById(npc.GetId());

            if (null != view)
            {
                List <Animation_Type> idleAnims = new List <Animation_Type>();
                foreach (int animId in anims)
                {
                    idleAnims.Add((Animation_Type)animId);
                }
                view.SetIdleAnim(idleAnims);
            }
        }
Exemple #16
0
 private void NpcSkill(NpcInfo npc, int skillId, CharacterInfo target)
 {
     if (null != npc)
     {
         CharacterView view = EntityManager.Instance.GetCharacterViewById(npc.GetId());
         if (null != view)
         {
             SkillParam param = new SkillParam();
             param.SkillId  = skillId;
             param.TargetId = target.GetId();
             GfxSystem.SendMessage(view.Actor, "MonsterStartSkill", param);
         }
     }
 }
        private void OnNpcSkill(NpcInfo npc, int skillId)
        {
            Scene scene = npc.SceneContext.CustomData as Scene;

            if (null != scene)
            {
                SkillInfo skillInfo = npc.GetSkillStateInfo().GetCurSkillInfo();
                if (null == skillInfo || !skillInfo.IsSkillActivated)
                {
                    SkillInfo curSkillInfo = npc.GetSkillStateInfo().GetSkillInfoById(skillId);
                    if (null != curSkillInfo)
                    {
                        long curTime = TimeUtility.GetServerMilliseconds();
                        if (!curSkillInfo.IsInCd(curTime / 1000.0f))
                        {
                            curSkillInfo.StartTime = curTime / 1000.0f;
                            curSkillInfo.BeginCD();
                            scene.SkillSystem.StartSkill(npc.GetId(), skillId);

                            Msg_RC_NpcSkill skillBuilder = new Msg_RC_NpcSkill();
                            skillBuilder.npc_id   = npc.GetId();
                            skillBuilder.skill_id = skillId;
                            ArkCrossEngineMessage.Position posBuilder1 = new ArkCrossEngineMessage.Position();
                            posBuilder1.x               = npc.GetMovementStateInfo().GetPosition3D().X;
                            posBuilder1.z               = npc.GetMovementStateInfo().GetPosition3D().Z;
                            skillBuilder.stand_pos      = posBuilder1;
                            skillBuilder.face_direction = (float)npc.GetMovementStateInfo().GetFaceDir();

                            LogSystem.Debug("Send Msg_RC_NpcSkill, EntityId={0}, SkillId={1}",
                                            npc.GetId(), skillId);
                            scene.NotifyAreaUser(npc, skillBuilder);
                        }
                    }
                }
            }
        }
Exemple #18
0
 public void Create(NpcInfo npc)
 {
     Init();
     if (null != npc)
     {
         m_Npc = npc;
         m_Npc.OnBeginAttack = ResetShootAnimation;
         MovementStateInfo msi = m_Npc.GetMovementStateInfo();
         Vector3           pos = msi.GetPosition3D();
         float             dir = msi.GetFaceDir();
         CreateActor(m_Npc.GetId(), m_Npc.GetModel(), pos, dir, m_Npc.Scale);
         InitAnimationSets();
         UpdateWeaponModel(m_Npc);
     }
 }
Exemple #19
0
        public void CreateNpcWithPos(int unitId, float x, float y, float z, float rotateAngle)
        {
            Data_Unit mapUnit = GetCurScene().StaticData.ExtractData(DataMap_Type.DT_Unit, unitId) as Data_Unit;

            if (null != mapUnit)
            {
                mapUnit.m_Pos      = new Vector3(x, y, z);
                mapUnit.m_RotAngle = rotateAngle;
                NpcInfo npc = m_NpcMgr.AddNpc(mapUnit);
                if (null != npc)
                {
                    EntityManager.Instance.CreateNpcView(npc.GetId());
                }
            }
        }
 private void TickDebugSpaceInfo()
 {
     if (GlobalVariables.Instance.IsDebug)
     {
         bool needDebug = false;
         foreach (User user in m_Room.RoomUsers)
         {
             if (user.IsDebug)
             {
                 needDebug = true;
                 break;
             }
         }
         if (needDebug)
         {
             Msg_RC_DebugSpaceInfo builder = new Msg_RC_DebugSpaceInfo();
             for (LinkedListNode <UserInfo> linkNode = UserManager.Users.FirstValue; null != linkNode; linkNode = linkNode.Next)
             {
                 UserInfo info = linkNode.Value;
                 Msg_RC_DebugSpaceInfo.DebugSpaceInfo infoBuilder = new Msg_RC_DebugSpaceInfo.DebugSpaceInfo();
                 infoBuilder.obj_id    = info.GetId();
                 infoBuilder.is_player = true;
                 infoBuilder.pos_x     = (float)info.GetMovementStateInfo().GetPosition3D().X;
                 infoBuilder.pos_z     = (float)info.GetMovementStateInfo().GetPosition3D().Z;
                 infoBuilder.face_dir  = (float)info.GetMovementStateInfo().GetFaceDir();
                 builder.space_infos.Add(infoBuilder);
             }
             for (LinkedListNode <NpcInfo> linkNode = NpcManager.Npcs.FirstValue; null != linkNode; linkNode = linkNode.Next)
             {
                 NpcInfo info = linkNode.Value;
                 Msg_RC_DebugSpaceInfo.DebugSpaceInfo infoBuilder = new Msg_RC_DebugSpaceInfo.DebugSpaceInfo();
                 infoBuilder.obj_id    = info.GetId();
                 infoBuilder.is_player = false;
                 infoBuilder.pos_x     = (float)info.GetMovementStateInfo().GetPosition3D().X;
                 infoBuilder.pos_z     = (float)info.GetMovementStateInfo().GetPosition3D().Z;
                 infoBuilder.face_dir  = (float)info.GetMovementStateInfo().GetFaceDir();
                 builder.space_infos.Add(infoBuilder);
             }
             foreach (User user in m_Room.RoomUsers)
             {
                 if (user.IsDebug)
                 {
                     user.SendMessage(builder);
                 }
             }
         }
     }
 }
Exemple #21
0
 private void RecycleNpcInfo(NpcInfo npcInfo)
 {
     if (null != npcInfo)
     {
         int id = npcInfo.GetId();
         if (id >= c_StartId && id < c_StartId + c_MaxIdNum)
         {
             m_UnusedIds.Push(id);
         }
         if (m_UnusedNpcs.Count < m_NpcPoolSize)
         {
             npcInfo.Reset();
             m_UnusedNpcs.Enqueue(npcInfo);
         }
     }
 }
Exemple #22
0
        internal static Msg_RC_DropNpc BuildDropNpcMessage(NpcInfo npc, int fromNpcId, int dropType, int dropNum, string model)
        {
            Msg_RC_DropNpc bder = new Msg_RC_DropNpc();

            bder.npc_id      = npc.GetId();
            bder.link_id     = npc.GetLinkId();
            bder.owner_id    = npc.OwnerId;
            bder.from_npc_id = fromNpcId;
            bder.drop_type   = dropType;
            bder.drop_num    = dropNum;
            bder.camp_id     = npc.GetCampId();
            if (!String.IsNullOrEmpty(model))
            {
                bder.model = model;
            }
            return(bder);
        }
Exemple #23
0
        public void StartGame()
        {
            UserInfo user = GetPlayerSelf();

            if (null != user)
            {
                EntityManager.Instance.DestroyUserView(user.GetId());
                DestroyCharacterById(user.GetId());
            }
            user = CreatePlayerSelf(1, NetworkSystem.Instance.HeroId);
            user.SetCampId(NetworkSystem.Instance.CampId);
            Data_Unit unit = m_CurScene.StaticData.ExtractData(DataMap_Type.DT_Unit, GlobalVariables.GetUnitIdByCampId(NetworkSystem.Instance.CampId)) as Data_Unit;

            if (null != unit)
            {
                user.GetMovementStateInfo().SetPosition(unit.m_Pos);
                user.GetMovementStateInfo().SetFaceDir(unit.m_RotAngle);
                user.SetHp(Operate_Type.OT_Absolute, user.GetActualProperty().HpMax);
            }
            EntityManager.Instance.CreatePlayerSelfView(1);
            UserView view = EntityManager.Instance.GetUserViewById(1);

            if (null != view)
            {
                view.Visible = true;
            }

            foreach (Data_Unit npcUnit in m_CurScene.StaticData.m_UnitMgr.GetData().Values)
            {
                if (npcUnit.m_IsEnable)
                {
                    NpcInfo npc = m_NpcMgr.GetNpcInfoByUnitId(npcUnit.GetId());
                    if (null == npc)
                    {
                        npc = m_NpcMgr.AddNpc(npcUnit);
                    }
                    if (null != npc)
                    {
                        EntityManager.Instance.CreateNpcView(npc.GetId());
                    }
                }
            }
            GfxSystem.PublishGfxEvent("ge_on_game_start", "story");
            LogSystem.Debug("start game");
        }
Exemple #24
0
 public void ReloadNpc()
 {
     foreach (Data_Unit npcUnit in m_CurScene.StaticData.m_UnitMgr.GetData().Values)
     {
         if (npcUnit.m_IsEnable)
         {
             NpcInfo npc = m_NpcMgr.GetNpcInfoByUnitId(npcUnit.GetId());
             if (null == npc)
             {
                 npc = m_NpcMgr.AddNpc(npcUnit);
             }
             if (null != npc)
             {
                 EntityManager.Instance.CreateNpcView(npc.GetId());
             }
         }
     }
 }
Exemple #25
0
 private void CreateNpcByStory(int unitIdFrom, int unitIdTo)
 {
     LogSystem.Debug("start = {0}, to = {1}", unitIdFrom, unitIdTo);
     for (int i = unitIdFrom; i <= unitIdTo; i++)
     {
         Data_Unit mapUnit = GetCurScene().StaticData.ExtractData(DataMap_Type.DT_Unit, i) as Data_Unit;
         if (null == mapUnit)
         {
             LogSystem.Debug("i = {0}", i);
         }
         if (null != mapUnit)
         {
             NpcInfo npc = m_NpcMgr.AddNpc(mapUnit);
             if (null != npc)
             {
                 EntityManager.Instance.CreateNpcView(npc.GetId());
             }
         }
     }
 }
Exemple #26
0
        public NpcInfo AddNpc(int id, Data_Unit unit)
        {
            NpcInfo npc = NewNpcInfo(id);

            npc.SceneContext = m_SceneContext;
            npc.LoadData(unit);
            npc.IsBorning = true;
            npc.SetAIEnable(false);
            npc.SetStateFlag(Operate_Type.OT_AddBit, CharacterState_Type.CST_Invincible);
            npc.BornTime = TimeUtility.GetServerMilliseconds();
            m_Npcs.Add(npc.GetId(), npc);
            if (null != m_SceneContext && null != m_SceneContext.SpatialSystem)
            {
                m_SceneContext.SpatialSystem.AddObj(npc.SpaceObject);
            }
            if (null != m_SceneContext && null != m_SceneContext.SightManager)
            {
                m_SceneContext.SightManager.AddObject(npc);
            }
            return(npc);
        }
Exemple #27
0
        private void CalcKillIncome(NpcInfo npc)
        {
            if (null == npc)
            {
                return;
            }
            UpdateKillCount(npc);
            //死亡掉落
            UserInfo userKiller = UserManager.GetUserInfo(npc.KillerId);

            if (null != userKiller && m_DropMoneyData.ContainsKey(npc.GetUnitId()) && m_DropMoneyData[npc.GetUnitId()] > 0)
            {
                DelayActionProcessor.QueueAction(DropNpc,
                                                 0,
                                                 npc.GetId(),
                                                 DropOutType.GOLD,
                                                 m_SceneDropOut.m_GoldModel,
                                                 m_SceneDropOut.m_GoldParticle,
                                                 m_DropMoneyData[npc.GetUnitId()]);
            }
        }
        internal void OnSummonNpc(Msg_CRC_SummonNpc msg)
        {
            CharacterInfo char_Info = SceneContext.GetCharacterInfoById(msg.summon_owner_id);

            if (null == char_Info)
            {
                return;
            }
            Data_Unit data = new Data_Unit();

            data.m_IsEnable = true;
            NpcInfo npc = SummonNpc(msg.npc_id, msg.summon_owner_id, msg.owner_skillid,
                                    msg.link_id, msg.model_prefab, msg.skill_id, msg.ai_id, msg.follow_dead,
                                    msg.pos_x, msg.pos_y, msg.pos_z, msg.ai_params);

            if (npc != null)
            {
                npc.OwnerId  = char_Info.OwnerId;
                msg.npc_id   = npc.GetId();
                msg.owner_id = char_Info.OwnerId;
                NotifyAllUser(msg);
            }
        }
        internal void SummonPartner(Msg_CR_SummonPartner msg)
        {
            UserInfo userInfo = UserManager.GetUserInfo(msg.obj_id);

            if (null != userInfo)
            {
                // summonpartner
                PartnerInfo partnerInfo = userInfo.GetPartnerInfo();
                if (null != partnerInfo && (TimeUtility.GetServerMilliseconds() - userInfo.LastSummonPartnerTime > partnerInfo.CoolDown || userInfo.LastSummonPartnerTime == 0))
                {
                    Data_Unit data = new Data_Unit();
                    data.m_Id         = -1;
                    data.m_LinkId     = partnerInfo.LinkId;
                    data.m_CampId     = userInfo.GetCampId();
                    data.m_Pos        = userInfo.GetMovementStateInfo().GetPosition3D();
                    data.m_RotAngle   = 0;
                    data.m_AiLogic    = partnerInfo.GetAiLogic();
                    data.m_AiParam[0] = "";
                    data.m_AiParam[1] = "";
                    data.m_AiParam[2] = partnerInfo.GetAiParam().ToString();
                    data.m_IsEnable   = true;
                    NpcInfo npc = NpcManager.AddNpc(data);
                    if (null != npc)
                    {
                        AppendAttributeConfig aac       = AppendAttributeConfigProvider.Instance.GetDataById(partnerInfo.GetAppendAttrConfigId());
                        float inheritAttackAttrPercent  = partnerInfo.GetInheritAttackAttrPercent();
                        float inheritDefenceAttrPercent = partnerInfo.GetInheritDefenceAttrPercent();
                        if (null != aac)
                        {
                            // attack
                            npc.GetBaseProperty().SetAttackBase(Operate_Type.OT_Absolute, (int)(userInfo.GetActualProperty().AttackBase *inheritAttackAttrPercent));
                            npc.GetBaseProperty().SetFireDamage(Operate_Type.OT_Absolute, userInfo.GetActualProperty().FireDamage *inheritAttackAttrPercent);
                            npc.GetBaseProperty().SetIceDamage(Operate_Type.OT_Absolute, userInfo.GetActualProperty().IceDamage *inheritAttackAttrPercent);
                            npc.GetBaseProperty().SetPoisonDamage(Operate_Type.OT_Absolute, userInfo.GetActualProperty().PoisonDamage *inheritAttackAttrPercent);
                            // defence
                            npc.GetBaseProperty().SetHpMax(Operate_Type.OT_Absolute, (int)(userInfo.GetActualProperty().HpMax *inheritDefenceAttrPercent));
                            npc.GetBaseProperty().SetEnergyMax(Operate_Type.OT_Absolute, (int)(userInfo.GetActualProperty().EnergyMax *inheritDefenceAttrPercent));
                            npc.GetBaseProperty().SetADefenceBase(Operate_Type.OT_Absolute, (int)(userInfo.GetActualProperty().ADefenceBase *inheritDefenceAttrPercent));
                            npc.GetBaseProperty().SetMDefenceBase(Operate_Type.OT_Absolute, (int)(userInfo.GetActualProperty().MDefenceBase *inheritDefenceAttrPercent));
                            npc.GetBaseProperty().SetFireERD(Operate_Type.OT_Absolute, userInfo.GetActualProperty().FireERD *inheritDefenceAttrPercent);
                            npc.GetBaseProperty().SetIceERD(Operate_Type.OT_Absolute, userInfo.GetActualProperty().IceERD *inheritDefenceAttrPercent);
                            npc.GetBaseProperty().SetPoisonERD(Operate_Type.OT_Absolute, userInfo.GetActualProperty().PoisonERD *inheritDefenceAttrPercent);
                            // reset hp & energy
                            npc.SetHp(Operate_Type.OT_Absolute, npc.GetBaseProperty().HpMax);
                            npc.SetEnergy(Operate_Type.OT_Absolute, npc.GetBaseProperty().EnergyMax);
                        }
                        npc.SetAIEnable(true);
                        npc.GetSkillStateInfo().RemoveAllSkill();
                        npc.BornTime = TimeUtility.GetServerMilliseconds();
                        List <int> skillList = partnerInfo.GetSkillList();
                        if (null != skillList)
                        {
                            for (int i = 0; i < skillList.Count; ++i)
                            {
                                SkillInfo skillInfo = new SkillInfo(skillList[i]);
                                npc.GetSkillStateInfo().AddSkill(skillInfo);
                            }
                        }
                        userInfo.LastSummonPartnerTime = TimeUtility.GetServerMilliseconds();
                        npc.OwnerId        = userInfo.GetId();
                        userInfo.PartnerId = npc.GetId();
                        if (partnerInfo.BornSkill > 0)
                        {
                            SkillInfo skillInfo = new SkillInfo(partnerInfo.BornSkill);
                            npc.GetSkillStateInfo().AddSkill(skillInfo);
                        }
                        ArkCrossEngineMessage.Msg_RC_CreateNpc builder = DataSyncUtility.BuildCreateNpcMessage(npc);
                        NotifyAllUser(builder);
                    }
                }
            }
        }
 private void CheckImpact(NpcInfo npc)
 {
     DashFireSpatial.ISpatialSystem spatialSys = npc.SpatialSystem;
     if (null != spatialSys)
     {
         bool existNpcInAttackRange   = false;
         ScriptRuntime.Vector3 srcPos = npc.GetMovementStateInfo().GetPosition3D();
         spatialSys.VisitObjectInCircle(srcPos, npc.GetActualProperty().AttackRange, (float distSqr, ISpaceObject obj) => {
             if (obj.GetObjType() == SpatialObjType.kNPC && (int)obj.GetID() != npc.GetId())
             {
                 NpcInfo npcObj = obj.RealObject as NpcInfo;
                 if (null != npcObj && npcObj.NpcType != (int)NpcTypeEnum.PvpTower)
                 {
                     existNpcInAttackRange = true;
                     return(false);
                 }
             }
             return(true);
         });
         if (existNpcInAttackRange)
         {
             ImpactInfo impactInfo = npc.GetSkillStateInfo().GetImpactInfoById(c_ImpactForTower);
             if (null == impactInfo)
             {
                 ServerNpcImpact(npc, c_ImpactForTower, npc);
             }
         }
     }
 }