Exemple #1
0
        public static AttackResult Deserialize(MPAttackResult table, AttackResult obj)
        {
            if (obj == null)
            {
                obj = new AttackResult();
            }
            obj.damage                  = table.Damage;
            obj.plainDamage             = table.PlainDamage;
            obj.thunderDamage           = table.ThunderDamage;
            obj.iceDamage               = table.IceDamage;
            obj.alienDamage             = table.AlienDamage;
            obj.aniDamageRatio          = table.AniDamageRatio;
            obj.retreatVelocity         = table.RetreatVelocity;
            obj.frameHalt               = table.FrameHalt;
            obj.isAnimEventAttack       = table.IsAnimEventAttack;
            obj.isInComboCount          = table.IsInComboCount;
            obj.attackCategoryTag       = (AttackResult.AttackCategoryTag)table.AttackCategoryTag;
            obj.hitType                 = (AttackResult.ActorHitType)table.HitType;
            obj.hitFlag                 = (AttackResult.ActorHitFlag)table.HitFlag;
            obj.hitLevel                = (AttackResult.ActorHitLevel)table.HitLevel;
            obj.hitEffect               = (AttackResult.AnimatorHitEffect)table.HitEffect;
            obj.hitEffectAux            = (AttackResult.AnimatorHitEffectAux)table.HitEffectAux;
            obj.hitEffectPattern        = (AttackResult.HitEffectPattern)table.HitEffectPattern;
            obj.killEffect              = (KillEffect)table.KillEffect;
            obj.rejectState             = (AttackResult.RejectType)table.RejectState;
            obj.isFromBullet            = table.IsFromBullet;
            obj.noTriggerEvadeAndDefend = table.NoTriggerEvadeAndDefend;
            if (table.GetHitCollision(GetCachedTable <MPHitCollision>()) != null)
            {
                obj.hitCollision = Deserialize(GetCachedTable <MPHitCollision>(), new AttackResult.HitCollsion());
            }
            obj.attackEffectPattern = IndexedConfig <ConfigEntityAttackEffect> .Mapping.TryGet(table.AttackEffectPattern);

            obj.beHitEffectPattern = IndexedConfig <ConfigEntityAttackEffect> .Mapping.TryGet(table.BeHitEffectPattern);

            obj.attackCameraShake = IndexedConfig <ConfigEntityCameraShake> .Mapping.TryGet(table.AttackCameraShake);

            return(obj);
        }
Exemple #2
0
 public virtual void BeingHit(AttackResult attackResult, BeHitEffect beHitEffect)
 {
     if ((this._paralyzeState == ParalyzeState.ParalyzeFreezed) && (attackResult.hitEffect > AttackResult.AnimatorHitEffect.Light))
     {
         this.monster.PopProperty("Animator_OverallSpeedRatioMultiplied", this._paralyzeAnimatorSpeedIx);
         this._paralyzeAnimatorSpeedIx = this.monster.PushProperty("Animator_OverallSpeedRatioMultiplied", 1f);
         this.monster.SetPropertyByStackIndex("Animator_OverallSpeedRatioMultiplied", this._paralyzeAnimatorSpeedIx, 1f);
         if ((attackResult.hitEffect == AttackResult.AnimatorHitEffect.ThrowUp) || (attackResult.hitEffect == AttackResult.AnimatorHitEffect.ThrowUpBlow))
         {
             this._paralyzeTimer.timespan = 0.5f;
         }
         else
         {
             this._paralyzeTimer.timespan = 0.35f;
         }
         this._paralyzeTimer.Reset(true);
         this._paralyzeState = ParalyzeState.ParalyzeHitResuming;
     }
     if (base.abilityState.ContainsState(AbilityState.Frozen) && (attackResult.hitEffect > AttackResult.AnimatorHitEffect.Light))
     {
         attackResult.hitEffect = AttackResult.AnimatorHitEffect.Light;
     }
     this.monster.BeHit(attackResult.frameHalt, attackResult.hitEffect, attackResult.hitEffectAux, attackResult.killEffect, beHitEffect, attackResult.aniDamageRatio, attackResult.hitCollision.hitDir, attackResult.retreatVelocity);
 }
