private bool OnHittingOtherResolve(EvtHittingOther evt)
        {
            BaseAbilityActor actor = Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(evt.toID);

            if ((actor == null) || (actor.entity == null))
            {
                return(false);
            }
            if (!base.actor.abilityPlugin.EvaluateAbilityPredicate(this.config.Predicates, base.instancedAbility, base.instancedModifier, Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(evt.toID), evt))
            {
                return(false);
            }
            Vector3 vector = base.actor.entity.transform.position - actor.entity.transform.position;
            bool    flag   = vector.magnitude > base.instancedAbility.Evaluate(this.config.HitDistanceBeyond);

            if (this.config.Reverse)
            {
                flag = !flag;
            }
            if (flag)
            {
                evt.attackData.attackerCritChance       += base.instancedAbility.Evaluate(this.config.CriticalChanceRatioUp);
                evt.attackData.attackerCritDamageRatio  += base.instancedAbility.Evaluate(this.config.CriticalDamageRatioUp);
                evt.attackData.attackerAttackPercentage += base.instancedAbility.Evaluate(this.config.DamagePercentageUp);
                evt.attackData.attackerAniDamageRatio   += base.instancedAbility.Evaluate(this.config.AniDamageRatioUp);
                evt.attackData.attackerAttackValue      *= 1f + base.instancedAbility.Evaluate(this.config.AttackRatio);
                base.actor.abilityPlugin.HandleActionTargetDispatch(this.config.Actions, base.instancedAbility, base.instancedModifier, Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(evt.toID), evt);
            }
            return(true);
        }
Exemple #2
0
        private bool OnHittingOtherResolve(EvtHittingOther evt)
        {
            evt.Resolve();
            Singleton <EventManager> .Instance.FireEvent(new EvtBeingHit(evt.toID, base.runtimeID, evt.animEventID, evt.attackData), MPEventDispatchMode.Normal);

            return(true);
        }
Exemple #3
0
        private bool OnHittingOther(EvtHittingOther evt)
        {
            float amount = evt.attackData.attackerAttackValue * base.instancedAbility.Evaluate(this.config.HPStealRatio);

            base.actor.HealHP(amount);
            return(true);
        }
        private bool OnHittingOtherResolve(EvtHittingOther evt)
        {
            bool flag = false;

            if (this.config.ModifyAllAnimEvents)
            {
                flag = true;
            }
            else
            {
                flag = Miscs.ArrayContains <string>(this.config.AnimEventIDs, evt.animEventID);
            }
            if (!base.actor.abilityPlugin.EvaluateAbilityPredicate(this.config.Predicates, base.instancedAbility, base.instancedModifier, Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(evt.toID), evt))
            {
                return(false);
            }
            if (flag)
            {
                evt.attackData.attackerCritChance        += base.instancedAbility.Evaluate(this.config.CritChanceDelta);
                evt.attackData.attackerCritDamageRatio   += base.instancedAbility.Evaluate(this.config.CritDamageRatioDelta);
                evt.attackData.attackerAniDamageRatio    += base.instancedAbility.Evaluate(this.config.AnimDamageRatioDelta);
                evt.attackData.attackerAttackPercentage  += base.instancedAbility.Evaluate(this.config.DamagePercentageDelta);
                evt.attackData.attackerShieldDamageRatio += base.instancedAbility.Evaluate(this.config.ShieldDamageDelta);
                evt.attackData.attackerAttackValue       += base.instancedAbility.Evaluate(this.config.AttackValueDelta);
                base.actor.abilityPlugin.HandleActionTargetDispatch(this.config.Actions, base.instancedAbility, base.instancedModifier, Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(evt.toID), evt);
            }
            return(true);
        }
Exemple #5
0
 private bool OnPostHittingOther(EvtHittingOther evt)
 {
     if (base.actor.abilityPlugin.EvaluateAbilityPredicate(this.config.Predicates, base.instancedAbility, base.instancedModifier, Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(evt.toID), evt) && this.config.NoTriggerEvadeAndDefend)
     {
         evt.attackData.noTriggerEvadeAndDefend = this.config.NoTriggerEvadeAndDefend;
     }
     return(false);
 }
Exemple #6
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);
        }
Exemple #7
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);
     }
 }
