private bool PostBeingHit(EvtBeingHit evt)
        {
            if (!base.actor.abilityPlugin.EvaluateAbilityPredicate(this.config.Predicates, base.instancedAbility, base.instancedModifier, Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(evt.sourceID), evt))
            {
                return(false);
            }
            if (evt.attackData.rejected)
            {
                return(false);
            }
            float num = evt.attackData.damage * base.instancedAbility.Evaluate(this.config.DamagePercentage);

            this._attackProperty.AddedDamageValue  = num;
            this._attackProperty.DamagePercentage  = 0f;
            this._attackProperty.AniDamageRatio    = 0f;
            this._attackProperty.FrameHalt         = 0;
            this._attackProperty.HitType           = AttackResult.ActorHitType.Ailment;
            this._attackProperty.HitEffect         = AttackResult.AnimatorHitEffect.Normal;
            this._attackProperty.RetreatVelocity   = 0f;
            this._attackProperty.IsAnimEventAttack = true;
            this._attackProperty.IsInComboCount    = false;
            bool       forceSkipAttackerResolve = !base.actor.IsActive();
            AttackData attackData = DamageModelLogic.CreateAttackDataFromAttackProperty(base.actor, this._attackProperty, null, null);

            AttackPattern.SendHitEvent(base.actor.runtimeID, evt.sourceID, null, null, attackData, forceSkipAttackerResolve, MPEventDispatchMode.Normal);
            base.actor.abilityPlugin.HandleActionTargetDispatch(this.config.Actions, base.instancedAbility, base.instancedModifier, Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(evt.sourceID), evt);
            return(true);
        }
        private void OnUpdateAttackTarget(BaseMonoEntity entity)
        {
            if ((entity != null) && this._isTutorialAvailable)
            {
                MonsterActor attackee = Singleton <EventManager> .Instance.GetActor <MonsterActor>(entity.GetRuntimeID());

                BaseMonoAvatar localAvatar = Singleton <AvatarManager> .Instance.GetLocalAvatar();

                AvatarActor actor = Singleton <EventManager> .Instance.GetActor <AvatarActor>(localAvatar.GetRuntimeID());

                EntityNature attackerNature = (EntityNature)attackee.metaConfig.nature;
                EntityNature attribute      = (EntityNature)actor.avatarDataItem.Attribute;
                float        num            = DamageModelLogic.GetNatureDamageBonusRatio(attackerNature, attribute, attackee);
                if (((((attackee != null) && (actor != null)) && ((base.step == 0) && (base.GetCurrentStepState() == BaseLevelTutorial.StepState.Sleep))) && ((!this.IsAllStepDone() && (num > 1f)) && ((base.step == 0) && (base.GetCurrentStepState() == BaseLevelTutorial.StepState.Sleep)))) && !this.IsAllStepDone())
                {
                    this.ActiveCurrentStep();
                    this.WaitShowTutorialStep(this.GetDelayTime(base.step), new Action(this.ShowTutorialStep0));
                }
                if ((((attackee != null) && (actor != null)) && ((this._killAmount >= 2) && (this._monsterCreatedAmount > 2))) && (((num > 1f) && (base.step == 2)) && ((base.GetCurrentStepState() == BaseLevelTutorial.StepState.Sleep) && !this.IsAllStepDone())))
                {
                    this.ActiveCurrentStep();
                    this.WaitShowTutorialStep(this.GetDelayTime(base.step), new Action(this.ShowTutorialStep2));
                }
            }
        }
        protected virtual void CreateBullet(HitExplodeTracingBulletMixinArgument arg, uint bulletRuntimeID, uint otherID)
        {
            string bulletTypeName = this.baseConfig.BulletTypeName;
            float  speed          = base.instancedAbility.Evaluate(this.baseConfig.BulletSpeed);

            if (arg != null)
            {
                if (arg.BulletName != null)
                {
                    bulletTypeName = arg.BulletName;
                }
                if (arg.RandomBulletNames != null)
                {
                    bulletTypeName = arg.RandomBulletNames[UnityEngine.Random.Range(0, arg.RandomBulletNames.Length)];
                }
                if (arg.BulletSpeed != null)
                {
                    speed = base.instancedAbility.Evaluate(arg.BulletSpeed);
                }
            }
            AbilityTriggerBullet bullet = Singleton <DynamicObjectManager> .Instance.CreateAbilityLinearTriggerBullet(bulletTypeName, base.actor, speed, this.baseConfig.Targetting, this.baseConfig.IgnoreTimeScale, bulletRuntimeID, base.instancedAbility.Evaluate(this.baseConfig.AliveDuration));

            if ((this.baseConfig.BulletEffect != null) && (this.baseConfig.BulletEffect.EffectPattern != null))
            {
                Singleton <EffectManager> .Instance.TriggerEntityEffectPattern(this.baseConfig.BulletEffect.EffectPattern, bullet.triggerBullet, this.baseConfig.BulletEffectGround);
            }
            this.InitBulletForward(bullet);
            this.InitBulletForwardWithArgument(bullet, arg, otherID);
            this._bulletAttackDatas.Add(bullet.runtimeID, DamageModelLogic.CreateAttackDataFromAttackerAnimEvent(base.actor, this.baseConfig.HitAnimEventID));
        }
