예제 #1
0
    public double[] GetCurrentSkillDamge(int skillId, int level)
    {
        double[]        defaultDouble = new double[] { 0, 0 };
        WeaponAttribute attr          = ConfigManager.Get <WeaponAttribute>(moduleEquip.weapon.itemTypeId);

        if (!attr)
        {
            return(defaultDouble);
        }
        SkillToStateInfo states = m_currentSkillStates.Find(p => p.skillId == skillId && (p.elmentType == attr.elementType || p.elmentType == 0));

        if (!states || states.stateNames == null || states.stateNames.Length < 1)
        {
            return(defaultDouble);
        }

        double damage = 0;
        double spcail = 0;
        int    weapon = moduleEquip.weapon.GetPropItem().subType;

        for (int i = 0; i < states.stateNames.Length; i++)
        {
            int stateID = CreatureStateInfo.NameToID(states.stateNames[i]);
            var _state  = StateOverrideInfo.GetOverrideState(weapon, stateID, level);

            //int reliveID = CreatureStateInfo.NameToID(ReLiveState);
            //if (reliveID == stateID)
            //{
            //    reliveSkillId = states.skillId;
            //    if (_state.buffs.Length > 0)
            //    {
            //        defaultDouble[0] = (double)_state.buffs[0].duration / 1000;
            //        return defaultDouble;
            //    }
            //}

            for (int j = 0; j < _state.sections.Length; j++)
            {
                if (_state.sections[j].attackBox.isEmpty)
                {
                    continue;
                }

                var attack = AttackInfo.Get(_state.sections[j].attackBox.attackInfo);
                if (attack == null || attack.isIgnoreDamge)
                {
                    continue;
                }
                if (attack.execution)
                {
                    spcail += attack.damage;
                    continue;
                }
                damage += attack.damage;
            }

            int fly = _state.flyingEffects.Length;
            if (fly > 0)
            {
                for (int k = 0; k < fly; k++)
                {
                    var effect = ConfigManager.Get <FlyingEffectInfo>(_state.flyingEffects[k].effect);
                    if (effect == null)
                    {
                        continue;
                    }

                    //统计hiteffect的伤害,必须满足subeffect中不包含相同的effectid
                    if (!effect.hitEffect.isEmpty)
                    {
                        StateMachineInfo.FlyingEffect exist = StateMachineInfo.FlyingEffect.empty;
                        if (effect.subEffects != null && effect.subEffects.Length > 0)
                        {
                            exist = effect.subEffects.Find(p => p.effect == effect.hitEffect.effect);
                        }

                        if (exist.isEmpty)
                        {
                            double[] hit = HitEffectDamage(effect.hitEffect);
                            damage += hit[0];
                            spcail += hit[1];
                        }
                    }

                    if (effect.subEffects != null && effect.subEffects.Length > 0)
                    {
                        double[] sub = SubEffectDamage(effect.subEffects);
                        damage += sub[0];
                        spcail += sub[1];
                    }

                    for (int p = 0; p < effect.sections.Length; p++)
                    {
                        if (effect.sections[p].attackBox.isEmpty)
                        {
                            continue;
                        }

                        var attack = AttackInfo.Get(effect.sections[p].attackBox.attackInfo);
                        if (attack == null || attack.isIgnoreDamge)
                        {
                            continue;
                        }
                        if (attack.execution)
                        {
                            spcail += attack.damage;
                            continue;
                        }
                        damage += attack.damage;
                    }
                }
            }
        }
        double _d = UpSkillInfo.GetOverrideDamage(skillId, level) * (1 + modulePlayer.GetSkillDamageAddtion(skillId));

        defaultDouble[0] = damage * (1 + _d);
        defaultDouble[1] = spcail * (1 + _d);
        return(defaultDouble);
    }
예제 #2
0
    private bool CreateState(StateMachineInfo.StateDetail s, StateMachineInfo parent)
    {
        if (!s.valid)
        {
            return(false);
        }

        StateMachineState state = null;

        var skillID = SkillToStateInfo.GetSkillID(creature.weaponID, s.ID);

        if (skillID < 0)
        {
            var list = AwakeInfo.GetSkillIDList(s.hash);
            if (list != null && list.Count > 0)
            {
                var ss = new List <StateMachineInfo.StateDetail>();
                foreach (var id in list)
                {
                    var lv = creature.GetSkillLevel(id);
                    if (lv > 0)
                    {
                        var ainfo      = ConfigManager.Get <AwakeInfo>(id);
                        var stateLevel = ainfo?.states.Find(Item => Item.state == s.state);
                        if (stateLevel != null)
                        {
                            lv = stateLevel.level;
                        }
                    }

                    if (lv >= 0)
                    {
                        var os = StateOverrideInfo.GetOriginOverrideState(info, s, lv);
                        if (os != null)
                        {
                            ss.Add(os);
                        }
                    }
                }
                s = StateOverrideInfo.StateOverride.Combin(s, ss);
            }

            if (!s.valid)
            {
                return(false);
            }

            state = StateMachineState.Create(this, parent, s, SkilLEntry.empty);
        }
        else
        {
            var skill = creature.GetSkillEntry(skillID);
            var level = skill.valid ? skill.level : 0;
            var ls    = level <= 0 ? s : StateOverrideInfo.GetOverrideState(info, s, level);

            if (!ls.valid)
            {
                return(false);
            }

            state = StateMachineState.Create(this, parent, ls, skill);
        }

        states.Add(state);

        if (state.passive)
        {
            m_passiveHash.Set(s.ID, states.Count - 1);
        }
        if (s.coolGroup != 0)
        {
            m_coolGroups.GetDefault(s.coolGroup).Add(state);
        }

        return(true);
    }