Exemple #8
0
 public static EvtHittingOther Deserialize(Packet_Event_EvtHittingOther table, EvtHittingOther obj)
 {
     if (obj == null)
     {
         obj = new EvtHittingOther();
     }
     obj.targetID    = table.TargetID;
     obj.toID        = table.ToID;
     obj.animEventID = table.AnimEventID;
     if (table.GetAttackData(GetCachedTable <MPAttackData>()) != null)
     {
         obj.attackData = Deserialize(GetCachedTable <MPAttackData>(), new AttackData());
     }
     if (table.GetHitCollision(GetCachedTable <MPHitCollision>()) != null)
     {
         obj.hitCollision = Deserialize(GetCachedTable <MPHitCollision>(), new AttackResult.HitCollsion());
     }
     return(obj);
 }
 private bool OnHittingOther(EvtHittingOther evt)
 {
     if (!this.config.IncludeNonAnimEventAttacks && !evt.attackData.isAnimEventAttack)
     {
         return(false);
     }
     if (!base.actor.abilityPlugin.EvaluateAbilityPredicate(this.config.Predicates, base.instancedAbility, base.instancedModifier, Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(evt.toID), evt))
     {
         return(false);
     }
     if (UnityEngine.Random.value >= base.instancedAbility.Evaluate(this.config.ModifyChance))
     {
         return(false);
     }
     this.ModifyDamage(evt, 1f);
     base.actor.abilityPlugin.HandleActionTargetDispatch(this.config.Actions, base.instancedAbility, base.instancedModifier, Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(evt.toID), evt);
     evt.attackData.attackerAniDamageRatio += base.instancedAbility.Evaluate(this.config.AniDamageRatio);
     base.actor.abilityPlugin.HandleActionTargetDispatch(this.config.BreakActions, base.instancedAbility, base.instancedModifier, Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(evt.toID), evt);
     return(true);
 }
 private bool OnHittingOther(EvtHittingOther evt)
 {
     if (!string.IsNullOrEmpty(evt.animEventID))
     {
         if (evt.toID != this._lastTargetID)
         {
             if (this._lastTargetID != 0)
             {
                 base.actor.abilityPlugin.HandleActionTargetDispatch(this.config.OnTargetFadeOrChanged, base.instancedAbility, base.instancedModifier, null, null);
             }
             this._lastTargetID = evt.toID;
         }
         else
         {
             base.actor.abilityPlugin.HandleActionTargetDispatch(this.config.OnAttackSameTarget, base.instancedAbility, base.instancedModifier, Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(evt.toID), evt);
             this._fadeTimer.Reset(true);
         }
     }
     return(true);
 }
Exemple #11
0
        private bool OnHittingOther(EvtHittingOther evt)
        {
            bool flag = false;

            if (!evt.attackData.isAnimEventAttack)
            {
                return(false);
            }
            if (this._animEventIDs != null)
            {
                if (Miscs.ArrayContains <string>(this._animEventIDs, evt.animEventID))
                {
                    flag = true;
                }
            }
            else
            {
                flag = true;
            }
            if (flag)
            {
                BaseAbilityActor actor = Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(evt.toID);

                if ((actor == null) || !actor.IsActive())
                {
                    return(false);
                }
                Vector3 from  = base.actor.entity.transform.position - actor.entity.transform.position;
                float   num   = Vector3.Angle(base.actor.entity.transform.forward, actor.entity.transform.forward);
                float   num2  = Vector3.Angle(from, actor.entity.transform.forward);
                bool    flag2 = (num < this._forwardAngleRangeMax) && (num > this._forwardAngleRangeMin);
                bool    flag3 = (num2 < this._posAngleRangeMax) && (num2 > this._posAngleRangeMin);
                bool    flag4 = from.magnitude < this._backHitRange;
                if ((flag2 && flag3) && flag4)
                {
                    evt.attackData.addedDamageRatio += base.instancedAbility.Evaluate(this.config.BackDamageRatio);
                    base.actor.abilityPlugin.HandleActionTargetDispatch(this.config.Actions, base.instancedAbility, base.instancedModifier, base.actor, evt);
                }
            }
            return(true);
        }
 protected virtual void ModifyDamage(EvtHittingOther evt, float multiple = 1)
 {
     evt.attackData.attackerCritChance                += base.instancedAbility.Evaluate(this.config.CritChanceDelta) * multiple;
     evt.attackData.attackerCritDamageRatio           += base.instancedAbility.Evaluate(this.config.CritDamageRatioDelta) * multiple;
     evt.attackData.attackerAniDamageRatio            += base.instancedAbility.Evaluate(this.config.AnimDamageRatioDelta) * multiple;
     evt.attackData.addedAttackRatio                  += base.instancedAbility.Evaluate(this.config.AddedAttackRatio) * multiple;
     evt.attackData.addedDamageRatio                  += base.instancedAbility.Evaluate(this.config.AddedDamageRatio) * multiple;
     evt.attackData.attackerAddedAttackValue          += base.instancedAbility.Evaluate(this.config.AddedDamageValue) * multiple;
     evt.attackData.attackerAttackPercentage          += base.instancedAbility.Evaluate(this.config.AddedDamagePercentage) * multiple;
     evt.attackData.attackerNormalDamage              += base.instancedAbility.Evaluate(this.config.NormalDamage) * multiple;
     evt.attackData.attackerFireDamage                += base.instancedAbility.Evaluate(this.config.FireDamage) * multiple;
     evt.attackData.attackerThunderDamage             += base.instancedAbility.Evaluate(this.config.ThunderDamage) * multiple;
     evt.attackData.attackerIceDamage                 += base.instancedAbility.Evaluate(this.config.IceDamage) * multiple;
     evt.attackData.attackerAlienDamage               += base.instancedAbility.Evaluate(this.config.AllienDamage) * multiple;
     evt.attackData.attackerNormalDamagePercentage    += base.instancedAbility.Evaluate(this.config.NormalDamagePercentage) * multiple;
     evt.attackData.attackerFireDamagePercentage      += base.instancedAbility.Evaluate(this.config.FireDamagePercentage) * multiple;
     evt.attackData.attackerThunderDamagePercentage   += base.instancedAbility.Evaluate(this.config.ThunderDamagePercentage) * multiple;
     evt.attackData.attackerIceDamagePercentage       += base.instancedAbility.Evaluate(this.config.IceDamagePercentage) * multiple;
     evt.attackData.attackerAlienDamagePercentage     += base.instancedAbility.Evaluate(this.config.AllienDamagePercentage) * multiple;
     evt.attackData.attackerAddedAllDamageReduceRatio += base.instancedAbility.Evaluate(this.config.AllDamageReduceRatio) * multiple;
 }