Beispiel #4
0
        public void SetupNatureBonus()
        {
            BaseMonoAvatar localAvatar = Singleton <AvatarManager> .Instance.GetLocalAvatar();

            EntityNature attribute = (EntityNature)Singleton <EventManager> .Instance.GetActor <AvatarActor>(localAvatar.GetRuntimeID()).avatarDataItem.Attribute;

            EntityNature nature          = (EntityNature)this._currentMonster.metaConfig.nature;
            int          natureBonusType = DamageModelLogic.GetNatureBonusType(attribute, nature);

            base.transform.Find("DamageMark/Up").gameObject.SetActive(natureBonusType == 1);
            base.transform.Find("DamageMark/Down").gameObject.SetActive(natureBonusType == -1);
        }
Beispiel #5
0
        private bool OnHittingOther(EvtHittingOther evt)
        {
            if (evt.attackData == null)
            {
                evt.attackData = DamageModelLogic.CreateAttackDataFromAttackerAnimEvent(this, evt.animEventID);
            }
            if ((evt.hitCollision == null) && (Singleton <EventManager> .Instance.GetActor(evt.toID) != null))
            {
                BaseMonoEntity victimEntity = Singleton <EventManager> .Instance.GetEntity(evt.toID);

                evt.hitCollision = this.CalcHitCollision(this.config.PropArguments.RetreatType, victimEntity);
            }
            evt.attackData.hitCollision = evt.hitCollision;
            return(true);
        }
Beispiel #6
0
 public static void SendHitEvent(uint attackerID, uint beHitID, string attackName, AttackResult.HitCollsion hitCollision, AttackData attackData, bool forceSkipAttackerResolve = false, MPEventDispatchMode mode = 0)
 {
     if (forceSkipAttackerResolve || Singleton <LevelManager> .Instance.gameMode.ShouldAttackPatternSendBeingHit(beHitID))
     {
         EvtBeingHit evt = new EvtBeingHit {
             targetID    = beHitID,
             sourceID    = attackerID,
             animEventID = attackName
         };
         if (attackData != null)
         {
             if (attackData.hitCollision == null)
             {
                 attackData.hitCollision = hitCollision;
             }
             evt.attackData = attackData;
         }
         else
         {
             evt.attackData              = DamageModelLogic.CreateAttackDataFromAttackerAnimEvent(Singleton <EventManager> .Instance.GetActor(attackerID), attackName);
             evt.attackData.resolveStep  = AttackData.AttackDataStep.AttackerResolved;
             evt.attackData.hitCollision = hitCollision;
         }
         Singleton <EventManager> .Instance.FireEvent(evt, mode);
     }
     else
     {
         EvtHittingOther other = new EvtHittingOther {
             hitCollision = hitCollision,
             targetID     = attackerID,
             toID         = beHitID,
             animEventID  = attackName
         };
         if (attackData != null)
         {
             if (attackData.hitCollision == null)
             {
                 attackData.hitCollision = hitCollision;
             }
             other.attackData = attackData;
         }
         else
         {
             other.hitCollision = hitCollision;
         }
         Singleton <EventManager> .Instance.FireEvent(other, mode);
     }
 }