Exemple #3
0
        public static Offset <MPAttackResult> Serialize(FlatBufferBuilder builder, AttackResult obj)
        {
            Offset <MPHitCollision> hitCollisionOffset = new Offset <MPHitCollision>();

            if (obj.hitCollision != null)
            {
                hitCollisionOffset = Serialize(builder, obj.hitCollision);
            }
            MPAttackResult.StartMPAttackResult(builder);
            MPAttackResult.AddDamage(builder, obj.damage);
            MPAttackResult.AddPlainDamage(builder, obj.plainDamage);
            MPAttackResult.AddThunderDamage(builder, obj.thunderDamage);
            MPAttackResult.AddIceDamage(builder, obj.iceDamage);
            MPAttackResult.AddAlienDamage(builder, obj.alienDamage);
            MPAttackResult.AddAniDamageRatio(builder, obj.aniDamageRatio);
            MPAttackResult.AddRetreatVelocity(builder, obj.retreatVelocity);
            MPAttackResult.AddFrameHalt(builder, obj.frameHalt);
            MPAttackResult.AddIsAnimEventAttack(builder, obj.isAnimEventAttack);
            MPAttackResult.AddIsInComboCount(builder, obj.isInComboCount);
            MPAttackResult.AddAttackCategoryTag(builder, (int)obj.attackCategoryTag);
            MPAttackResult.AddHitType(builder, (byte)obj.hitType);
            MPAttackResult.AddHitFlag(builder, (int)obj.hitFlag);
            MPAttackResult.AddHitLevel(builder, (byte)obj.hitLevel);
            MPAttackResult.AddHitEffect(builder, (byte)obj.hitEffect);
            MPAttackResult.AddHitEffectAux(builder, (byte)obj.hitEffectAux);
            MPAttackResult.AddHitEffectPattern(builder, (byte)obj.hitEffectPattern);
            MPAttackResult.AddKillEffect(builder, (byte)obj.killEffect);
            MPAttackResult.AddRejectState(builder, (byte)obj.rejectState);
            MPAttackResult.AddIsFromBullet(builder, obj.isFromBullet);
            MPAttackResult.AddNoTriggerEvadeAndDefend(builder, obj.noTriggerEvadeAndDefend);
            MPAttackResult.AddHitCollision(builder, hitCollisionOffset);
            MPAttackResult.AddAttackEffectPattern(builder, (ushort)IndexedConfig <ConfigEntityAttackEffect> .Mapping.TryGet(obj.attackEffectPattern));
            MPAttackResult.AddBeHitEffectPattern(builder, (ushort)IndexedConfig <ConfigEntityAttackEffect> .Mapping.TryGet(obj.beHitEffectPattern));
            MPAttackResult.AddAttackCameraShake(builder, (ushort)IndexedConfig <ConfigEntityCameraShake> .Mapping.TryGet(obj.attackCameraShake));
            return(MPAttackResult.EndMPAttackResult(builder));
        }
Exemple #4
0
 public EvtDamageLanded(uint fromID, uint attackeeID, AttackResult attackResult) : base(fromID)
 {
     this.attackeeID   = attackeeID;
     this.attackResult = attackResult;
 }
Exemple #5
0
 public virtual void BeingHit(AttackResult attackResult, BeHitEffect beHitEffect, uint sourceID)
 {
     this.prop.BeHit(attackResult.frameHalt, attackResult.hitEffect, attackResult.hitEffectAux, attackResult.killEffect, beHitEffect, attackResult.aniDamageRatio, attackResult.hitCollision.hitDir, attackResult.retreatVelocity, sourceID);
 }
Exemple #6
0
        private bool OnBeingHitResolve(EvtBeingHit evt)
        {
            evt.Resolve();
            AttackResult attackResult = DamageModelLogic.ResolveAttackDataFinal(this, evt.attackData);

            if (attackResult.hitCollision == null)
            {
                AttackResult.HitCollsion collsion = new AttackResult.HitCollsion {
                    hitPoint = this.prop.RootNode.position,
                    hitDir   = -this.prop.transform.forward
                };
                attackResult.hitCollision = collsion;
            }
            if (!evt.attackData.isAnimEventAttack)
            {
                return(false);
            }
            if (base.isAlive != 0)
            {
                float totalDamage = attackResult.GetTotalDamage();
                float newValue    = base.HP - totalDamage;
                if (newValue <= 0f)
                {
                    newValue = 0f;
                }
                DelegateUtils.UpdateField(ref this.HP, newValue, newValue - base.HP, base.onHPChanged);
                if (base.HP == 0f)
                {
                    if (base.abilityState.ContainsState(AbilityState.Limbo))
                    {
                        this.BeingHit(attackResult, BeHitEffect.NormalBeHit, evt.sourceID);
                    }
                    else
                    {
                        this.BeingHit(attackResult, BeHitEffect.KillingBeHit, evt.sourceID);
                        this.Kill(evt.sourceID, evt.animEventID);
                    }
                }
                else
                {
                    this.BeingHit(attackResult, BeHitEffect.NormalBeHit, evt.sourceID);
                }
            }
            if ((attackResult.attackEffectPattern != null) && ((attackResult.hitEffectPattern == AttackResult.HitEffectPattern.Normal) || (attackResult.hitEffectPattern == AttackResult.HitEffectPattern.OnlyAttack)))
            {
                AttackPattern.ActAttackEffects(attackResult.attackEffectPattern, this.prop, attackResult.hitCollision.hitPoint, attackResult.hitCollision.hitDir);
            }
            if ((attackResult.beHitEffectPattern != null) && ((attackResult.hitEffectPattern == AttackResult.HitEffectPattern.Normal) || (attackResult.hitEffectPattern == AttackResult.HitEffectPattern.OnlyBeHit)))
            {
                AttackPattern.ActAttackEffects(attackResult.beHitEffectPattern, this.prop, attackResult.hitCollision.hitPoint, attackResult.hitCollision.hitDir);
            }
            if (evt.attackData.isAnimEventAttack)
            {
                EvtAttackLanded landed = new EvtAttackLanded(evt.sourceID, base.runtimeID, evt.animEventID, attackResult);
                Singleton <EventManager> .Instance.FireEvent(landed, MPEventDispatchMode.Normal);

                Singleton <NotifyManager> .Instance.FireNotify(new Notify(NotifyTypes.AttackLanded, landed));
            }
            else
            {
                Singleton <EventManager> .Instance.FireEvent(new EvtDamageLanded(evt.sourceID, base.runtimeID, attackResult), MPEventDispatchMode.Normal);
            }
            return(true);
        }
