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 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); }
public EvtEvadeSuccess(uint targetID, uint attackerID, string skillID, AttackData attackData) : base(targetID) { this.attackerID = attackerID; this.skillID = skillID; this.attackData = attackData; }
public EvtAfterBulletReflected(uint targetID, uint bulletID, uint launcherID, AttackData attackData) : base(targetID) { this.bulletID = bulletID; this.launcherID = launcherID; this.attackData = attackData; }
public static Offset <MPAttackData> Serialize(FlatBufferBuilder builder, AttackData obj) { Offset <MPHitCollision> hitCollisionOffset = new Offset <MPHitCollision>(); if (obj.hitCollision != null) { hitCollisionOffset = Serialize(builder, obj.hitCollision); } MPAttackData.StartMPAttackData(builder); MPAttackData.AddAttackerAniDamageRatio(builder, obj.attackerAniDamageRatio); MPAttackData.AddAttackerClass(builder, (byte)obj.attackerClass); MPAttackData.AddAttackerNature(builder, (byte)obj.attackerNature); MPAttackData.AddAttackerCategory(builder, obj.attackerCategory); MPAttackData.AddAttackerCritChance(builder, obj.attackerCritChance); MPAttackData.AddAttackerCritDamageRatio(builder, obj.attackerCritDamageRatio); MPAttackData.AddAttackerLevel(builder, obj.attackerLevel); MPAttackData.AddAttackerShieldDamageRatio(builder, obj.attackerShieldDamageRatio); MPAttackData.AddAttackerShieldDamageDelta(builder, obj.attackerShieldDamageDelta); MPAttackData.AddAttackerAttackPercentage(builder, obj.attackerAttackPercentage); MPAttackData.AddAttackerAttackValue(builder, obj.attackerAttackValue); MPAttackData.AddAddedAttackRatio(builder, obj.addedAttackRatio); MPAttackData.AddAddedDamageRatio(builder, obj.addedDamageRatio); MPAttackData.AddAttackerAddedAttackValue(builder, obj.attackerAddedAttackValue); MPAttackData.AddAttackerNormalDamage(builder, obj.attackerNormalDamage); MPAttackData.AddAttackerNormalDamagePercentage(builder, obj.attackerNormalDamagePercentage); MPAttackData.AddAddedAttackerNormalDamageRatio(builder, obj.addedAttackerNormalDamageRatio); MPAttackData.AddAttackerFireDamage(builder, obj.attackerFireDamage); MPAttackData.AddAttackerFireDamagePercentage(builder, obj.attackerFireDamagePercentage); MPAttackData.AddAddedAttackerFireDamageRatio(builder, obj.addedAttackerFireDamageRatio); MPAttackData.AddAttackerThunderDamage(builder, obj.attackerThunderDamage); MPAttackData.AddAttackerThunderDamagePercentage(builder, obj.attackerThunderDamagePercentage); MPAttackData.AddAddedAttackerThunderDamageRatio(builder, obj.addedAttackerThunderDamageRatio); MPAttackData.AddAttackerIceDamage(builder, obj.attackerIceDamage); MPAttackData.AddAttackerIceDamagePercentage(builder, obj.attackerIceDamagePercentage); MPAttackData.AddAddedAttackerIceDamageRatio(builder, obj.addedAttackerIceDamageRatio); MPAttackData.AddAttackerAlienDamage(builder, obj.attackerAlienDamage); MPAttackData.AddAttackerAlienDamagePercentage(builder, obj.attackerAlienDamagePercentage); MPAttackData.AddAddedAttackerAlienDamageRatio(builder, obj.addedAttackerAlienDamageRatio); MPAttackData.AddAttackeeAniDefenceRatio(builder, obj.attackeeAniDefenceRatio); MPAttackData.AddAttackeeNature(builder, (byte)obj.attackeeNature); MPAttackData.AddAttackeeClass(builder, (byte)obj.attackeeClass); MPAttackData.AddNatureDamageRatio(builder, obj.natureDamageRatio); MPAttackData.AddDamage(builder, obj.damage); MPAttackData.AddPlainDamage(builder, obj.plainDamage); MPAttackData.AddThunderDamage(builder, obj.thunderDamage); MPAttackData.AddIceDamage(builder, obj.iceDamage); MPAttackData.AddAlienDamage(builder, obj.alienDamage); MPAttackData.AddAniDamageRatio(builder, obj.aniDamageRatio); MPAttackData.AddRetreatVelocity(builder, obj.retreatVelocity); MPAttackData.AddFrameHalt(builder, obj.frameHalt); MPAttackData.AddIsAnimEventAttack(builder, obj.isAnimEventAttack); MPAttackData.AddIsInComboCount(builder, obj.isInComboCount); MPAttackData.AddAttackCategoryTag(builder, (int)obj.attackCategoryTag); MPAttackData.AddHitType(builder, (byte)obj.hitType); MPAttackData.AddHitFlag(builder, (int)obj.hitFlag); MPAttackData.AddHitLevel(builder, (byte)obj.hitLevel); MPAttackData.AddHitEffect(builder, (byte)obj.hitEffect); MPAttackData.AddHitEffectAux(builder, (byte)obj.hitEffectAux); MPAttackData.AddHitEffectPattern(builder, (byte)obj.hitEffectPattern); MPAttackData.AddKillEffect(builder, (byte)obj.killEffect); MPAttackData.AddRejectState(builder, (byte)obj.rejectState); MPAttackData.AddIsFromBullet(builder, obj.isFromBullet); MPAttackData.AddNoTriggerEvadeAndDefend(builder, obj.noTriggerEvadeAndDefend); MPAttackData.AddHitCollision(builder, hitCollisionOffset); MPAttackData.AddAttackEffectPattern(builder, (ushort)IndexedConfig <ConfigEntityAttackEffect> .Mapping.TryGet(obj.attackEffectPattern)); MPAttackData.AddBeHitEffectPattern(builder, (ushort)IndexedConfig <ConfigEntityAttackEffect> .Mapping.TryGet(obj.beHitEffectPattern)); MPAttackData.AddAttackCameraShake(builder, (ushort)IndexedConfig <ConfigEntityCameraShake> .Mapping.TryGet(obj.attackCameraShake)); return(MPAttackData.EndMPAttackData(builder)); }
public static AttackData Deserialize(MPAttackData table, AttackData obj) { if (obj == null) { obj = new AttackData(); } obj.attackerAniDamageRatio = table.AttackerAniDamageRatio; obj.attackerClass = (EntityClass)table.AttackerClass; obj.attackerNature = (EntityNature)table.AttackerNature; obj.attackerCategory = table.AttackerCategory; obj.attackerCritChance = table.AttackerCritChance; obj.attackerCritDamageRatio = table.AttackerCritDamageRatio; obj.attackerLevel = table.AttackerLevel; obj.attackerShieldDamageRatio = table.AttackerShieldDamageRatio; obj.attackerShieldDamageDelta = table.AttackerShieldDamageDelta; obj.attackerAttackPercentage = table.AttackerAttackPercentage; obj.attackerAttackValue = table.AttackerAttackValue; obj.addedAttackRatio = table.AddedAttackRatio; obj.addedDamageRatio = table.AddedDamageRatio; obj.attackerAddedAttackValue = table.AttackerAddedAttackValue; obj.attackerNormalDamage = table.AttackerNormalDamage; obj.attackerNormalDamagePercentage = table.AttackerNormalDamagePercentage; obj.addedAttackerNormalDamageRatio = table.AddedAttackerNormalDamageRatio; obj.attackerFireDamage = table.AttackerFireDamage; obj.attackerFireDamagePercentage = table.AttackerFireDamagePercentage; obj.addedAttackerFireDamageRatio = table.AddedAttackerFireDamageRatio; obj.attackerThunderDamage = table.AttackerThunderDamage; obj.attackerThunderDamagePercentage = table.AttackerThunderDamagePercentage; obj.addedAttackerThunderDamageRatio = table.AddedAttackerThunderDamageRatio; obj.attackerIceDamage = table.AttackerIceDamage; obj.attackerIceDamagePercentage = table.AttackerIceDamagePercentage; obj.addedAttackerIceDamageRatio = table.AddedAttackerIceDamageRatio; obj.attackerAlienDamage = table.AttackerAlienDamage; obj.attackerAlienDamagePercentage = table.AttackerAlienDamagePercentage; obj.addedAttackerAlienDamageRatio = table.AddedAttackerAlienDamageRatio; obj.attackeeAniDefenceRatio = table.AttackeeAniDefenceRatio; obj.attackeeNature = (EntityNature)table.AttackeeNature; obj.attackeeClass = (EntityClass)table.AttackeeClass; obj.natureDamageRatio = table.NatureDamageRatio; 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); }
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)); }