Exemple #13
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);
        }
        protected virtual bool ListenBulletHit(EvtBulletHit evt)
        {
            if (!this._bulletAttackDatas.ContainsKey(evt.targetID))
            {
                return(false);
            }
            AttackData attackData = this._bulletAttackDatas[evt.targetID];

            attackData.isFromBullet = true;
            bool           flag   = this.baseConfig.BulletHitType == BulletHitBehavior.DestroyAndDoExplodeDamage;
            bool           flag2  = (this.baseConfig.BulletHitType == BulletHitBehavior.DestroyAndDoExplodeDamage) || (this.baseConfig.BulletHitType == BulletHitBehavior.DestroyAndDamageHitTarget);
            bool           flag3  = true;
            bool           flag4  = this.baseConfig.BulletHitType == BulletHitBehavior.NoDestroyAndRefresh;
            BaseMonoEntity entity = Singleton <EventManager> .Instance.GetEntity(evt.otherID);

            BaseAbilityActor actor = Singleton <EventManager> .Instance.GetActor(evt.otherID) as BaseAbilityActor;

            if (entity is MonoDummyDynamicObject)
            {
                flag2 = false;
                flag  = false;
                flag3 = false;
                flag4 = false;
            }
            else if (evt.hitEnvironment)
            {
                flag2 = true;
                flag4 = false;
            }
            else if ((!evt.cannotBeReflected && (actor != null)) && actor.abilityState.ContainsState(AbilityState.ReflectBullet))
            {
                Singleton <EventManager> .Instance.FireEvent(new EvtAfterBulletReflected(evt.otherID, evt.targetID, base.actor.runtimeID, this._bulletAttackDatas[evt.targetID]), MPEventDispatchMode.Normal);

                return(false);
            }
            AbilityTriggerBullet bulletActor = Singleton <EventManager> .Instance.GetActor <AbilityTriggerBullet>(evt.targetID);

            if (flag2)
            {
                if (bulletActor != null)
                {
                    bulletActor.Kill();
                }
                this._bulletAttackDatas.Remove(evt.targetID);
            }
            else
            {
                attackData = attackData.Clone();
            }
            if (flag4 && (bulletActor != null))
            {
                bulletActor.triggerBullet.ResetInside(this.baseConfig.ResetTime);
            }
            this._evtsLs.Clear();
            if (evt.hitEnvironment)
            {
                if (!evt.hitGround)
                {
                    return(true);
                }
                EvtHittingOther item = new EvtHittingOther(base.actor.runtimeID, evt.otherID, attackData)
                {
                    hitCollision = evt.hitCollision
                };
                this._evtsLs.Add(item);
            }
            else
            {
                attackData.hitCollision = evt.hitCollision;
                this._evtsLs.Add(new EvtHittingOther(base.actor.runtimeID, evt.otherID, this.baseConfig.HitAnimEventID, attackData));
            }
            if (flag)
            {
                List <CollisionResult> list = CollisionDetectPattern.CylinderCollisionDetectBySphere(evt.hitCollision.hitPoint, evt.hitCollision.hitPoint, base.instancedAbility.Evaluate(this.baseConfig.HitExplodeRadius), 1f, Singleton <EventManager> .Instance.GetAbilityHitboxTargettingMask(base.actor.runtimeID, this.baseConfig.Targetting));
                float y = evt.hitCollision.hitPoint.y;
                for (int j = 0; j < list.Count; j++)
                {
                    CollisionResult result = list[j];
                    BaseMonoEntity  collisionResultEntity = AttackPattern.GetCollisionResultEntity(result.entity);
                    if ((collisionResultEntity != null) && (collisionResultEntity.GetRuntimeID() != evt.otherID))
                    {
                        result.hitPoint.y = y;
                        AttackData data2 = attackData.Clone();
                        AttackResult.HitCollsion collsion = new AttackResult.HitCollsion {
                            hitDir   = result.hitForward,
                            hitPoint = result.hitPoint
                        };
                        data2.hitCollision = collsion;
                        this._evtsLs.Add(new EvtHittingOther(base.actor.runtimeID, collisionResultEntity.GetRuntimeID(), this.baseConfig.HitAnimEventID, data2));
                    }
                }
            }
            if (flag3)
            {
                Vector3 hitPoint = evt.hitCollision.hitPoint;
                if (this.baseConfig.ExplodeEffectGround)
                {
                    hitPoint.y = 0f;
                }
                Vector3 hitDir = evt.hitCollision.hitDir;
                hitDir.y = 0f;
                bool selfExplode = evt.selfExplode;
                if (bulletActor != null)
                {
                    this.FireTriggerBulletHitExplodeEffect(bulletActor, hitPoint, hitDir, selfExplode);
                }
            }
            if ((this.baseConfig.HitExplodeActions.Length > 0) && (!evt.selfExplode || !this.baseConfig.MuteSelfHitExplodeActions))
            {
                for (int k = 0; k < this._evtsLs.Count; k++)
                {
                    if (base.actor.abilityPlugin != null)
                    {
                        base.actor.abilityPlugin.HandleActionTargetDispatch(this.baseConfig.HitExplodeActions, base.instancedAbility, base.instancedModifier, Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(this._evtsLs[k].toID), evt);
                    }
                }
            }
            for (int i = 0; i < this._evtsLs.Count; i++)
            {
                EvtHittingOther other2 = this._evtsLs[i];
                if (this.baseConfig.IsHitChangeTargetDirection && (other2.attackData.hitEffect >= AttackResult.AnimatorHitEffect.ThrowUp))
                {
                    BaseAbilityActor actor2 = Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(other2.toID);

                    if (actor2 != null)
                    {
                        actor2.entity.transform.forward = -other2.attackData.hitCollision.hitDir;
                    }
                }
                Singleton <EventManager> .Instance.FireEvent(other2, MPEventDispatchMode.Normal);
            }
            return(true);
        }
        protected override void ModifyDamage(EvtHittingOther evt, float multiple = 1)
        {
            multiple = 0f;
            switch (this.config.MultipleType)
            {
            case ModifyDamageWithMultiMixin.DamageMultipleType.BySelfCurrentSPAmount:
                multiple = (float)base.actor.SP;
                if (this.config.ClearAllSP)
                {
                    base.actor.HealSP((float)-base.actor.SP);
                }
                break;

            case ModifyDamageWithMultiMixin.DamageMultipleType.BySelfMaxSPAmount:
                multiple = (float)base.actor.maxSP;
                break;

            case ModifyDamageWithMultiMixin.DamageMultipleType.ByTargetAbilityState:
                BaseAbilityActor[] alliedActorsOf;
                switch (this.config.Targetting)
                {
                case MixinTargetting.Allied:
                    alliedActorsOf = Singleton <EventManager> .Instance.GetAlliedActorsOf <BaseAbilityActor>(base.actor);

                    multiple = this.GetTargetCountWithAbilityState(alliedActorsOf);
                    goto Label_0192;

                case MixinTargetting.Enemy:
                    alliedActorsOf = Singleton <EventManager> .Instance.GetEnemyActorsOf <BaseAbilityActor>(base.actor);

                    multiple = this.GetTargetCountWithAbilityState(alliedActorsOf);
                    goto Label_0192;

                case MixinTargetting.All:
                    alliedActorsOf = Singleton <EventManager> .Instance.GetActorByCategory <BaseAbilityActor>(3);

                    multiple       = this.GetTargetCountWithAbilityState(alliedActorsOf);
                    alliedActorsOf = Singleton <EventManager> .Instance.GetActorByCategory <BaseAbilityActor>(4);

                    multiple += this.GetTargetCountWithAbilityState(alliedActorsOf);
                    goto Label_0192;
                }
                break;

            case ModifyDamageWithMultiMixin.DamageMultipleType.ByTargetDistance:
            {
                BaseMonoEntity entity = Singleton <EventManager> .Instance.GetEntity(evt.toID);

                if (entity != null)
                {
                    Vector3 vector = entity.XZPosition - base.instancedAbility.caster.entity.XZPosition;
                    multiple = vector.magnitude;
                }
                break;
            }

            case ModifyDamageWithMultiMixin.DamageMultipleType.ByLevelCurrentCombo:
                multiple = (float)Singleton <LevelManager> .Instance.levelActor.levelCombo;
                break;
            }
Label_0192:
            multiple -= this.config.BaseMultiple;
            if (multiple < 0f)
            {
                multiple = 0f;
            }
            if ((base.instancedAbility.Evaluate(this.config.MaxMultiple) > 0f) && (multiple > base.instancedAbility.Evaluate(this.config.MaxMultiple)))
            {
                multiple = base.instancedAbility.Evaluate(this.config.MaxMultiple);
            }
            base.ModifyDamage(evt, multiple);
        }