Beispiel #7
0
        public override void OnAbilityTriggered(EvtAbilityStart evt)
        {
            string bulletTypeName = this.config.BulletTypeName;
            int    grenadeAmount  = this.config.GrenadeAmount;
            string hitAnimEventID = this.config.HitAnimEventID;
            GrenadesMixinArgument abilityArgument = evt.abilityArgument as GrenadesMixinArgument;

            if (abilityArgument != null)
            {
                grenadeAmount = abilityArgument.BulletAmount;
                if (!string.IsNullOrEmpty(abilityArgument.HitAnimEventID))
                {
                    hitAnimEventID = abilityArgument.HitAnimEventID;
                }
            }
            for (int i = 0; i < grenadeAmount; i++)
            {
                AbilityTriggerBullet bullet = Singleton <DynamicObjectManager> .Instance.CreateAbilityLinearTriggerBullet(bulletTypeName, base.actor, base.instancedAbility.Evaluate(this.config.BulletSpeed), this.config.Targetting, this.config.IgnoreTimeScale, Singleton <DynamicObjectManager> .Instance.GetNextSyncedDynamicObjectRuntimeID(), -1f);

                if ((this.config.BulletEffect != null) && (this.config.BulletEffect.EffectPattern != null))
                {
                    Singleton <EffectManager> .Instance.TriggerEntityEffectPattern(this.config.BulletEffect.EffectPattern, bullet.triggerBullet, this.config.BulletEffectGround);
                }
                BaseMonoEntity entity  = null;
                Vector3        forward = base.entity.transform.forward;
                if (evt.otherID != 0)
                {
                    BaseAbilityActor actor = Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(evt.otherID);

                    if ((actor != null) && (actor.entity != null))
                    {
                        entity = actor.entity;
                    }
                }
                if (entity != null)
                {
                    bullet.triggerBullet.transform.position = entity.GetAttachPoint("RootNode").position;
                    forward = entity.transform.forward;
                    float angle = ((360 * i) / (this.config.GrenadeAmount + 1)) - 180;
                    forward = (Vector3)(Quaternion.AngleAxis(angle, Vector3.up) * forward);
                }
                this.InitBulletDirAndPos(bullet, forward);
                base._bulletAttackDatas.Add(bullet.runtimeID, DamageModelLogic.CreateAttackDataFromAttackerAnimEvent(base.actor, hitAnimEventID));
            }
        }
        public override void OnAbilityTriggered(EvtAbilityStart evt)
        {
            BaseMonoAvatar localAvatar = Singleton <AvatarManager> .Instance.GetLocalAvatar();

            if (localAvatar != null)
            {
                int count = localAvatar.SubAttackTargetList.Count;
                for (int i = 0; i < count; i++)
                {
                    string bulletTypeName = this.config.BulletTypeName;
                    HitExplodeTracingBulletMixinArgument abilityArgument = evt.abilityArgument as HitExplodeTracingBulletMixinArgument;
                    if (abilityArgument != null)
                    {
                        if (abilityArgument.BulletName != null)
                        {
                            bulletTypeName = abilityArgument.BulletName;
                        }
                        if (abilityArgument.RandomBulletNames != null)
                        {
                            bulletTypeName = abilityArgument.RandomBulletNames[UnityEngine.Random.Range(0, abilityArgument.RandomBulletNames.Length)];
                        }
                    }
                    AbilityTriggerBullet bullet = Singleton <DynamicObjectManager> .Instance.CreateAbilityLinearTriggerBullet(bulletTypeName, base.actor, base.instancedAbility.Evaluate(this.config.BulletPostionLinearSpeed), this.config.Targetting, this.config.IgnoreTimeScale, Singleton <DynamicObjectManager> .Instance.GetNextSyncedDynamicObjectRuntimeID(), -1f);

                    if ((this.config.BulletEffect != null) && (this.config.BulletEffect.EffectPattern != null))
                    {
                        Singleton <EffectManager> .Instance.TriggerEntityEffectPattern(this.config.BulletEffect.EffectPattern, bullet.triggerBullet, this.config.BulletEffectGround);
                    }
                    base._bulletAttackDatas.Add(bullet.runtimeID, DamageModelLogic.CreateAttackDataFromAttackerAnimEvent(base.actor, this.config.HitAnimEventID));
                    float   angle    = (180 / (count + 1)) * (i + 1);
                    float   num4     = base.instancedAbility.Evaluate(this.config.BulletPositionRadius);
                    float   duration = base.instancedAbility.Evaluate(this.config.BulletPositionDuration);
                    Vector3 vector   = Vector3.Cross(Vector3.up, base.entity.transform.forward);
                    vector = (Vector3)(Quaternion.AngleAxis(angle, base.entity.transform.forward) * vector);
                    Vector3 vector2  = (Vector3)(vector.normalized * num4);
                    Vector3 position = localAvatar.SubAttackTargetList[i].transform.position;
                    Vector3 up       = Vector3.up;
                    position += up;
                    bullet.triggerBullet.SetupPositioning(bullet.triggerBullet.transform.position, bullet.triggerBullet.transform.position + vector2, duration, base.instancedAbility.Evaluate(this.config.BulletSpeed), this.config.TracingLerpCoef, this.config.TracingLerpCoefAcc, position, this.config.PassBy);
                    this.InitBulletForward(bullet);
                }
            }
        }
        private BulletInfo CreateOneBullet()
        {
            AbilityTriggerBullet bullet = Singleton <DynamicObjectManager> .Instance.CreateAbilityLinearTriggerBullet(this._bulletName, base.actor, base.instancedAbility.Evaluate(this.config.BulletSpeed), this.config.Targetting, this.config.IgnoreTimeScale, Singleton <DynamicObjectManager> .Instance.GetNextSyncedDynamicObjectRuntimeID(), -1f);

            Vector3 zero = Vector3.zero;

            this.InitBulletPosAndForward(bullet, out zero);
            BulletInfo info = new BulletInfo {
                bulletID         = bullet.runtimeID,
                backTimer        = this.config.BackTime,
                holdTimer        = this.config.HoldTime,
                lifeTimer        = this.config.LifeTime,
                startPosRelative = zero
            };

            base._bulletAttackDatas.Add(bullet.runtimeID, DamageModelLogic.CreateAttackDataFromAttackerAnimEvent(base.actor, this.config.HitAnimEventID));
            bullet.triggerBullet.acceleration = this.config.Acceleration;
            bullet.triggerBullet.SetCollisionEnabled(false);
            return(info);
        }
