Ejemplo n.º 1
0
 public static void ActCameraShake(ConfigEntityCameraShake cameraShake)
 {
     if (cameraShake != null)
     {
         bool  hasValue = cameraShake.ShakeAngle.HasValue;
         float angle    = !cameraShake.ShakeAngle.HasValue ? 0f : cameraShake.ShakeAngle.Value;
         Singleton <CameraManager> .Instance.GetMainCamera().ActShakeEffect(cameraShake.ShakeTime, cameraShake.ShakeRange * 1.5f, angle, cameraShake.ShakeStepFrame, hasValue, cameraShake.ClearPreviousShake);
     }
 }
Ejemplo n.º 2
0
        public static AttackData CreateAttackDataFromAttackProperty(BaseActor from, ConfigEntityAttackProperty attackProperty, ConfigEntityAttackEffect attackEffect, ConfigEntityCameraShake cameraShake)
        {
            AttackData data = new AttackData();

            if (from is AvatarActor)
            {
                AvatarActor actor = (AvatarActor)from;
                data.attackCategoryTag      = attackProperty.CategoryTagCombined;
                data.attackerClass          = actor.config.CommonArguments.Class;
                data.attackerNature         = (EntityNature)actor.avatarDataItem.Attribute;
                data.attackerCategory       = 3;
                data.attackerAniDamageRatio = attackProperty.AniDamageRatio;
                data.frameHalt                       = attackProperty.FrameHalt;
                data.hitType                         = attackProperty.HitType;
                data.hitEffect                       = attackProperty.HitEffect;
                data.hitEffectAux                    = attackProperty.HitEffectAux;
                data.attackerLevel                   = (int)actor.level;
                data.retreatVelocity                 = attackProperty.RetreatVelocity;
                data.attackerCritChance              = ((actor.critical + actor.GetProperty("Actor_CriticalDelta")) * (1f + actor.GetProperty("Actor_CriticalRatio"))) / ((float)(0x4b + (actor.level * 5)));
                data.attackerCritDamageRatio         = 2f;
                data.attackerAttackValue             = (float)actor.attack;
                data.attackerAttackPercentage        = attackProperty.DamagePercentage;
                data.attackerAddedAttackValue        = attackProperty.AddedDamageValue;
                data.attackerNormalDamage            = attackProperty.NormalDamage;
                data.attackerNormalDamagePercentage  = attackProperty.NormalDamagePercentage;
                data.addedAttackerNormalDamageRatio  = actor.GetProperty("Actor_NormalAttackRatio");
                data.attackerFireDamage              = attackProperty.FireDamage;
                data.attackerFireDamagePercentage    = attackProperty.FireDamagePercentage;
                data.addedAttackerFireDamageRatio    = actor.GetProperty("Actor_FireAttackRatio");
                data.attackerThunderDamage           = attackProperty.ThunderDamage;
                data.attackerThunderDamagePercentage = attackProperty.ThunderDamagePercentage;
                data.addedAttackerThunderDamageRatio = actor.GetProperty("Actor_ThunderAttackRatio");
                data.attackerIceDamage               = attackProperty.IceDamage;
                data.attackerIceDamagePercentage     = attackProperty.IceDamagePercentage;
                data.addedAttackerIceDamageRatio     = actor.GetProperty("Actor_IceAttackRatio");
                data.attackerAlienDamage             = attackProperty.AlienDamage;
                data.attackerAlienDamagePercentage   = attackProperty.AlienDamagePercentage;
                data.addedAttackerAlienDamageRatio   = actor.GetProperty("Actor_AllienAttackRatio");
                data.killEffect                      = attackProperty.KillEffect;
                data.hitEffectPattern                = AttackResult.HitEffectPattern.Normal;
                data.isInComboCount                  = attackProperty.IsInComboCount;
                data.isAnimEventAttack               = attackProperty.IsAnimEventAttack;
                data.noBreakFrameHaltAdd             = attackProperty.NoBreakFrameHaltAdd;
                data.attackEffectPattern             = attackEffect;
                if (data.attackEffectPattern == null)
                {
                    data.attackEffectPattern = (data.attackerAniDamageRatio < 0.8f) ? InLevelData.InLevelMiscData.DefaultAvatarAttackSmallEffect : InLevelData.InLevelMiscData.DefaultAvatarAttackBigEffect;
                }
                if (Singleton <AvatarManager> .Instance.IsLocalAvatar(actor.runtimeID))
                {
                    data.attackCameraShake = cameraShake;
                }
                data.attackerAniDamageRatio   += actor.GetProperty("Actor_AniDamageDelta");
                data.attackerCritChance       += actor.GetProperty("Actor_CriticalChanceDelta");
                data.attackerCritDamageRatio  += actor.GetProperty("Actor_CriticalDamageRatio");
                data.attackerAttackValue       = (data.attackerAttackValue + actor.GetProperty("Actor_AttackDelta")) * (1f + actor.GetProperty("Actor_AttackRatio"));
                data.addedDamageRatio          = actor.GetProperty("Actor_AddedDamageRatio");
                data.addedAttackRatio          = actor.GetProperty("Actor_AddedAttackRatio");
                data.attackerShieldDamageRatio = 1f + actor.GetProperty("Actor_ShieldDamageRatio");
                data.attackerShieldDamageDelta = actor.GetProperty("Actor_ShieldDamageDelta");
                data.retreatVelocity          *= 1f + actor.GetProperty("Actor_RetreatRatio");
            }
            else if (from is MonsterActor)
            {
                MonsterActor actor2 = (MonsterActor)from;
                data.attackCategoryTag      = attackProperty.CategoryTagCombined;
                data.attackerClass          = actor2.config.CommonArguments.Class;
                data.attackerNature         = (EntityNature)actor2.metaConfig.nature;
                data.attackerCategory       = 4;
                data.attackerAniDamageRatio = attackProperty.AniDamageRatio;
                data.frameHalt                       = attackProperty.FrameHalt;
                data.hitType                         = attackProperty.HitType;
                data.hitEffect                       = attackProperty.HitEffect;
                data.hitEffectAux                    = attackProperty.HitEffectAux;
                data.hitEffectPattern                = AttackResult.HitEffectPattern.Normal;
                data.retreatVelocity                 = attackProperty.RetreatVelocity;
                data.attackerLevel                   = (int)actor2.level;
                data.attackerAttackValue             = (float)actor2.attack;
                data.attackerAttackPercentage        = attackProperty.DamagePercentage;
                data.attackerAddedAttackValue        = attackProperty.AddedDamageValue;
                data.attackerNormalDamage            = attackProperty.NormalDamage;
                data.attackerNormalDamagePercentage  = attackProperty.NormalDamagePercentage;
                data.addedAttackerNormalDamageRatio  = actor2.GetProperty("Actor_NormalAttackRatio");
                data.attackerFireDamage              = attackProperty.FireDamage;
                data.attackerFireDamagePercentage    = attackProperty.FireDamagePercentage;
                data.addedAttackerFireDamageRatio    = actor2.GetProperty("Actor_FireAttackRatio");
                data.attackerThunderDamage           = attackProperty.ThunderDamage;
                data.attackerThunderDamagePercentage = attackProperty.ThunderDamagePercentage;
                data.addedAttackerThunderDamageRatio = actor2.GetProperty("Actor_ThunderAttackRatio");
                data.attackerIceDamage               = attackProperty.IceDamage;
                data.attackerIceDamagePercentage     = attackProperty.IceDamagePercentage;
                data.addedAttackerIceDamageRatio     = actor2.GetProperty("Actor_IceAttackRatio");
                data.attackerAlienDamage             = attackProperty.AlienDamage;
                data.attackerAlienDamagePercentage   = attackProperty.AlienDamagePercentage;
                data.addedAttackerAlienDamageRatio   = actor2.GetProperty("Actor_AllienAttackRatio");
                data.noTriggerEvadeAndDefend         = attackProperty.NoTriggerEvadeAndDefend;
                data.attackEffectPattern             = attackEffect;
                if (data.attackEffectPattern == null)
                {
                    data.attackEffectPattern = InLevelData.InLevelMiscData.DefaultMonsterAttackEffect;
                }
                data.attackCameraShake         = cameraShake;
                data.isAnimEventAttack         = attackProperty.IsAnimEventAttack;
                data.attackerAniDamageRatio   += actor2.GetProperty("Actor_AniDamageDelta");
                data.attackerAttackValue       = (data.attackerAttackValue + actor2.GetProperty("Actor_AttackDelta")) * (1f + actor2.GetProperty("Actor_AttackRatio"));
                data.addedAttackRatio          = actor2.GetProperty("Actor_AddedAttackRatio");
                data.attackerShieldDamageRatio = 1f + actor2.GetProperty("Actor_ShieldDamageRatio");
                data.attackerShieldDamageDelta = actor2.GetProperty("Actor_ShieldDamageDelta");
                data.retreatVelocity          *= 1f + actor2.GetProperty("Actor_RetreatRatio");
            }
            else if (from is BaseAbilityActor)
            {
                BaseAbilityActor actor3 = (BaseAbilityActor)from;
                data.attackCategoryTag      = attackProperty.CategoryTagCombined;
                data.attackerClass          = EntityClass.Default;
                data.attackerNature         = EntityNature.Pure;
                data.attackerCategory       = 7;
                data.attackerAniDamageRatio = attackProperty.AniDamageRatio;
                data.frameHalt                       = attackProperty.FrameHalt;
                data.hitType                         = attackProperty.HitType;
                data.hitEffect                       = attackProperty.HitEffect;
                data.hitEffectAux                    = attackProperty.HitEffectAux;
                data.retreatVelocity                 = attackProperty.RetreatVelocity;
                data.attackerLevel                   = 0;
                data.attackerAttackPercentage        = attackProperty.DamagePercentage;
                data.attackerAttackValue             = (float)actor3.attack;
                data.attackerAttackPercentage        = attackProperty.DamagePercentage;
                data.attackerAddedAttackValue        = attackProperty.AddedDamageValue;
                data.attackerNormalDamage            = attackProperty.NormalDamage;
                data.attackerNormalDamagePercentage  = attackProperty.NormalDamagePercentage;
                data.addedAttackerNormalDamageRatio  = actor3.GetProperty("Actor_NormalAttackRatio");
                data.attackerFireDamage              = attackProperty.FireDamage;
                data.attackerFireDamagePercentage    = attackProperty.FireDamagePercentage;
                data.addedAttackerFireDamageRatio    = actor3.GetProperty("Actor_FireAttackRatio");
                data.attackerThunderDamage           = attackProperty.ThunderDamage;
                data.attackerThunderDamagePercentage = attackProperty.ThunderDamagePercentage;
                data.addedAttackerThunderDamageRatio = actor3.GetProperty("Actor_ThunderAttackRatio");
                data.attackerIceDamage               = attackProperty.IceDamage;
                data.attackerIceDamagePercentage     = attackProperty.IceDamagePercentage;
                data.addedAttackerIceDamageRatio     = actor3.GetProperty("Actor_IceAttackRatio");
                data.attackerAlienDamage             = attackProperty.AlienDamage;
                data.attackerAlienDamagePercentage   = attackProperty.AlienDamagePercentage;
                data.addedAttackerAlienDamageRatio   = actor3.GetProperty("Actor_AllienAttackRatio");
                data.attackEffectPattern             = attackEffect;
                if (data.attackEffectPattern == null)
                {
                    data.attackEffectPattern = InLevelData.InLevelMiscData.DefaultMonsterAttackEffect;
                }
                data.attackCameraShake         = cameraShake;
                data.isAnimEventAttack         = attackProperty.IsAnimEventAttack;
                data.attackerAniDamageRatio   += actor3.GetProperty("Actor_AniDamageDelta");
                data.attackerAttackValue       = (data.attackerAttackValue + actor3.GetProperty("Actor_AttackDelta")) * (1f + actor3.GetProperty("Actor_AttackRatio"));
                data.addedAttackRatio          = actor3.GetProperty("Actor_AddedAttackRatio");
                data.attackerShieldDamageRatio = 1f + actor3.GetProperty("Actor_ShieldDamageRatio");
                data.attackerShieldDamageDelta = actor3.GetProperty("Actor_ShieldDamageDelta");
                data.retreatVelocity          *= 1f + actor3.GetProperty("Actor_RetreatRatio");
            }
            data.resolveStep = AttackData.AttackDataStep.AttackerResolved;
            return(data);
        }