private void AppendDamage(CharacterInfo sender, CharacterInfo receiver, ImpactInfo impactInfo, int parentDamage)
        {
            if (sender == null || receiver == null || impactInfo == null)
            {
                return;
            }
            int       skillLevel = 0;
            bool      isCritical = false;
            bool      isOrdinary = false;
            SkillInfo skillInfo  = sender.GetSkillStateInfo().GetSkillInfoById(impactInfo.m_SkillId);

            if (null != skillInfo)
            {
                skillLevel = skillInfo.SkillLevel;
                if (skillInfo.Category == SkillCategory.kAttack)
                {
                    isOrdinary = true;
                }
            }
            ElementDamageType element_type = (ElementDamageType)impactInfo.ConfigData.ElementType;

            if (ElementDamageType.DC_None == element_type)
            {
                element_type = sender.GetEquipmentStateInfo().WeaponDamageType;
            }
            int appendDamage = (int)(impactInfo.ConfigData.DamageRate * parentDamage + impactInfo.ConfigData.DamageValue);

            if (appendDamage <= 0)
            {
                return;
            }
            int curDamage = DamageCalculator.CalcImpactDamage(sender, receiver,
                                                              (SkillDamageType)impactInfo.ConfigData.DamageType,
                                                              element_type,
                                                              0,
                                                              appendDamage,
                                                              out isCritical);
            List <ImpactInfo> impactInfos = receiver.GetSkillStateInfo().GetAllImpact();

            for (int i = 0; i < impactInfos.Count; i++)
            {
                IImpactLogic logic = ImpactLogicManager.Instance.GetImpactLogic(impactInfos[i].ConfigData.ImpactLogicId);
                if (null != logic)
                {
                    curDamage = logic.RefixHpDamage(receiver, impactInfos[i].m_ImpactId, curDamage, sender.GetId(), ref isCritical, receiver.GetId());
                }
            }

            /*
             * foreach (ImpactInfo ii in receiver.GetSkillStateInfo().GetAllImpact()) {
             * IImpactLogic logic = ImpactLogicManager.Instance.GetImpactLogic(ii.ConfigData.ImpactLogicId);
             * if (null != logic) {
             *  curDamage = logic.RefixHpDamage(receiver, ii.m_ImpactId, curDamage, sender.GetId(), ref isCritical, receiver.GetId());
             * }
             * }*/
            OnCharacterDamage(sender, receiver, curDamage, isCritical, isOrdinary);
        }
        public override int RefixHpDamage(CharacterInfo obj, int impactId, int hpDamage, int senderId, ref bool isCritical, int impactOwnerId)
        {
            if (obj == null)
            {
                return(hpDamage);
            }
            if (impactOwnerId != senderId)
            {
                return(hpDamage);
            }
            UserInfo sender = obj.SceneContext.GetCharacterInfoById(senderId) as UserInfo;

            if (sender == null)
            {
                return(hpDamage);
            }
            CombatStatisticInfo combat_info = sender.GetCombatStatisticInfo();

            if (combat_info == null)
            {
                return(hpDamage);
            }
            ImpactInfo impactinfo = sender.GetSkillStateInfo().GetImpactInfoById(impactId);

            if (impactinfo == null || impactinfo.ConfigData.ExtraParams.Count < 1)
            {
                return(hpDamage);
            }
            int    triggerCount = 0;
            string effect       = "";
            string mountPoint   = "";

            try
            {
                if (impactinfo.ConfigData.ExtraParams.Count > 4)
                {
                    triggerCount = int.Parse(impactinfo.ConfigData.ExtraParams[0]);
                    effect       = impactinfo.ConfigData.ExtraParams[2];
                    mountPoint   = impactinfo.ConfigData.ExtraParams[3];
                    if (combat_info.MultiHitCount != 0 && combat_info.MultiHitCount % triggerCount == 0)
                    {
                        AppendDamage(sender, obj, impactinfo, hpDamage);
                        AppendImpact(sender, obj, impactinfo);
                    }
                    if (!String.IsNullOrEmpty(effect) && !String.IsNullOrEmpty(mountPoint))
                    {
                        EventImpactLogicEffect(obj, effect, mountPoint, 2.0f);
                    }
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error("parse append damage param error:\n" + ex.Message + "\n" + ex.StackTrace);
            }
            return(hpDamage);
        }
        private void UpdateRecoverInfo(ImpactInfo impactInfo, int hit_count, long hit_count_time)
        {
            RecoverInfo info = impactInfo.LogicDatas.GetData <RecoverInfo>();

            if (info == null)
            {
                info = new RecoverInfo();
                impactInfo.LogicDatas.AddData <RecoverInfo>(info);
            }
            info.LastRecoverTime     = hit_count_time;
            info.LastRecoverHitCount = hit_count;
        }
Esempio n. 4
0
        public void RemoveImpact(int impactId)
        {
            ImpactInfo oriImpact = GetImpactInfoById(impactId);

            if (oriImpact != null)
            {
                if ((int)ImpactType.BUFF == oriImpact.m_ImpactType)
                {
                    m_BuffChanged = true;
                }
                m_ImpactList.Remove(oriImpact);
            }
        }
Esempio n. 5
0
        public virtual void Tick(CharacterInfo obj, int impactId)
        {
            ImpactInfo impactInfo = obj.GetSkillStateInfo().GetImpactInfoById(impactId);

            if (null != impactInfo && impactInfo.m_IsActivated)
            {
                long curTime = TimeUtility.GetServerMilliseconds();
                if (curTime > impactInfo.m_StartTime + impactInfo.m_ImpactDuration)
                {
                    impactInfo.m_IsActivated = false;
                }
            }
        }
        private void Recover(CharacterInfo sender, ImpactInfo impactInfo, int hit_count, long hit_count_time)
        {
            if (impactInfo.ConfigData.ExtraParams.Count < 4)
            {
                return;
            }
            string add_attribute = "HP";
            float  add_max_ratio = 0;
            int    add_value     = 0;

            try
            {
                add_attribute = impactInfo.ConfigData.ExtraParams[1];
                add_max_ratio = float.Parse(impactInfo.ConfigData.ExtraParams[2]);
                add_value     = int.Parse(impactInfo.ConfigData.ExtraParams[3]);
            }
            catch (Exception ex)
            {
                LogSystem.Error("parse recover param error:\n" + ex.Message);
            }
            if (!IsNewHitRecoverCount(sender, impactInfo, hit_count, hit_count_time))
            {
                return;
            }
            if (add_attribute.Equals("HP"))
            {
                int sould_add = (int)(sender.GetActualProperty().HpMax *add_max_ratio) + add_value;
                int final_add = sould_add;
                if (sender.Hp + final_add > sender.GetActualProperty().HpMax)
                {
                    final_add = sender.GetActualProperty().HpMax - sender.Hp;
                }
                sender.SetHp(Operate_Type.OT_Relative, final_add);
                UpdateRecoverInfo(impactInfo, hit_count, hit_count_time);
                if (EventImpactHitRecover != null)
                {
                    EventImpactHitRecover(sender, "HP", sould_add);
                }
                //LogSystem.Debug("----hit recover set hp {0}/{1}", sender.Hp, sender.GetActualProperty().HpMax);
            }
            else if (add_attribute.Equals("MP"))
            {
                int final_add = (int)(sender.GetActualProperty().EnergyMax *add_max_ratio) + add_value;
                sender.SetEnergy(Operate_Type.OT_Relative, final_add);
                UpdateRecoverInfo(impactInfo, hit_count, hit_count_time);
                if (EventImpactHitRecover != null)
                {
                    EventImpactHitRecover(sender, "MP", final_add);
                }
            }
        }
Esempio n. 7
0
        public bool IsImpactControl()
        {
            int ct = m_ImpactList.Count;

            for (int i = ct - 1; i >= 0; --i)
            {
                ImpactInfo info = m_ImpactList[i];
                if (info.m_IsGfxControl)
                {
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 8
0
        public bool IsImpactActive()
        {
            int ct = m_ImpactList.Count;

            for (int i = ct - 1; i >= 0; --i)
            {
                ImpactInfo info = m_ImpactList[i];
                if (info.m_IsActivated && info.m_ImpactType != (int)ImpactType.PASSIVE)
                {
                    return(true);
                }
            }
            return(false);
        }
        private bool IsNewHitRecoverCount(CharacterInfo sender, ImpactInfo impactInfo, int hit_count, long hit_count_time)
        {
            RecoverInfo info = impactInfo.LogicDatas.GetData <RecoverInfo>();

            if (info == null)
            {
                return(true);
            }
            if (info.LastRecoverHitCount == hit_count && info.LastRecoverTime == hit_count_time)
            {
                return(false);
            }
            return(true);
        }
Esempio n. 10
0
        public bool IsImpactControlTarget(CharacterInfo target)
        {
            List <ImpactInfo> impactInfos = target.GetSkillStateInfo().GetAllImpact();
            int ct = impactInfos.Count;

            for (int i = ct - 1; i >= 0; --i)
            {
                ImpactInfo info = impactInfos[i];
                if (info.m_IsGfxControl)
                {
                    return(true);
                }
            }
            return(false);
        }
        public override int RefixHpDamage(CharacterInfo obj, int impactId, int hpDamage, int senderId, ref bool isCritical, int impactOwnerId)
        {
            if (obj == null)
            {
                return(hpDamage);
            }
            if (senderId != impactOwnerId)
            {
                return(hpDamage);
            }
            UserInfo sender = obj.SceneContext.GetCharacterInfoById(senderId) as UserInfo;

            if (sender == null)
            {
                return(hpDamage);
            }
            CombatStatisticInfo combat_info = sender.GetCombatStatisticInfo();

            if (combat_info == null)
            {
                return(hpDamage);
            }
            ImpactInfo impactinfo = sender.GetSkillStateInfo().GetImpactInfoById(impactId);

            if (impactinfo == null || impactinfo.ConfigData.ExtraParams.Count < 1)
            {
                return(hpDamage);
            }
            int criticalCount = 0;

            try
            {
                criticalCount = int.Parse(impactinfo.ConfigData.ExtraParams[0]);
                if (combat_info.MultiHitCount != 0 && combat_info.MultiHitCount % criticalCount == 0)
                {
                    if (!isCritical)
                    {
                        hpDamage   = (int)(hpDamage * sender.GetActualProperty().CriticalPow);
                        isCritical = true;
                    }
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error("parse HitCriticalTrigger param error:\n" + ex.Message);
            }
            return(hpDamage);
        }
Esempio n. 12
0
        private bool StopImpactImpl(CharacterInfo target, int impactId)
        {
            ImpactInfo impactInfo = target.GetSkillStateInfo().GetImpactInfoById(impactId);

            if (null != impactInfo)
            {
                IImpactLogic logic = ImpactLogicManager.Instance.GetImpactLogic(impactInfo.ConfigData.ImpactLogicId);
                if (null != logic && logic.CanInterrupt(target, impactId))
                {
                    logic.OnInterrupted(target, impactId);
                    impactInfo.m_IsActivated = false;
                    return(true);
                }
            }
            return(false);
        }
        public override void Tick(CharacterInfo character, int impactId)
        {
            ImpactInfo impactInfo = character.GetSkillStateInfo().GetImpactInfoById(impactId);

            if (null != impactInfo)
            {
                if (impactInfo.m_IsActivated)
                {
                    if (TimeUtility.GetServerMilliseconds() > impactInfo.m_StartTime + impactInfo.m_ImpactDuration)
                    {
                        StopImpact(character, impactId);
                    }
                }
            }
            ;
        }
Esempio n. 14
0
 public void OnGfxStopImpact(CharacterInfo target, int impactId)
 {
     if (null != target)
     {
         ImpactInfo impactInfo = target.GetSkillStateInfo().GetImpactInfoById(impactId);
         if (null != impactInfo)
         {
             impactInfo.m_IsGfxControl = false;
             CharacterInfo sender = target.SceneContext.GetCharacterInfoById(impactInfo.m_ImpactSenderId);
             if (null != EventGfxStopImpact)
             {
                 EventGfxStopImpact(sender, target.GetId(), impactId);
             }
         }
     }
 }
 public override void StartImpact(CharacterInfo obj, int impactId)
 {
     if (null != obj)
     {
         ImpactInfo impactInfo = obj.GetSkillStateInfo().GetImpactInfoById(impactId);
         if (impactInfo.ConfigData.ParamNum > 1)
         {
             if (!String.IsNullOrEmpty(impactInfo.ConfigData.ExtraParams[0]) && !String.IsNullOrEmpty(impactInfo.ConfigData.ExtraParams[1]))
             {
                 int targetLogicId = int.Parse(impactInfo.ConfigData.ExtraParams[0]);
                 int removeType    = int.Parse(impactInfo.ConfigData.ExtraParams[1]);
                 RemoveImpact(obj, targetLogicId, (RemoveType)removeType);
             }
         }
     }
 }
Esempio n. 16
0
 protected void ApplyDamage(CharacterInfo obj, int impactId, out int damage)
 {
     damage = 0;
     if (null != obj && !obj.IsDead())
     {
         if (GlobalVariables.Instance.IsClient && obj.SceneContext.IsRunWithRoomServer)
         {
             return;
         }
         ImpactInfo impactInfo = obj.GetSkillStateInfo().GetImpactInfoById(impactId);
         if (null != impactInfo)
         {
             CharacterInfo sender = obj.SceneContext.GetCharacterInfoById(impactInfo.m_ImpactSenderId);
             ApplyDamageImpl(sender, obj, impactInfo, out damage, impactInfo.ConfigData.IsIgnorePassiveCheck);
         }
     }
 }
        public override int RefixHpDamage(CharacterInfo obj, int impactId, int hpDamage, int senderId, ref bool isCritical, int impactOnwerId)
        {
            //LogSystem.Debug("---in hit recover");
            if (obj == null)
            {
                return(hpDamage);
            }
            if (senderId != impactOnwerId)
            {
                return(hpDamage);
            }
            UserInfo sender = obj.SceneContext.GetCharacterInfoById(senderId) as UserInfo;

            if (sender == null)
            {
                return(hpDamage);
            }
            CombatStatisticInfo combat_info = sender.GetCombatStatisticInfo();

            if (combat_info == null)
            {
                return(hpDamage);
            }
            ImpactInfo impactinfo = sender.GetSkillStateInfo().GetImpactInfoById(impactId);

            if (impactinfo == null || impactinfo.ConfigData.ExtraParams.Count < 1)
            {
                return(hpDamage);
            }
            int triggerCount = 0;

            try
            {
                triggerCount = int.Parse(impactinfo.ConfigData.ExtraParams[0]);
                if (combat_info.MultiHitCount != 0 && combat_info.MultiHitCount % triggerCount == 0)
                {
                    Recover(sender, impactinfo, combat_info.MultiHitCount, combat_info.LastHitTime);
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error("parse HitRcover count param error:\n" + ex.Message);
            }
            return(hpDamage);
        }
        public override void StartImpact(CharacterInfo obj, int impactId)
        {
            if (null == obj)
            {
                return;
            }
            ImpactInfo impactInfo = obj.GetSkillStateInfo().GetImpactInfoById(impactId);

            if (impactInfo.ConfigData.ExtraParams.Count < 2)
            {
                return;
            }
            SkillCategory category     = (SkillCategory)(int.Parse(impactInfo.ConfigData.ExtraParams[0]));
            int           head_skillid = int.Parse(impactInfo.ConfigData.ExtraParams[1]);
            SkillInfo     head_skill   = obj.GetSkillStateInfo().GetSkillInfoById(head_skillid);

            if (head_skill == null)
            {
                return;
            }
            ChangeSkillCategory(obj, head_skill.SkillId, category);
            // change category head to new skill
            List <SkillInfo> player_skills = obj.GetSkillStateInfo().GetAllSkill();

            /*
             * foreach (SkillInfo info in player_skills) {
             * player_skill_config.Add(info.ConfigData);
             * }*/
            if (null != obj.SkillController)
            {
                SkillNode new_head = obj.SkillController.InitCategorySkillNode(player_skills, head_skill);
                if (new_head != null)
                {
                    SkillNode old_head = obj.SkillController.ChangeCategorySkill(category, new_head);
                    impactInfo.LogicDatas.AddData <SkillNode>(old_head);
                }
            }
        }
Esempio n. 19
0
 protected bool IsImpactDamageOrdinary(CharacterInfo target, int impactId)
 {
     if (null != target)
     {
         ImpactInfo impactInfo = target.GetSkillStateInfo().GetImpactInfoById(impactId);
         if (null != impactInfo)
         {
             CharacterInfo sender = target.SceneContext.GetCharacterInfoById(impactInfo.m_ImpactSenderId);
             if (null != sender)
             {
                 SkillInfo skillInfo = sender.GetSkillStateInfo().GetSkillInfoById(impactInfo.m_SkillId);
                 if (null != skillInfo)
                 {
                     if (skillInfo.Category == SkillCategory.kAttack)
                     {
                         return(true);
                     }
                 }
             }
         }
     }
     return(false);
 }
Esempio n. 20
0
 public virtual void StartImpact(CharacterInfo obj, int impactId)
 {
     if (null != obj)
     {
         ImpactInfo impactInfo = obj.GetSkillStateInfo().GetImpactInfoById(impactId);
         if (null != impactInfo)
         {
             if (impactInfo.ConfigData.BreakSuperArmor)
             {
                 obj.SuperArmor = false;
             }
         }
         if (obj is NpcInfo)
         {
             NpcInfo        npcObj = obj as NpcInfo;
             NpcAiStateInfo aiInfo = npcObj.GetAiStateInfo();
             if (null != aiInfo && 0 == aiInfo.HateTarget)
             {
                 aiInfo.HateTarget = impactInfo.m_ImpactSenderId;
             }
         }
     }
 }
        public override void StopImpact(CharacterInfo obj, int impactId)
        {
            ImpactInfo impactInfo = obj.GetSkillStateInfo().GetImpactInfoById(impactId);

            if (impactInfo == null)
            {
                return;
            }
            if (impactInfo.ConfigData.ExtraParams.Count < 2)
            {
                return;
            }
            SkillCategory category     = (SkillCategory)(int.Parse(impactInfo.ConfigData.ExtraParams[0]));
            int           head_skillid = int.Parse(impactInfo.ConfigData.ExtraParams[1]);
            //change category skill back
            SkillNode old_head = impactInfo.LogicDatas.GetData <SkillNode>();

            if (old_head != null && null != obj.SkillController)
            {
                SkillNode head = obj.SkillController.ChangeCategorySkill(category, old_head);
                ChangeSkillCategory(obj, head_skillid, SkillCategory.kNone);
            }
            impactInfo.m_IsActivated = false;
        }
Esempio n. 22
0
        public void Tick(CharacterInfo obj)
        {
            List <ImpactInfo> impactInfos = obj.GetSkillStateInfo().GetAllImpact();
            int ct = impactInfos.Count;

            for (int i = ct - 1; i >= 0; --i)
            {
                ImpactInfo   info  = impactInfos[i];
                IImpactLogic logic = ImpactLogicManager.Instance.GetImpactLogic(info.ConfigData.ImpactLogicId);
                if (info.m_IsActivated)
                {
                    if (null != logic)
                    {
                        logic.Tick(obj, info.m_ImpactId);
                    }
                }
                else
                {
                    logic.OnInterrupted(obj, info.m_ImpactId);
                    obj.GetSkillStateInfo().RemoveImpact(info.m_ImpactId);
                }
            }
            obj.GetSkillStateInfo().CleanupImpactInfoForCheck(TimeUtility.GetServerMilliseconds(), 5000);//用于校验的impact比正常时间晚5秒清除
        }
Esempio n. 23
0
        private bool SendImpactImpl(CharacterInfo sender, int impactId, int targetId, int skillId, int duration)
        {
            //LogSystem.Debug("character {0} send impact {1} to character {2}", sender.GetId(), impactId, targetId);
            if (null != sender)
            {
                CharacterInfo target = sender.SceneContext.GetCharacterInfoById(targetId);
                if (null != target)
                {
                    if (target.IsUser && target.IsDead())
                    {
                        return(false);
                    }
                    if (target.IsNpc && target.IsDead())
                    {
                        NpcInfo npc = target.CastNpcInfo();
                        if ((int)NpcTypeEnum.SceneObject == npc.NpcType)
                        {
                            return(false);
                        }
                    }
                    ImpactLogicData impactLogicData = SkillConfigProvider.Instance.ExtractData(SkillConfigType.SCT_IMPACT, impactId) as ImpactLogicData;
                    if (null != impactLogicData)
                    {
                        IImpactLogic logic = ImpactLogicManager.Instance.GetImpactLogic(impactLogicData.ImpactLogicId);
                        if (null != logic)
                        {
                            ImpactInfo oldImpactInfo = target.GetSkillStateInfo().GetImpactInfoById(impactId);
                            if (null != oldImpactInfo)
                            {
                                logic.OnInterrupted(target, impactId);
                                target.GetSkillStateInfo().RemoveImpact(impactId);
                            }
                            ImpactInfo impactInfo = new ImpactInfo();
                            impactInfo.m_IsActivated    = true;
                            impactInfo.m_SkillId        = skillId;
                            impactInfo.m_ImpactId       = impactLogicData.ImpactId;
                            impactInfo.m_ImpactType     = impactLogicData.ImpactType;
                            impactInfo.m_BuffDataId     = impactLogicData.BuffDataId;
                            impactInfo.ConfigData       = impactLogicData;
                            impactInfo.m_StartTime      = TimeUtility.GetServerMilliseconds();
                            impactInfo.m_ImpactDuration = impactLogicData.ImpactTime;
                            if (-1 == duration || duration > impactLogicData.ImpactTime)
                            {
                                impactInfo.m_ImpactDuration = impactLogicData.ImpactTime;
                            }
                            else
                            {
                                impactInfo.m_ImpactDuration = duration;
                            }
                            impactInfo.m_HasEffectApplyed = false;
                            if (0 == impactInfo.ConfigData.ImpactGfxLogicId)
                            {
                                impactInfo.m_IsGfxControl = false;
                            }
                            else
                            {
                                impactInfo.m_IsGfxControl = true;
                            }
                            impactInfo.m_ImpactSenderId  = sender.GetId();
                            impactInfo.m_MaxMoveDistance = impactLogicData.CalcMaxMoveDistance();
                            if (impactLogicData.ImpactGfxLogicId == 0)
                            {
                                impactInfo.m_LeftEnableMoveCount = 0;//禁止位移
                            }
                            else
                            {
                                impactInfo.m_LeftEnableMoveCount = 1;//允许位移
                            }

                            //LogSystem.Warn("impact {0} EnableMoveCount {1} MaxMoveDistanceSqr {2}", impactId, impactInfo.m_LeftEnableMoveCount, impactInfo.m_MaxMoveDistanceSqr);

                            target.GetSkillStateInfo().AddImpact(impactInfo);
                            logic.StartImpact(target, impactId);

                            if ((int)ImpactType.INSTANT == impactInfo.m_ImpactType)
                            {
                                impactInfo.m_IsActivated = false;
                            }
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
Esempio n. 24
0
        protected void ApplyDamageImpl(CharacterInfo sender, CharacterInfo obj, ImpactInfo impactInfo, out int damage, bool is_ignore_passive_check = false)
        {
            damage = 0;
            int  skillLevel = 0;
            bool isCritical = false;
            bool isOrdinary = false;

            if (null != sender)
            {
                SkillInfo skillInfo = sender.GetSkillStateInfo().GetSkillInfoById(impactInfo.m_SkillId);
                if (null != skillInfo)
                {
                    skillLevel = skillInfo.SkillLevel;
                    if (skillInfo.Category == SkillCategory.kAttack)
                    {
                        isOrdinary = true;
                    }
                }
                float old_critical = 0;
                bool  is_adjusted  = AdjustCritical(sender, out old_critical);
                int   curDamage    = DamageCalculator.CalcImpactDamage(
                    sender,
                    obj,
                    (SkillDamageType)impactInfo.ConfigData.DamageType,
                    ElementDamageType.DC_None == (ElementDamageType)impactInfo.ConfigData.ElementType ? sender.GetEquipmentStateInfo().WeaponDamageType : (ElementDamageType)impactInfo.ConfigData.ElementType,
                    impactInfo.ConfigData.DamageRate + skillLevel * impactInfo.ConfigData.LevelRate,
                    impactInfo.ConfigData.DamageValue,
                    out isCritical);
                if (is_adjusted)
                {
                    //LogSystem.Error("----critical: reset critical to {0}", old_critical);
                    sender.GetActualProperty().SetCritical(Operate_Type.OT_Absolute, old_critical);
                }
                curDamage = TalentAdjustDamage(sender, obj, curDamage);
                List <ImpactInfo> targetImpactInfos = obj.GetSkillStateInfo().GetAllImpact();
                for (int i = 0; i < targetImpactInfos.Count; i++)
                {
                    if (is_ignore_passive_check && targetImpactInfos[i].m_ImpactType == (int)ImpactType.PASSIVE)
                    {
                        continue;
                    }
                    IImpactLogic logic = ImpactLogicManager.Instance.GetImpactLogic(obj.GetSkillStateInfo().GetAllImpact()[i].ConfigData.ImpactLogicId);
                    if (null != logic)
                    {
                        curDamage = logic.RefixHpDamage(obj, targetImpactInfos[i].m_ImpactId, curDamage, sender.GetId(), ref isCritical, obj.GetId());
                    }
                }

                /*
                 * foreach (ImpactInfo ii in obj.GetSkillStateInfo().GetAllImpact()) {
                 * if (is_ignore_passive_check && ii.m_ImpactType == (int)ImpactType.PASSIVE) {
                 *  continue;
                 * }
                 * IImpactLogic logic = ImpactLogicManager.Instance.GetImpactLogic(ii.ConfigData.ImpactLogicId);
                 * if (null != logic) {
                 *  curDamage = logic.RefixHpDamage(obj, ii.m_ImpactId, curDamage, sender.GetId(), ref isCritical, obj.GetId());
                 * }
                 * }*/
                if (!is_ignore_passive_check)
                {
                    List <ImpactInfo> senderImpactInfos = sender.GetSkillStateInfo().GetAllImpact();
                    for (int i = 0; i < senderImpactInfos.Count; i++)
                    {
                        if (senderImpactInfos[i].m_ImpactType == (int)ImpactType.PASSIVE)
                        {
                            IImpactLogic logic = ImpactLogicManager.Instance.GetImpactLogic(senderImpactInfos[i].ConfigData.ImpactLogicId);
                            if (null != logic)
                            {
                                curDamage = logic.RefixHpDamage(obj, senderImpactInfos[i].m_ImpactId, curDamage, sender.GetId(), ref isCritical, sender.GetId());
                            }
                        }
                    }

                    /*
                     * foreach (ImpactInfo passive_impact in sender.GetSkillStateInfo().GetAllImpact()) {
                     * if (passive_impact.m_ImpactType == (int)ImpactType.PASSIVE) {
                     *  IImpactLogic logic = ImpactLogicManager.Instance.GetImpactLogic(passive_impact.ConfigData.ImpactLogicId);
                     *  if (null != logic) {
                     *    curDamage = logic.RefixHpDamage(obj, passive_impact.m_ImpactId, curDamage, sender.GetId(), ref isCritical, sender.GetId());
                     *  }
                     * }
                     * }*/
                }
                damage = curDamage;
                OnCharacterDamage(sender, obj, curDamage, isCritical, isOrdinary);
            }
        }
Esempio n. 25
0
        public void RefreshItemSkills(SendImpactToSelfDelegation sendImpactToSelf, StopMyImpactDelegation stopImpact)
        {
            //标记所有物品带的技能与buff
            for (int i = 0; i < GetSkillStateInfo().GetAllSkill().Count; i++)
            {
                if (GetSkillStateInfo().GetAllSkill()[i].IsItemSkill)
                {
                    GetSkillStateInfo().GetAllSkill()[i].IsMarkToRemove = true;
                }
            }
            for (int i = 0; i < GetSkillStateInfo().GetAllImpact().Count; i++)
            {
                if (GetSkillStateInfo().GetAllImpact()[i].m_IsItemImpact)
                {
                    GetSkillStateInfo().GetAllImpact()[i].m_IsMarkToRemove = true;
                }
            }

            /*
             * foreach (SkillInfo info in GetSkillStateInfo().GetAllSkill()) {
             * if (info.IsItemSkill) {
             *  info.IsMarkToRemove = true;
             * }
             * }
             * foreach (ImpactInfo info in GetSkillStateInfo().GetAllImpact()) {
             * if (info.m_IsItemImpact) {
             *  info.m_IsMarkToRemove = true;
             * }
             * }*/
            //刷新物品带的技能与buff
            EquipmentStateInfo equipInfo = GetEquipmentStateInfo();

            for (int ix = 0; ix < EquipmentStateInfo.c_EquipmentCapacity; ++ix)
            {
                ItemDataInfo itemInfo = equipInfo.GetEquipmentData(ix);
                if (null != itemInfo && itemInfo.ItemNum == 1 && null != itemInfo.ItemConfig)
                {
                    ItemConfig cfg = itemInfo.ItemConfig;
                    if (null != cfg.m_AddSkillOnEquiping)
                    {
                        for (int i = 0; i < cfg.m_AddSkillOnEquiping.Length; i++)
                        {
                            SkillInfo skillInfo = GetSkillStateInfo().GetSkillInfoById(cfg.m_AddSkillOnEquiping[i]);
                            if (null == skillInfo)
                            {
                                skillInfo                = new SkillInfo(cfg.m_AddSkillOnEquiping[i]);
                                skillInfo.IsItemSkill    = true;
                                skillInfo.IsMarkToRemove = false;
                                GetSkillStateInfo().AddSkill(skillInfo);
                            }
                            else
                            {
                                skillInfo.IsMarkToRemove = false;
                            }
                        }

                        /*
                         * foreach (int id in cfg.m_AddSkillOnEquiping) {
                         * SkillInfo skillInfo = GetSkillStateInfo().GetSkillInfoById(id);
                         * if (null == skillInfo) {
                         *  skillInfo = new SkillInfo(id);
                         *  skillInfo.IsItemSkill = true;
                         *  skillInfo.IsMarkToRemove = false;
                         *  GetSkillStateInfo().AddSkill(skillInfo);
                         * } else {
                         *  skillInfo.IsMarkToRemove = false;
                         * }
                         * }*/
                    }
                    if (null != cfg.m_AddBuffOnEquiping && null != sendImpactToSelf)
                    {
                        //此分支为服务器端处理,参数为加impact的回调,这个回调里包括加impact并发消息给客户端(现在ImpactSystem是这样实现的)
                        for (int i = 0; i < cfg.m_AddBuffOnEquiping.Length; i++)
                        {
                            ImpactInfo impactInfo = GetSkillStateInfo().GetImpactInfoById(cfg.m_AddBuffOnEquiping[i]);
                            if (null == impactInfo)
                            {
                                impactInfo = sendImpactToSelf(cfg.m_AddBuffOnEquiping[i]);
                                if (null != impactInfo)
                                {
                                    impactInfo.m_IsItemImpact   = true;
                                    impactInfo.m_IsMarkToRemove = false;
                                }
                            }
                            else
                            {
                                impactInfo.m_IsMarkToRemove = false;
                            }
                        }

                        /*
                         * foreach (int id in cfg.m_AddBuffOnEquiping) {
                         * ImpactInfo impactInfo = GetSkillStateInfo().GetImpactInfoById(id);
                         * if (null == impactInfo) {
                         *  impactInfo = sendImpactToSelf(id);
                         *  if (null != impactInfo) {
                         *    impactInfo.m_IsItemImpact = true;
                         *    impactInfo.m_IsMarkToRemove = false;
                         *  }
                         * } else {
                         *  impactInfo.m_IsMarkToRemove = false;
                         * }
                         * }*/
                    }
                }
            }
            //移除不再有效的技能与buff
            List <int> removeSkills = new List <int>();

            for (int i = 0; i < GetSkillStateInfo().GetAllSkill().Count; i++)
            {
                if (GetSkillStateInfo().GetAllSkill()[i].IsItemSkill && GetSkillStateInfo().GetAllSkill()[i].IsMarkToRemove)
                {
                    removeSkills.Add(GetSkillStateInfo().GetAllSkill()[i].SkillId);
                }
            }
            for (int i = 0; i < removeSkills.Count; i++)
            {
                GetSkillStateInfo().RemoveSkill(removeSkills[i]);
            }

            /*
             * foreach (SkillInfo info in GetSkillStateInfo().GetAllSkill()) {
             * if (info.IsItemSkill && info.IsMarkToRemove) {
             *  removeSkills.Add(info.SkillId);
             * }
             * }
             * foreach (int id in removeSkills) {
             * GetSkillStateInfo().RemoveSkill(id);
             * }*/
            removeSkills.Clear();

            List <int> removeImpacts = new List <int>();

            for (int i = 0; i < GetSkillStateInfo().GetAllImpact().Count; i++)
            {
                if (GetSkillStateInfo().GetAllImpact()[i].m_IsItemImpact && GetSkillStateInfo().GetAllImpact()[i].m_IsMarkToRemove)
                {
                    removeImpacts.Add(GetSkillStateInfo().GetAllImpact()[i].m_ImpactId);
                }
            }
            for (int i = 0; i < removeImpacts.Count; i++)
            {
                if (null != stopImpact)
                {
                    stopImpact(removeImpacts[i]);
                }
            }

            /*
             * foreach (ImpactInfo info in GetSkillStateInfo().GetAllImpact()) {
             * if (info.m_IsItemImpact && info.m_IsMarkToRemove) {
             *  removeImpacts.Add(info.m_ImpactId);
             * }
             * }
             * foreach (int id in removeImpacts) {
             * if (null != stopImpact)
             *  stopImpact(id);
             * }*/
            removeImpacts.Clear();
        }