Beispiel #10
0
        private bool OnHittingOther(EvtHittingOther evt)
        {
            if (evt.attackData == null)
            {
                evt.attackData = DamageModelLogic.CreateAttackDataFromAttackerAnimEvent(this, evt.animEventID);
            }
            if ((evt.attackData.hitCollision == null) && (evt.hitCollision != null))
            {
                evt.attackData.hitCollision = evt.hitCollision;
            }
            else if (((evt.hitCollision == null) && (evt.attackData.hitCollision == null)) && (Singleton <EventManager> .Instance.GetActor(evt.toID) != null))
            {
                BaseMonoEntity entity = Singleton <EventManager> .Instance.GetEntity(evt.toID);

                AttackResult.HitCollsion collsion = new AttackResult.HitCollsion {
                    hitPoint = entity.GetAttachPoint("RootNode").position,
                    hitDir   = entity.XZPosition - this.monster.XZPosition
                };
                evt.hitCollision = collsion;
            }
            return(true);
        }
Beispiel #11
0
        private bool OnPostBeingHit(EvtBeingHit evt)
        {
            if (!evt.attackData.isAnimEventAttack)
            {
                return(false);
            }
            if (evt.attackData.rejected)
            {
                return(false);
            }
            if (base.actor.abilityState.ContainsState(AbilityState.Invincible) || base.actor.abilityState.ContainsState(AbilityState.Undamagable))
            {
                return(false);
            }
            if ((this._globalShieldValue == null) || (this._globalShieldValue.Value <= 0f))
            {
                return(false);
            }
            float num      = this._globalShieldValue.Value;
            float num2     = evt.attackData.damage * (1f - DamageModelLogic.GetDefenceRatio(base.instancedAbility.caster.defense * base.instancedAbility.Evaluate(this.config.ShieldDefenceRatio), evt.attackData.attackerLevel));
            float newValue = num - num2;
            bool  flag     = Mathf.Approximately(evt.attackData.GetTotalDamage() - evt.attackData.damage, 0f);

            if (newValue <= 0f)
            {
                newValue = 0f;
            }
            this._globalShieldValue.Pub(newValue);
            if (newValue > 0f)
            {
                if (flag)
                {
                    evt.attackData.Reject(AttackResult.RejectType.RejectAll);
                }
                else
                {
                    evt.attackData.damage    = 0f;
                    evt.attackData.hitEffect = AttackResult.AnimatorHitEffect.Mute;
                }
                if (evt.attackData.hitCollision != null)
                {
                    base.FireMixinEffect(this.config.ShieldSuccessEffect, base.entity, evt.attackData.hitCollision.hitPoint, evt.attackData.hitCollision.hitDir, false);
                }
                else
                {
                    base.FireMixinEffect(this.config.ShieldSuccessEffect, base.entity, false);
                }
                base.actor.abilityPlugin.HandleActionTargetDispatch(this.config.ShieldSuccessActions, base.instancedAbility, base.instancedModifier, Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(evt.sourceID), evt);
            }
            else if (num > 0f)
            {
                float num4 = 1f - (num / evt.attackData.damage);
                evt.attackData.damage *= num4;
                if (this.config.ShieldBrokenTimeSlow > 0f)
                {
                    Singleton <LevelManager> .Instance.levelActor.TimeSlow(this.config.ShieldBrokenTimeSlow);
                }
                base.FireMixinEffect(this.config.ShieldBrokenEffect, base.entity, false);
                base.actor.abilityPlugin.HandleActionTargetDispatch(this.config.ShieldBrokenActions, base.instancedAbility, base.instancedModifier, Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(evt.sourceID), evt);
                evt.attackData.frameHalt = 0;
                evt.attackData.attackerAniDamageRatio = 10f;
                Singleton <EventManager> .Instance.FireEvent(new EvtShieldBroken(base.actor.runtimeID), MPEventDispatchMode.Normal);

                evt.attackData.AddHitFlag(AttackResult.ActorHitFlag.Count);
            }
            return(true);
        }