Exemple #7
0
 public EvtAttackLanded(uint fromID, uint attackeeID, string animEventID, AttackResult attackResult) : base(fromID)
 {
     this.attackeeID   = attackeeID;
     this.animEventID  = animEventID;
     this.attackResult = attackResult;
 }
Exemple #8
0
        protected virtual bool OnBeingHitResolve(EvtBeingHit evt)
        {
            evt.Resolve();
            if (evt.attackData.rejected)
            {
                if (evt.attackData.rejectState == AttackResult.RejectType.RejectButShowAttackEffect)
                {
                    this.AmendHitCollision(evt.attackData);
                    this.FireAttackDataEffects(evt.attackData);
                }
                return(false);
            }
            if ((base.isAlive == 0) || (evt.attackData.GetTotalDamage() > base.HP))
            {
                evt.attackData.attackeeAniDefenceRatio = 0f;
            }
            AttackResult attackResult = DamageModelLogic.ResolveAttackDataFinal(this, evt.attackData);

            this.AmendHitCollision(attackResult);
            if (base.isAlive != 0)
            {
                if (base.abilityState.ContainsState(AbilityState.Invincible))
                {
                    attackResult.damage        = 0f;
                    attackResult.plainDamage   = 0f;
                    attackResult.fireDamage    = 0f;
                    attackResult.thunderDamage = 0f;
                    attackResult.iceDamage     = 0f;
                    attackResult.alienDamage   = 0f;
                    attackResult.hitLevel      = AttackResult.ActorHitLevel.Mute;
                    attackResult.hitEffect     = AttackResult.AnimatorHitEffect.Mute;
                    attackResult.frameHalt    += 5;
                }
                else if (base.abilityState.ContainsState(AbilityState.Endure))
                {
                    attackResult.hitEffect  = AttackResult.AnimatorHitEffect.Mute;
                    attackResult.frameHalt += 5;
                }
                if (!attackResult.isAnimEventAttack)
                {
                    attackResult.hitEffect         = AttackResult.AnimatorHitEffect.Mute;
                    attackResult.hitLevel          = AttackResult.ActorHitLevel.Normal;
                    attackResult.hitEffectPattern  = AttackResult.HitEffectPattern.OnlyBeHit;
                    attackResult.attackCameraShake = null;
                    attackResult.killEffect        = KillEffect.KillNow;
                }
                float totalDamage = attackResult.GetTotalDamage();
                float newValue    = base.HP - totalDamage;
                if (newValue <= 0f)
                {
                    newValue = 0f;
                }
                if (base.abilityState.ContainsState(AbilityState.Undamagable))
                {
                    DelegateUtils.UpdateField(ref this.HP, (float)base.HP, newValue - base.HP, base.onHPChanged);
                }
                else
                {
                    DelegateUtils.UpdateField(ref this.HP, newValue, newValue - base.HP, base.onHPChanged);
                    evt.resolvedDamage = totalDamage;
                }
                if (base.HP == 0f)
                {
                    if ((base.abilityState & AbilityState.Limbo) != AbilityState.None)
                    {
                        evt.beHitEffect = BeHitEffect.NormalBeHit;
                        this.BeingHit(attackResult, BeHitEffect.NormalBeHit);
                    }
                    else
                    {
                        if (attackResult.killEffect != KillEffect.KillTillHitAnimationEnd)
                        {
                            if ((this.monster.IsAnimatorInTag(MonsterData.MonsterTagGroup.Throw) || (evt.attackData.hitEffect == AttackResult.AnimatorHitEffect.ThrowUp)) || (evt.attackData.hitEffect == AttackResult.AnimatorHitEffect.ThrowUpBlow))
                            {
                                attackResult.killEffect = KillEffect.KillFastWithNormalAnim;
                            }
                            else if (((base.abilityState & AbilityState.WitchTimeSlowed) != AbilityState.None) || (attackResult.aniDamageRatio >= 0.9f))
                            {
                                attackResult.killEffect = KillEffect.KillFastWithDieAnim;
                            }
                        }
                        this.Kill(evt.sourceID, evt.animEventID, attackResult.killEffect);
                        evt.beHitEffect = BeHitEffect.KillingBeHit;
                        this.BeingHit(attackResult, BeHitEffect.KillingBeHit);
                    }
                }
                else
                {
                    evt.beHitEffect = BeHitEffect.NormalBeHit;
                    this.BeingHit(attackResult, BeHitEffect.NormalBeHit);
                }
            }
            else
            {
                evt.beHitEffect = BeHitEffect.OverkillBeHit;
                this.BeingHit(attackResult, BeHitEffect.OverkillBeHit);
            }
            this.FireAttackDataEffects(attackResult);
            if (evt.attackData.isAnimEventAttack)
            {
                EvtAttackLanded landed = new EvtAttackLanded(evt.sourceID, base.runtimeID, evt.animEventID, attackResult);
                Singleton <EventManager> .Instance.FireEvent(landed, MPEventDispatchMode.Normal);

                Singleton <NotifyManager> .Instance.FireNotify(new Notify(NotifyTypes.AttackLanded, landed));
            }
            else
            {
                Singleton <EventManager> .Instance.FireEvent(new EvtDamageLanded(evt.sourceID, base.runtimeID, attackResult), MPEventDispatchMode.Normal);
            }
            base.MarkImportantEventIsHandled(evt);
            return(true);
        }