Exemple #16
0
        public static Offset <Packet_Event_EvtHittingOther> Serialize(FlatBufferBuilder builder, EvtHittingOther obj)
        {
            StringOffset animEventIDOffset = new StringOffset();

            if (obj.animEventID != null)
            {
                animEventIDOffset = builder.CreateString(obj.animEventID);
            }
            Offset <MPAttackData> attackDataOffset = new Offset <MPAttackData>();

            if (obj.attackData != null)
            {
                attackDataOffset = Serialize(builder, obj.attackData);
            }
            Offset <MPHitCollision> hitCollisionOffset = new Offset <MPHitCollision>();

            if (obj.hitCollision != null)
            {
                hitCollisionOffset = Serialize(builder, obj.hitCollision);
            }
            Packet_Event_EvtHittingOther.StartPacket_Event_EvtHittingOther(builder);
            Packet_Event_EvtHittingOther.AddTargetID(builder, obj.targetID);
            Packet_Event_EvtHittingOther.AddToID(builder, obj.toID);
            Packet_Event_EvtHittingOther.AddAnimEventID(builder, animEventIDOffset);
            Packet_Event_EvtHittingOther.AddAttackData(builder, attackDataOffset);
            Packet_Event_EvtHittingOther.AddHitCollision(builder, hitCollisionOffset);
            return(Packet_Event_EvtHittingOther.EndPacket_Event_EvtHittingOther(builder));
        }
        protected override bool ListenBulletHit(EvtBulletHit evt)
        {
            if (!base._bulletAttackDatas.ContainsKey(evt.targetID))
            {
                return(false);
            }
            BaseMPIdentity identity = Singleton <MPManager> .Instance.TryGetIdentity(evt.otherID);

            if (((identity != null) && !identity.isAuthority) && !identity.remoteMode.IsRemoteReceive())
            {
                return(false);
            }
            AttackData attackData = base._bulletAttackDatas[evt.targetID];

            attackData.isFromBullet = true;
            bool           flag   = base.baseConfig.BulletHitType == BulletHitBehavior.DestroyAndDoExplodeDamage;
            bool           flag2  = (base.baseConfig.BulletHitType == BulletHitBehavior.DestroyAndDoExplodeDamage) || (base.baseConfig.BulletHitType == BulletHitBehavior.DestroyAndDamageHitTarget);
            bool           flag3  = true;
            bool           flag4  = base.baseConfig.BulletHitType == BulletHitBehavior.NoDestroyAndRefresh;
            BaseMonoEntity entity = Singleton <EventManager> .Instance.GetEntity(evt.otherID);

            BaseAbilityActor actor = Singleton <EventManager> .Instance.GetActor(evt.otherID) as BaseAbilityActor;

            if ((entity is MonoDummyDynamicObject) || ((identity != null) && !identity.remoteMode.IsRemoteReceive()))
            {
                flag2 = false;
                flag  = false;
                flag3 = false;
                flag4 = false;
            }
            else if (evt.hitEnvironment)
            {
                flag2 = true;
                flag4 = false;
            }
            else if ((!evt.cannotBeReflected && (actor != null)) && actor.abilityState.ContainsState(AbilityState.ReflectBullet))
            {
                Singleton <EventManager> .Instance.FireEvent(new EvtAfterBulletReflected(evt.otherID, evt.targetID, base.actor.runtimeID, base._bulletAttackDatas[evt.targetID]), MPEventDispatchMode.Normal);

                return(false);
            }
            AbilityTriggerBullet bulletActor = Singleton <EventManager> .Instance.GetActor <AbilityTriggerBullet>(evt.targetID);

            if (flag2)
            {
                bulletActor.Kill();
                base._bulletAttackDatas.Remove(evt.targetID);
            }
            else
            {
                attackData = attackData.Clone();
            }
            if (flag4)
            {
                bulletActor.triggerBullet.ResetInside(base.baseConfig.ResetTime);
            }
            base._evtsLs.Clear();
            if (evt.hitEnvironment)
            {
                if (!evt.hitGround)
                {
                    return(true);
                }
                EvtHittingOther item = new EvtHittingOther(base.actor.runtimeID, evt.otherID, attackData)
                {
                    hitCollision = evt.hitCollision
                };
                base._evtsLs.Add(item);
            }
            else
            {
                attackData.hitCollision = evt.hitCollision;
                base._evtsLs.Add(new EvtHittingOther(base.actor.runtimeID, evt.otherID, base.baseConfig.HitAnimEventID, attackData));
            }
            if (flag)
            {
                List <CollisionResult> list = CollisionDetectPattern.CylinderCollisionDetectBySphere(evt.hitCollision.hitPoint, evt.hitCollision.hitPoint, base.instancedAbility.Evaluate(base.baseConfig.HitExplodeRadius), 1f, Singleton <EventManager> .Instance.GetAbilityHitboxTargettingMask(base.actor.runtimeID, base.baseConfig.Targetting));
                float y = evt.hitCollision.hitPoint.y;
                for (int j = 0; j < list.Count; j++)
                {
                    CollisionResult result = list[j];
                    BaseMonoEntity  collisionResultEntity = AttackPattern.GetCollisionResultEntity(result.entity);
                    if ((collisionResultEntity != null) && (collisionResultEntity.GetRuntimeID() != evt.otherID))
                    {
                        result.hitPoint.y = y;
                        AttackData data2 = attackData.Clone();
                        AttackResult.HitCollsion collsion = new AttackResult.HitCollsion {
                            hitDir   = result.hitForward,
                            hitPoint = result.hitPoint
                        };
                        data2.hitCollision = collsion;
                        base._evtsLs.Add(new EvtHittingOther(base.actor.runtimeID, collisionResultEntity.GetRuntimeID(), base.baseConfig.HitAnimEventID, data2));
                    }
                }
            }
            if (flag3)
            {
                Vector3 hitPoint = evt.hitCollision.hitPoint;
                if (base.baseConfig.ExplodeEffectGround)
                {
                    hitPoint.y = 0f;
                }
                Vector3 hitDir = evt.hitCollision.hitDir;
                hitDir.y = 0f;
                base.FireTriggerBulletHitExplodeEffect(bulletActor, hitPoint, hitDir, false);
            }
            if (base.baseConfig.HitExplodeActions.Length > 0)
            {
                for (int k = 0; k < base._evtsLs.Count; k++)
                {
                    base.actor.abilityPlugin.HandleActionTargetDispatch(base.baseConfig.HitExplodeActions, base.instancedAbility, base.instancedModifier, Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(base._evtsLs[k].toID), evt);
                }
            }
            for (int i = 0; i < base._evtsLs.Count; i++)
            {
                EvtHittingOther other2 = base._evtsLs[i];
                AttackPattern.SendHitEvent(base.actor.runtimeID, other2.toID, other2.animEventID, other2.hitCollision, other2.attackData, false, MPEventDispatchMode.CheckRemoteMode);
            }
            return(true);
        }
Exemple #18
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));
 }