Beispiel #12
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);
        }
Beispiel #13
0
 private bool OnBeingHit(EvtBeingHit evt)
 {
     DamageModelLogic.ResolveAttackDataByAttackee(this, evt.attackData);
     return(true);
 }
Beispiel #14
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);
        }
Beispiel #15
0
 protected virtual bool OnBeingHit(EvtBeingHit evt)
 {
     DamageModelLogic.ResolveAttackDataByAttackee(this, evt.attackData);
     return(true);
 }
        private bool ListenBeingHit(EvtBeingHit evt)
        {
            if (evt.attackData.rejected)
            {
                return(false);
            }
            if (this.isUpdating)
            {
                if (!evt.attackData.IsFinalResolved())
                {
                    return(false);
                }
                if (!evt.attackData.isAnimEventAttack)
                {
                    return(false);
                }
                this.allDamage += evt.attackData.GetTotalDamage();
                ushort num = Singleton <RuntimeIDManager> .Instance.ParseCategory(evt.targetID);

                ushort num2 = Singleton <RuntimeIDManager> .Instance.ParseCategory(evt.sourceID);

                switch (num)
                {
                case 3:
                {
                    if (num2 == 4)
                    {
                        MonsterStastics monsterStastics = this.GetMonsterStastics(evt.sourceID);
                        if (monsterStastics != null)
                        {
                            monsterStastics.damage        += evt.attackData.GetTotalDamage();
                            monsterStastics.hitAvatarTimes = SafeInt32.op_Increment(monsterStastics.hitAvatarTimes);
                            if (evt.attackData.hitEffect > AttackResult.AnimatorHitEffect.Light)
                            {
                                monsterStastics.breakAvatarTimes = SafeInt32.op_Increment(monsterStastics.breakAvatarTimes);
                            }
                        }
                    }
                    AvatarStastics avatarStastics = this.GetAvatarStastics(evt.targetID);
                    if (avatarStastics == null)
                    {
                        return(true);
                    }
                    avatarStastics.avatarBeDamaged    += evt.attackData.GetTotalDamage();
                    avatarStastics.avatarBeingHitTimes = SafeInt32.op_Increment(avatarStastics.avatarBeingHitTimes);
                    if (evt.attackData.hitEffect > AttackResult.AnimatorHitEffect.Light)
                    {
                        avatarStastics.avatarBeingBreakTimes = SafeInt32.op_Increment(avatarStastics.avatarBeingBreakTimes);
                    }
                    this.monsterDamage += evt.attackData.GetTotalDamage();
                    this.avatarBeingHitTimes++;
                    if (evt.attackData.attackerAniDamageRatio > evt.attackData.attackeeAniDefenceRatio)
                    {
                        this.avatarBeingHitTimes++;
                    }
                    if (evt.attackData.hitLevel == AttackResult.ActorHitLevel.Normal)
                    {
                        avatarStastics.behitNormalDamageMax = Mathf.Max(evt.attackData.GetTotalDamage(), (float)avatarStastics.behitNormalDamageMax);
                    }
                    else if (evt.attackData.hitLevel == AttackResult.ActorHitLevel.Critical)
                    {
                        avatarStastics.behitCriticalDamageMax = Mathf.Max(evt.attackData.GetTotalDamage(), (float)avatarStastics.behitCriticalDamageMax);
                    }
                    break;
                }

                case 4:
                {
                    MonsterActor attackee = Singleton <EventManager> .Instance.GetActor <MonsterActor>(evt.targetID);

                    if (num2 == 3)
                    {
                        AvatarStastics stastics3 = this.GetAvatarStastics(evt.sourceID);
                        if (stastics3 == null)
                        {
                            return(true);
                        }
                        float a = DamageModelLogic.GetNatureDamageBonusRatio(evt.attackData.attackerNature, evt.attackData.attackeeNature, attackee);
                        if (a > 1f)
                        {
                            stastics3.restrictionDamage += evt.attackData.GetTotalDamage();
                        }
                        else if (a < 1f)
                        {
                            stastics3.beRestrictedDamage += evt.attackData.GetTotalDamage();
                        }
                        else if (Mathf.Approximately(a, 1f))
                        {
                            stastics3.normalDamage += evt.attackData.GetTotalDamage();
                        }
                        if (evt.attackData.attackCategoryTag.ContainsTag(AttackResult.AttackCategoryTag.Weapon))
                        {
                            stastics3.avatarActiveWeaponSkillDamage += evt.attackData.GetTotalDamage();
                            this.avatarWeaponDdamage += evt.attackData.GetTotalDamage();
                        }
                        if (evt.attackData.hitEffect > AttackResult.AnimatorHitEffect.Light)
                        {
                            stastics3.avatarBreakTimes = SafeInt32.op_Increment(stastics3.avatarBreakTimes);
                        }
                        stastics3.avatarDamage  += evt.attackData.GetTotalDamage();
                        stastics3.avatarHitTimes = SafeInt32.op_Increment(stastics3.avatarHitTimes);
                        if (evt.attackData.isInComboCount)
                        {
                            stastics3.avatarEffectHitTimes = SafeInt32.op_Increment(stastics3.avatarEffectHitTimes);
                        }
                        if (evt.attackData.hitLevel == AttackResult.ActorHitLevel.Normal)
                        {
                            stastics3.hitNormalDamageMax = Mathf.Max(evt.attackData.GetTotalDamage(), (float)stastics3.hitNormalDamageMax);
                        }
                        else if (evt.attackData.hitLevel == AttackResult.ActorHitLevel.Critical)
                        {
                            stastics3.hitCriticalDamageMax = Mathf.Max(evt.attackData.GetTotalDamage(), (float)stastics3.hitCriticalDamageMax);
                        }
                    }
                    this.avatarDamage += evt.attackData.GetTotalDamage();
                    if (evt.attackData.isInComboCount)
                    {
                        this.avatarEffectHitTimes++;
                    }
                    this.monstersBeingHitTimes++;
                    if (evt.attackData.attackerAniDamageRatio > evt.attackData.attackeeAniDefenceRatio)
                    {
                        this.avatarBreakTimes++;
                    }
                    break;
                }
                }
            }
            return(true);
        }