Exemplo n.º 1
0
    public FlyingEffect PlayEffect(StateMachineInfo.FlyingEffect effInfo, StateMachineInfo.Effect hitEffect)
    {
        var node = string.IsNullOrEmpty(effInfo.spawnAt) ? transform : Util.FindChild(creature.activeRootNode, effInfo.spawnAt);

        if (!node)
        {
            Logger.LogWarning("CreatureEffects::PlayEffect: Could not play effect [{0}], could not find bind node [{1}]", effInfo.effect, effInfo.spawnAt);
            return(null);
        }

        return(FlyingEffect.Create(effInfo, creature, 0, !creature.isForward, hitEffect, creature.position_, Vector3_.zero, creature.eulerAngles));
    }
Exemplo n.º 2
0
    private double[] HitEffectDamage(StateMachineInfo.FlyingEffect hitfEffect)
    {
        double[] damage = { 0, 0 };
        if (hitfEffect.isEmpty)
        {
            return(damage);
        }

        var hit = ConfigManager.Get <FlyingEffectInfo>(hitfEffect.effect);

        if (hit == null)
        {
            return(damage);
        }

        double[] hitdamage = HitEffectDamage(hit.hitEffect);
        damage[0] += hitdamage[0];
        damage[1] += hitdamage[1];

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

            var attack = AttackInfo.Get(hit.sections[i].attackBox.attackInfo);
            if (attack == null || attack.isIgnoreDamge)
            {
                continue;
            }
            if (attack.execution)
            {
                damage[1] += attack.damage;
                continue;
            }
            damage[0] += attack.damage;
        }

        if (hit.subEffects != null && hit.subEffects.Length > 0)
        {
            double[] sub = SubEffectDamage(hit.subEffects);
            damage[0] += sub[0];
            damage[1] += sub[1];
        }
        return(damage);
    }
Exemplo n.º 3
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);
    }
Exemplo n.º 4
0
    public static FlyingEffect Create(StateMachineInfo.FlyingEffect effInfo, Creature source, int overrideForward, bool invert, StateMachineInfo.Effect hitEffect, Vector3_ root, Vector3_ rootEular, Vector3 rootRot)
    {
        var fe = ConfigManager.Get <FlyingEffectInfo>(effInfo.effect);

        if (!fe)
        {
            Logger.LogWarning("FlyingEffect::Create: Could not create flying effect [{0}], could not find effect config from config_flyingEffectInfos", effInfo.effect);
            return(null);
        }

        FightRecordManager.RecordLog <LogString>(log =>
        {
            log.tag   = (byte)TagType.CreateFlyEffect;
            log.value = fe.effect;
        });

        var off = effInfo.offset * 0.1;

        if (invert)
        {
            off.x = -off.x;
            off.z = -off.z;
        }

        var direction = effInfo.direction;
        var rotation  = effInfo.rotation;

        direction.Set(direction.z, direction.y, -direction.x);
        rotation.Set(-rotation.x, rotation.y, rotation.z);

        var eular = rootEular + direction;

        eular.z = Mathd.ClampAngle(eular.z);

        var z   = Mathd.AngToRad(eular.z);
        var dir = new Vector3_(Mathd.Cos(z), -Mathd.Sin(z));
        var pos = root + off;
        var eff = Create <FlyingEffect>(fe.effect, fe.effect, pos, rotation);

        eff.enableUpdate = true;

        if (invert)
        {
            dir.x = -dir.x;
        }

        eff.sourceBuff = null;
        eff.follow     = false;
        eff.m_inherit  = false;
        eff.m_time     = 0;

        eff.m_originEular = eff.localEulerAngles;
        eff.lockForward   = Vector3.zero;
        eff.startForward  = overrideForward == 0 ? !source || source.isForward : overrideForward > 0;

        eff.m_curSectionIdx     = 0;
        eff.m_curActivedSection = -1;
        eff.m_curSubEffectIdx   = 0;
        eff.m_curSoundEffectIdx = 0;
        eff.m_curShakeIdx       = 0;
        eff.m_groundHited       = false;
        eff.m_renderTime        = 0;

        eff.effectInfo   = fe;
        eff.source       = source;
        eff.position_    = pos;
        eff.velocity     = effInfo.velocity * 0.0001;
        eff.acceleration = effInfo.acceleration * 0.0001;
        eff.lifeTime     = fe.lifeTime;
        eff.hitEffect    = hitEffect;

        eff.CreateCollider(rootRot, dir, eular);

        eff.m_inverted = invert;
        eff.UpdateInvert();

#if AI_LOG
        eff.logId = MonsterCreature.GetMonsterRoomIndex();
        Module_AI.LogBattleMsg(source, "create a flying effect[logId:{0}] with pos {1}, lifeTime = {2}  startForward is {3}", eff.logId, eff.position_, eff.lifeTime, eff.startForward);
#endif
        return(eff);
    }