Exemple #9
0
 public static object DeserializeToObject(Table table, object obj)
 {
     if (table.GetType() == typeof(MoleMole.MPProtocol.MPStageData))
     {
         if (obj == null)
         {
             obj = new MoleMole.MPStageData();
         }
         return(Deserialize((MoleMole.MPProtocol.MPStageData)table, (MoleMole.MPStageData)obj));
     }
     if (table.GetType() == typeof(MoleMole.MPProtocol.MPAvatarDataItem))
     {
         if (obj == null)
         {
             obj = new MoleMole.MPAvatarDataItem();
         }
         return(Deserialize((MoleMole.MPProtocol.MPAvatarDataItem)table, (MoleMole.MPAvatarDataItem)obj));
     }
     if (table.GetType() == typeof(Packet_Event_EvtHittingOther))
     {
         if (obj == null)
         {
             obj = new EvtHittingOther();
         }
         return(Deserialize((Packet_Event_EvtHittingOther)table, (EvtHittingOther)obj));
     }
     if (table.GetType() == typeof(Packet_Event_EvtBeingHit))
     {
         if (obj == null)
         {
             obj = new EvtBeingHit();
         }
         return(Deserialize((Packet_Event_EvtBeingHit)table, (EvtBeingHit)obj));
     }
     if (table.GetType() == typeof(Packet_Event_EvtAttackLanded))
     {
         if (obj == null)
         {
             obj = new EvtAttackLanded();
         }
         return(Deserialize((Packet_Event_EvtAttackLanded)table, (EvtAttackLanded)obj));
     }
     if (table.GetType() == typeof(Packet_Event_EvtEvadeSuccess))
     {
         if (obj == null)
         {
             obj = new EvtEvadeSuccess();
         }
         return(Deserialize((Packet_Event_EvtEvadeSuccess)table, (EvtEvadeSuccess)obj));
     }
     if (table.GetType() == typeof(Packet_Event_EvtBulletHit))
     {
         if (obj == null)
         {
             obj = new EvtBulletHit();
         }
         return(Deserialize((Packet_Event_EvtBulletHit)table, (EvtBulletHit)obj));
     }
     if (table.GetType() == typeof(MPAttackData))
     {
         if (obj == null)
         {
             obj = new AttackData();
         }
         return(Deserialize((MPAttackData)table, (AttackData)obj));
     }
     if (table.GetType() == typeof(MPAttackResult))
     {
         if (obj == null)
         {
             obj = new AttackResult();
         }
         return(Deserialize((MPAttackResult)table, (AttackResult)obj));
     }
     if (table.GetType() != typeof(MPHitCollision))
     {
         return(obj);
     }
     if (obj == null)
     {
         obj = new AttackResult.HitCollsion();
     }
     return(Deserialize((MPHitCollision)table, (AttackResult.HitCollsion)obj));
 }