| using System; |
| using System; |
| using System.Collections.Generic; |
| using System.Collections.Generic; |
| using System.Text; |
| using System.Text; |
| using UnityEngine; |
| using UnityEngine; |
| |
| |
| . | public class Aoe : MonoBehaviour, IProjectile |
| public class Aoe : MonoBehaviour, IProjectile, IMonoUpdater |
| { |
| { |
| private void Awake() |
| private void Awake() |
| { |
| { |
| this.m_nview = base.GetComponentInParent<ZNetView>(); |
| this.m_nview = base.GetComponentInParent<ZNetView>(); |
| this.m_rayMask = 0; |
| this.m_rayMask = 0; |
| if (this.m_hitCharacters) |
| if (this.m_hitCharacters) |
| { |
| { |
| this.m_rayMask |= LayerMask.GetMask(new string[] { "character", "character_net", "character_ghost" }); |
| this.m_rayMask |= LayerMask.GetMask(new string[] { "character", "character_net", "character_ghost" }); |
| } |
| } |
| if (this.m_hitProps) |
| if (this.m_hitProps) |
| { |
| { |
| this.m_rayMask |= LayerMask.GetMask(new string[] { "Default", "static_solid", "Default_small", "piece", "hitbox", "character_noenv", "vehicle" }); |
| this.m_rayMask |= LayerMask.GetMask(new string[] { "Default", "static_solid", "Default_small", "piece", "hitbox", "character_noenv", "vehicle" }); |
| } |
| } |
| . | |
| if (this.m_hitTerrain) |
| |
| { |
| |
| this.m_rayMask |= LayerMask.GetMask(new string[] { "terrain" }); |
| |
| } |
| if (!string.IsNullOrEmpty(this.m_statusEffect)) |
| if (!string.IsNullOrEmpty(this.m_statusEffect)) |
| { |
| { |
| this.m_statusEffectHash = this.m_statusEffect.GetStableHashCode(); |
| this.m_statusEffectHash = this.m_statusEffect.GetStableHashCode(); |
| } |
| } |
| if (!string.IsNullOrEmpty(this.m_statusEffectIfBoss)) |
| if (!string.IsNullOrEmpty(this.m_statusEffectIfBoss)) |
| { |
| { |
| this.m_statusEffectIfBossHash = this.m_statusEffectIfBoss.GetStableHashCode(); |
| this.m_statusEffectIfBossHash = this.m_statusEffectIfBoss.GetStableHashCode(); |
| } |
| } |
| if (!string.IsNullOrEmpty(this.m_statusEffectIfPlayer)) |
| if (!string.IsNullOrEmpty(this.m_statusEffectIfPlayer)) |
| { |
| { |
| this.m_statusEffectIfPlayerHash = this.m_statusEffectIfPlayer.GetStableHashCode(); |
| this.m_statusEffectIfPlayerHash = this.m_statusEffectIfPlayer.GetStableHashCode(); |
| } |
| } |
| . | |
| this.m_activationTimer = this.m_activationDelay; |
| |
| if (this.m_ttlMax > 0f) |
| |
| { |
| |
| this.m_ttl = UnityEngine.Random.Range(this.m_ttl, this.m_ttlMax); |
| |
| } |
| |
| this.m_chainDelay = this.m_chainStartDelay; |
| |
| if (this.m_chainChance == 0f) |
| |
| { |
| |
| this.m_chainChance = this.m_chainStartChance; |
| |
| } |
| |
| } |
| |
| |
| |
| protected virtual void OnEnable() |
| |
| { |
| |
| this.m_initRun = true; |
| |
| Aoe.Instances.Add(this); |
| |
| } |
| |
| |
| |
| protected virtual void OnDisable() |
| |
| { |
| |
| Aoe.Instances.Remove(this); |
| } |
| } |
| |
| |
| private HitData.DamageTypes GetDamage() |
| private HitData.DamageTypes GetDamage() |
| { |
| { |
| return this.GetDamage(this.m_level); |
| return this.GetDamage(this.m_level); |
| } |
| } |
| |
| |
| private HitData.DamageTypes GetDamage(int itemQuality) |
| private HitData.DamageTypes GetDamage(int itemQuality) |
| { |
| { |
| if (itemQuality <= 1) |
| if (itemQuality <= 1) |
| { |
| { |
| return this.m_damage; |
| return this.m_damage; |
| } |
| } |
| HitData.DamageTypes damage = this.m_damage; |
| HitData.DamageTypes damage = this.m_damage; |
| int num = ((this.m_worldLevel >= 0) ? this.m_worldLevel : Game.m_worldLevel); |
| int num = ((this.m_worldLevel >= 0) ? this.m_worldLevel : Game.m_worldLevel); |
| if (num > 0) |
| if (num > 0) |
| { |
| { |
| damage.IncreaseEqually((float)(num * Game.instance.m_worldLevelGearBaseDamage), true); |
| damage.IncreaseEqually((float)(num * Game.instance.m_worldLevelGearBaseDamage), true); |
| } |
| } |
| . | if (itemQuality > 1) |
| damage.Add(this.m_damagePerLevel, itemQuality - 1); |
| { |
| |
| damage.Add(this.m_damagePerLevel, itemQuality - 1); |
| |
| } |
| |
| return damage; |
| return damage; |
| } |
| } |
| |
| |
| public string GetTooltipString(int itemQuality) |
| public string GetTooltipString(int itemQuality) |
| { |
| { |
| StringBuilder stringBuilder = new StringBuilder(256); |
| StringBuilder stringBuilder = new StringBuilder(256); |
| stringBuilder.Append("AOE"); |
| stringBuilder.Append("AOE"); |
| stringBuilder.Append(this.GetDamage(itemQuality).GetTooltipString()); |
| stringBuilder.Append(this.GetDamage(itemQuality).GetTooltipString()); |
| stringBuilder.AppendFormat("\n$item_knockback: <color=orange>{0}</color>", this.m_attackForce); |
| stringBuilder.AppendFormat("\n$item_knockback: <color=orange>{0}</color>", this.m_attackForce); |
| stringBuilder.AppendFormat("\n$item_backstab: <color=orange>{0}x</color>", this.m_backstabBonus); |
| stringBuilder.AppendFormat("\n$item_backstab: <color=orange>{0}x</color>", this.m_backstabBonus); |
| return stringBuilder.ToString(); |
| return stringBuilder.ToString(); |
| } |
| } |
| |
| |
| . | private void Start() |
| private void Update() |
| { |
| { |
| . | if (this.m_nview != null && (!this.m_nview.IsValid() || !this.m_nview.IsOwner())) |
| if (this.m_activationTimer > 0f) |
| { |
| { |
| . | return; |
| this.m_activationTimer -= Time.deltaTime; |
| } |
| } |
| . | if (!this.m_useTriggers && this.m_hitInterval <= 0f) |
| if (this.m_hitInterval > 0f && this.m_useTriggers) |
| { |
| { |
| . | this.CheckHits(); |
| this.m_hitTimer -= Time.deltaTime; |
| |
| if (this.m_hitTimer <= 0f) |
| |
| { |
| |
| this.m_hitTimer = this.m_hitInterval; |
| |
| this.m_hitList.Clear(); |
| |
| } |
| } |
| } |
| } |
| } |
| |
| |
| . | private void FixedUpdate() |
| public void CustomFixedUpdate(float fixedDeltaTime) |
| { |
| { |
| . | if (this.m_nview != null && (!this.m_nview.IsValid() || !this.m_nview.IsOwner())) |
| if (this.m_nview != null && !this.m_nview.IsOwner()) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| . | if (this.m_hitInterval > 0f) |
| if (this.m_initRun && !this.m_useTriggers && !this.m_hitAfterTtl && this.m_activationTimer <= 0f) |
| { |
| { |
| . | this.m_hitTimer -= Time.fixedDeltaTime; |
| this.m_initRun = false; |
| if (this.m_hitTimer <= 0f) |
| if (this.m_hitInterval <= 0f) |
| { |
| { |
| . | this.m_hitTimer = this.m_hitInterval; |
| this.Initiate(); |
| if (this.m_useTriggers) |
| |
| { |
| |
| this.m_hitList.Clear(); |
| |
| } |
| |
| else |
| |
| { |
| |
| this.CheckHits(); |
| |
| } |
| |
| } |
| } |
| } |
| } |
| if (this.m_owner != null && this.m_attachToCaster) |
| if (this.m_owner != null && this.m_attachToCaster) |
| { |
| { |
| base.transform.position = this.m_owner.transform.TransformPoint(this.m_offset); |
| base.transform.position = this.m_owner.transform.TransformPoint(this.m_offset); |
| base.transform.rotation = this.m_owner.transform.rotation * this.m_localRot; |
| base.transform.rotation = this.m_owner.transform.rotation * this.m_localRot; |
| } |
| } |
| . | |
| if (this.m_activationTimer > 0f) |
| |
| { |
| |
| return; |
| |
| } |
| |
| if (this.m_hitInterval > 0f && !this.m_useTriggers) |
| |
| { |
| |
| this.m_hitTimer -= fixedDeltaTime; |
| |
| if (this.m_hitTimer <= 0f) |
| |
| { |
| |
| this.m_hitTimer = this.m_hitInterval; |
| |
| this.Initiate(); |
| |
| } |
| |
| } |
| |
| if (this.m_chainStartChance > 0f && this.m_chainDelay >= 0f) |
| |
| { |
| |
| this.m_chainDelay -= fixedDeltaTime; |
| |
| if (this.m_chainDelay <= 0f && UnityEngine.Random.value < this.m_chainStartChance) |
| |
| { |
| |
| Vector3 position = base.transform.position; |
| |
| this.FindHits(); |
| |
| this.SortHits(); |
| |
| int num = UnityEngine.Random.Range(this.m_chainMinTargets, this.m_chainMaxTargets + 1); |
| |
| foreach (Collider collider in Aoe.s_hitList) |
| |
| { |
| |
| if (UnityEngine.Random.value < this.m_chainChancePerTarget) |
| |
| { |
| |
| Vector3 position2 = collider.gameObject.transform.position; |
| |
| bool flag = false; |
| |
| for (int i = 0; i < Aoe.s_chainObjs.Count; i++) |
| |
| { |
| |
| if (Aoe.s_chainObjs[i]) |
| |
| { |
| |
| if (Vector3.Distance(Aoe.s_chainObjs[i].transform.position, position2) < 0.1f) |
| |
| { |
| |
| flag = true; |
| |
| break; |
| |
| } |
| |
| } |
| |
| else |
| |
| { |
| |
| Aoe.s_chainObjs.RemoveAt(i); |
| |
| } |
| |
| } |
| |
| if (!flag) |
| |
| { |
| |
| GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.m_chainObj, position2, collider.gameObject.transform.rotation); |
| |
| Aoe.s_chainObjs.Add(gameObject); |
| |
| IProjectile componentInChildren = gameObject.GetComponentInChildren<IProjectile>(); |
| |
| if (componentInChildren != null) |
| |
| { |
| |
| componentInChildren.Setup(this.m_owner, position.DirTo(position2), -1f, this.m_hitData, this.m_itemData, this.m_ammo); |
| |
| Aoe aoe = componentInChildren as Aoe; |
| |
| if (aoe != null) |
| |
| { |
| |
| aoe.m_chainChance = this.m_chainChance * this.m_chainStartChanceFalloff; |
| |
| } |
| |
| } |
| |
| num--; |
| |
| float num2 = Vector3.Distance(position2, base.transform.position); |
| |
| GameObject[] array = this.m_chainEffects.Create(position + Vector3.up, Quaternion.LookRotation(position.DirTo(position2 + Vector3.up)), null, 1f, -1); |
| |
| for (int j = 0; j < array.Length; j++) |
| |
| { |
| |
| array[j].transform.localScale = Vector3.one * num2; |
| |
| } |
| |
| } |
| |
| } |
| |
| if (num <= 0) |
| |
| { |
| |
| break; |
| |
| } |
| |
| } |
| |
| } |
| |
| } |
| if (this.m_ttl > 0f) |
| if (this.m_ttl > 0f) |
| { |
| { |
| . | this.m_ttl -= Time.fixedDeltaTime; |
| this.m_ttl -= fixedDeltaTime; |
| if (this.m_ttl <= 0f && ZNetScene.instance) |
| if (this.m_ttl <= 0f) |
| { |
| { |
| . | ZNetScene.instance.Destroy(base.gameObject); |
| if (this.m_hitAfterTtl) |
| |
| { |
| |
| this.Initiate(); |
| |
| } |
| |
| if (ZNetScene.instance) |
| |
| { |
| |
| ZNetScene.instance.Destroy(base.gameObject); |
| |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| |
| . | |
| public void Initiate() |
| |
| { |
| |
| this.m_initiateEffect.Create(base.transform.position, Quaternion.identity, null, 1f, -1); |
| |
| this.CheckHits(); |
| |
| } |
| |
| |
| private void CheckHits() |
| private void CheckHits() |
| { |
| { |
| . | |
| this.FindHits(); |
| |
| if (this.m_maxTargetsFromCenter > 0) |
| |
| { |
| |
| this.SortHits(); |
| |
| int num = this.m_maxTargetsFromCenter; |
| |
| using (List<Collider>.Enumerator enumerator = Aoe.s_hitList.GetEnumerator()) |
| |
| { |
| |
| while (enumerator.MoveNext()) |
| |
| { |
| |
| Collider collider = enumerator.Current; |
| |
| if (this.OnHit(collider, collider.transform.position)) |
| |
| { |
| |
| num--; |
| |
| } |
| |
| if (num <= 0) |
| |
| { |
| |
| break; |
| |
| } |
| |
| } |
| |
| return; |
| |
| } |
| |
| } |
| |
| for (int i = 0; i < Aoe.s_hitList.Count; i++) |
| |
| { |
| |
| this.OnHit(Aoe.s_hitList[i], Aoe.s_hitList[i].transform.position); |
| |
| } |
| |
| } |
| |
| |
| |
| private void FindHits() |
| |
| { |
| this.m_hitList.Clear(); |
| this.m_hitList.Clear(); |
| . | foreach (Collider collider in (this.m_useCollider != null) ? Physics.OverlapBox(base.transform.position + this.m_useCollider.center, this.m_useCollider.size / 2f, base.transform.rotation, this.m_rayMask) : Physics.OverlapSphere(base.transform.position, this.m_radius, this.m_rayMask)) |
| int num = ((this.m_useCollider != null) ? Physics.OverlapBoxNonAlloc(base.transform.position + this.m_useCollider.center, this.m_useCollider.size / 2f, Aoe.s_hits, base.transform.rotation, this.m_rayMask) : Physics.OverlapSphereNonAlloc(base.transform.position, this.m_radius, Aoe.s_hits, this.m_rayMask)); |
| |
| Aoe.s_hitList.Clear(); |
| |
| for (int i = 0; i < num; i++) |
| { |
| { |
| . | this.OnHit(collider, collider.transform.position); |
| Collider collider = Aoe.s_hits[i]; |
| |
| if (this.ShouldHit(collider)) |
| |
| { |
| |
| Aoe.s_hitList.Add(collider); |
| |
| } |
| } |
| } |
| } |
| } |
| |
| |
| . | |
| private bool ShouldHit(Collider collider) |
| |
| { |
| |
| GameObject gameObject = Projectile.FindHitObject(collider); |
| |
| if (gameObject) |
| |
| { |
| |
| Character component = gameObject.GetComponent<Character>(); |
| |
| if (component != null) |
| |
| { |
| |
| if (this.m_nview == null && !component.IsOwner()) |
| |
| { |
| |
| return false; |
| |
| } |
| |
| if (this.m_owner != null) |
| |
| { |
| |
| if (!this.m_hitOwner && component == this.m_owner) |
| |
| { |
| |
| return false; |
| |
| } |
| |
| if (!this.m_hitSame && component.m_name == this.m_owner.m_name) |
| |
| { |
| |
| return false; |
| |
| } |
| |
| bool flag = BaseAI.IsEnemy(this.m_owner, component) || (component.GetBaseAI() && component.GetBaseAI().IsAggravatable() && this.m_owner.IsPlayer()); |
| |
| if (!this.m_hitFriendly && !flag) |
| |
| { |
| |
| return false; |
| |
| } |
| |
| if (!this.m_hitEnemy && flag) |
| |
| { |
| |
| return false; |
| |
| } |
| |
| } |
| |
| if (!this.m_hitCharacters) |
| |
| { |
| |
| return false; |
| |
| } |
| |
| if (this.m_dodgeable && component.IsDodgeInvincible()) |
| |
| { |
| |
| return false; |
| |
| } |
| |
| } |
| |
| } |
| |
| return true; |
| |
| } |
| |
| |
| |
| private void SortHits() |
| |
| { |
| |
| Aoe.s_hitList.Sort((Collider a, Collider b) => Vector3.Distance(a.transform.position, base.transform.position).CompareTo(Vector3.Distance(b.transform.position, base.transform.position))); |
| |
| } |
| |
| |
| public void Setup(Character owner, Vector3 velocity, float hitNoise, HitData hitData, ItemDrop.ItemData item, ItemDrop.ItemData ammo) |
| public void Setup(Character owner, Vector3 velocity, float hitNoise, HitData hitData, ItemDrop.ItemData item, ItemDrop.ItemData ammo) |
| { |
| { |
| this.m_owner = owner; |
| this.m_owner = owner; |
| if (item != null) |
| if (item != null) |
| { |
| { |
| this.m_level = item.m_quality; |
| this.m_level = item.m_quality; |
| . | |
| this.m_worldLevel = item.m_worldLevel; |
| |
| this.m_itemData = item; |
| } |
| } |
| if (this.m_attachToCaster && owner != null) |
| if (this.m_attachToCaster && owner != null) |
| { |
| { |
| this.m_offset = owner.transform.InverseTransformPoint(base.transform.position); |
| this.m_offset = owner.transform.InverseTransformPoint(base.transform.position); |
| this.m_localRot = Quaternion.Inverse(owner.transform.rotation) * base.transform.rotation; |
| this.m_localRot = Quaternion.Inverse(owner.transform.rotation) * base.transform.rotation; |
| } |
| } |
| if (hitData != null && this.m_useAttackSettings) |
| if (hitData != null && this.m_useAttackSettings) |
| { |
| { |
| this.m_damage = hitData.m_damage; |
| this.m_damage = hitData.m_damage; |
| this.m_blockable = hitData.m_blockable; |
| this.m_blockable = hitData.m_blockable; |
| this.m_dodgeable = hitData.m_dodgeable; |
| this.m_dodgeable = hitData.m_dodgeable; |
| this.m_attackForce = hitData.m_pushForce; |
| this.m_attackForce = hitData.m_pushForce; |
| this.m_backstabBonus = hitData.m_backstabBonus; |
| this.m_backstabBonus = hitData.m_backstabBonus; |
| if (this.m_statusEffectHash != hitData.m_statusEffectHash) |
| if (this.m_statusEffectHash != hitData.m_statusEffectHash) |
| { |
| { |
| this.m_statusEffectHash = hitData.m_statusEffectHash; |
| this.m_statusEffectHash = hitData.m_statusEffectHash; |
| this.m_statusEffect = "<changed>"; |
| this.m_statusEffect = "<changed>"; |
| } |
| } |
| this.m_toolTier = (int)hitData.m_toolTier; |
| this.m_toolTier = (int)hitData.m_toolTier; |
| this.m_skill = hitData.m_skill; |
| this.m_skill = hitData.m_skill; |
| } |
| } |
| . | |
| this.m_ammo = ammo; |
| |
| this.m_hitData = hitData; |
| } |
| } |
| |
| |
| private void OnCollisionEnter(Collision collision) |
| private void OnCollisionEnter(Collision collision) |
| { |
| { |
| . | if (!this.m_triggerEnterOnly) |
| this.CauseTriggerDamage(collision.collider, true); |
| { |
| |
| return; |
| |
| } |
| |
| if (!this.m_useTriggers) |
| |
| { |
| |
| ZLog.LogWarning("AOE got OnTriggerStay but trigger damage is disabled in " + base.gameObject.name); |
| |
| return; |
| |
| } |
| |
| if (this.m_nview != null && (!this.m_nview.IsValid() || !this.m_nview.IsOwner())) |
| |
| { |
| |
| return; |
| |
| } |
| |
| this.OnHit(collision.collider, collision.collider.transform.position); |
| |
| } |
| } |
| |
| |
| private void OnCollisionStay(Collision collision) |
| private void OnCollisionStay(Collision collision) |
| { |
| { |
| . | if (this.m_triggerEnterOnly) |
| this.CauseTriggerDamage(collision.collider, false); |
| { |
| |
| return; |
| |
| } |
| |
| if (!this.m_useTriggers) |
| |
| { |
| |
| ZLog.LogWarning("AOE got OnTriggerStay but trigger damage is disabled in " + base.gameObject.name); |
| |
| return; |
| |
| } |
| |
| if (this.m_nview != null && (!this.m_nview.IsValid() || !this.m_nview.IsOwner())) |
| |
| { |
| |
| return; |
| |
| } |
| |
| this.OnHit(collision.collider, collision.collider.transform.position); |
| |
| } |
| } |
| |
| |
| private void OnTriggerEnter(Collider collider) |
| private void OnTriggerEnter(Collider collider) |
| { |
| { |
| . | if (!this.m_triggerEnterOnly) |
| this.CauseTriggerDamage(collider, true); |
| { |
| |
| return; |
| |
| } |
| |
| if (!this.m_useTriggers) |
| |
| { |
| |
| ZLog.LogWarning("AOE got OnTriggerStay but trigger damage is disabled in " + base.gameObject.name); |
| |
| return; |
| |
| } |
| |
| if (this.m_nview != null && (!this.m_nview.IsValid() || !this.m_nview.IsOwner())) |
| |
| { |
| |
| return; |
| |
| } |
| |
| this.OnHit(collider, collider.transform.position); |
| |
| } |
| } |
| |
| |
| private void OnTriggerStay(Collider collider) |
| private void OnTriggerStay(Collider collider) |
| { |
| { |
| . | if (this.m_triggerEnterOnly) |
| this.CauseTriggerDamage(collider, false); |
| |
| } |
| |
| |
| |
| private void CauseTriggerDamage(Collider collider, bool onTriggerEnter) |
| |
| { |
| |
| if ((this.m_triggerEnterOnly && onTriggerEnter) || this.m_activationTimer > 0f) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| if (!this.m_useTriggers) |
| if (!this.m_useTriggers) |
| { |
| { |
| ZLog.LogWarning("AOE got OnTriggerStay but trigger damage is disabled in " + base.gameObject.name); |
| ZLog.LogWarning("AOE got OnTriggerStay but trigger damage is disabled in " + base.gameObject.name); |
| return; |
| return; |
| } |
| } |
| . | if (this.m_nview != null && (!this.m_nview.IsValid() || !this.m_nview.IsOwner())) |
| if (!this.ShouldHit(collider)) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| . | this.OnHit(collider, collider.transform.position); |
| this.OnHit(collider, collider.bounds.center); |
| } |
| } |
| |
| |
| private bool OnHit(Collider collider, Vector3 hitPoint) |
| private bool OnHit(Collider collider, Vector3 hitPoint) |
| { |
| { |
| GameObject gameObject = Projectile.FindHitObject(collider); |
| GameObject gameObject = Projectile.FindHitObject(collider); |
| if (this.m_hitList.Contains(gameObject)) |
| if (this.m_hitList.Contains(gameObject)) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| this.m_hitList.Add(gameObject); |
| this.m_hitList.Add(gameObject); |
| float num = 1f; |
| float num = 1f; |
| if (this.m_owner && this.m_owner.IsPlayer() && this.m_skill != Skills.SkillType.None) |
| if (this.m_owner && this.m_owner.IsPlayer() && this.m_skill != Skills.SkillType.None) |
| { |
| { |
| num = this.m_owner.GetRandomSkillFactor(this.m_skill); |
| num = this.m_owner.GetRandomSkillFactor(this.m_skill); |
| } |
| } |
| bool flag = false; |
| bool flag = false; |
| bool flag2 = false; |
| bool flag2 = false; |
| . | |
| float num2 = 1f; |
| |
| if (this.m_scaleDamageByDistance) |
| |
| { |
| |
| num2 = this.m_distanceScaleCurve.Evaluate(Mathf.Clamp01(Vector3.Distance(gameObject.transform.position, base.transform.position) / this.m_radius)); |
| |
| } |
| IDestructible component = gameObject.GetComponent<IDestructible>(); |
| IDestructible component = gameObject.GetComponent<IDestructible>(); |
| if (component != null) |
| if (component != null) |
| { |
| { |
| . | if (!this.m_hitParent && base.gameObject.transform.parent != null && gameObject == base.gameObject.transform.parent.gameObject) |
| if (!this.m_hitParent) |
| { |
| { |
| . | |
| if (!(base.gameObject.transform.parent != null) || !(gameObject == base.gameObject.transform.parent.gameObject)) |
| |
| { |
| |
| IDestructible componentInParent = base.gameObject.GetComponentInParent<IDestructible>(); |
| |
| if (componentInParent == null || componentInParent != component) |
| |
| { |
| |
| goto IL_109; |
| |
| } |
| |
| } |
| return false; |
| return false; |
| } |
| } |
| . | |
| IL_109: |
| Character character = component as Character; |
| Character character = component as Character; |
| if (character) |
| if (character) |
| { |
| { |
| . | if (this.m_nview == null && !character.IsOwner()) |
| if (this.m_launchCharacters) |
| { |
| { |
| . | return false; |
| float num3 = UnityEngine.Random.Range(this.m_launchForceMinMax.x, this.m_launchForceMinMax.y); |
| } |
| num3 *= num2; |
| if (this.m_owner != null) |
| Vector3 vector = hitPoint.DirTo(base.transform.position); |
| { |
| if (this.m_launchForceUpFactor > 0f) |
| if (!this.m_hitOwner && character == this.m_owner) |
| |
| { |
| |
| return false; |
| |
| } |
| |
| if (!this.m_hitSame && character.m_name == this.m_owner.m_name) |
| |
| { |
| { |
| . | return false; |
| vector = Vector3.Slerp(vector, Vector3.up, this.m_launchForceUpFactor); |
| } |
| |
| bool flag3 = BaseAI.IsEnemy(this.m_owner, character) || (character.GetBaseAI() && character.GetBaseAI().IsAggravatable() && this.m_owner.IsPlayer()); |
| |
| if (!this.m_hitFriendly && !flag3) |
| |
| { |
| |
| return false; |
| |
| } |
| |
| if (!this.m_hitEnemy && flag3) |
| |
| { |
| |
| return false; |
| |
| } |
| } |
| . | } |
| character.ForceJump(vector.normalized * num3, true); |
| if (!this.m_hitCharacters) |
| |
| { |
| |
| return false; |
| |
| } |
| |
| if (this.m_dodgeable && character.IsDodgeInvincible()) |
| |
| { |
| |
| return false; |
| |
| } |
| } |
| flag2 = true; |
| flag2 = true; |
| } |
| } |
| else if (!this.m_hitProps) |
| else if (!this.m_hitProps) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| . | Vector3 vector = (this.m_attackForceForward ? base.transform.forward : (hitPoint - base.transform.position).normalized); |
| Destructible destructible = component as Destructible; |
| |
| bool flag3 = (destructible != null && destructible.m_spawnWhenDestroyed != null) || gameObject.GetComponent<MineRock5>() != null; |
| |
| Vector3 vector2 = (this.m_attackForceForward ? base.transform.forward : (hitPoint - base.transform.position).normalized); |
| HitData hitData = new HitData(); |
| HitData hitData = new HitData(); |
| hitData.m_hitCollider = collider; |
| hitData.m_hitCollider = collider; |
| hitData.m_damage = this.GetDamage(); |
| hitData.m_damage = this.GetDamage(); |
| . | hitData.m_pushForce = this.m_attackForce * num; |
| hitData.m_pushForce = this.m_attackForce * num * num2; |
| hitData.m_backstabBonus = this.m_backstabBonus; |
| hitData.m_backstabBonus = this.m_backstabBonus; |
| . | hitData.m_point = hitPoint; |
| hitData.m_point = (flag3 ? base.transform.position : hitPoint); |
| hitData.m_dir = vector; |
| hitData.m_dir = vector2; |
| hitData.m_statusEffectHash = this.GetStatusEffect(character); |
| hitData.m_statusEffectHash = this.GetStatusEffect(character); |
| HitData hitData2 = hitData; |
| HitData hitData2 = hitData; |
| Character owner = this.m_owner; |
| Character owner = this.m_owner; |
| hitData2.m_skillLevel = ((owner != null) ? owner.GetSkillLevel(this.m_skill) : 0f); |
| hitData2.m_skillLevel = ((owner != null) ? owner.GetSkillLevel(this.m_skill) : 0f); |
| hitData.m_itemLevel = (short)this.m_level; |
| hitData.m_itemLevel = (short)this.m_level; |
| hitData.m_itemWorldLevel = (byte)((this.m_worldLevel >= 0) ? this.m_worldLevel : Game.m_worldLevel); |
| hitData.m_itemWorldLevel = (byte)((this.m_worldLevel >= 0) ? this.m_worldLevel : Game.m_worldLevel); |
| hitData.m_dodgeable = this.m_dodgeable; |
| hitData.m_dodgeable = this.m_dodgeable; |
| hitData.m_blockable = this.m_blockable; |
| hitData.m_blockable = this.m_blockable; |
| hitData.m_ranged = true; |
| hitData.m_ranged = true; |
| hitData.m_ignorePVP = this.m_owner == character || this.m_ignorePVP; |
| hitData.m_ignorePVP = this.m_owner == character || this.m_ignorePVP; |
| hitData.m_toolTier = (short)this.m_toolTier; |
| hitData.m_toolTier = (short)this.m_toolTier; |
| hitData.SetAttacker(this.m_owner); |
| hitData.SetAttacker(this.m_owner); |
| hitData.m_damage.Modify(num); |
| hitData.m_damage.Modify(num); |
| . | |
| hitData.m_damage.Modify(num2); |
| |
| hitData.m_hitType = ((hitData.GetAttacker() is Player) ? HitData.HitType.PlayerHit : HitData.HitType.EnemyHit); |
| |
| hitData.m_radius = this.m_radius; |
| component.Damage(hitData); |
| component.Damage(hitData); |
| . | |
| if (Terminal.m_showTests && Terminal.m_testList.ContainsKey("damage")) |
| |
| { |
| |
| string text = "Damage AOE: hitting target"; |
| |
| string text3; |
| |
| if (!(this.m_owner == null)) |
| |
| { |
| |
| string text2 = " with owner: "; |
| |
| Character owner2 = this.m_owner; |
| |
| text3 = text2 + ((owner2 != null) ? owner2.ToString() : null); |
| |
| } |
| |
| else |
| |
| { |
| |
| text3 = " without owner"; |
| |
| } |
| |
| Terminal.Log(text + text3); |
| |
| } |
| if (this.m_damageSelf > 0f) |
| if (this.m_damageSelf > 0f) |
| { |
| { |
| . | IDestructible componentInParent = base.GetComponentInParent<IDestructible>(); |
| IDestructible componentInParent2 = base.GetComponentInParent<IDestructible>(); |
| if (componentInParent != null) |
| if (componentInParent2 != null) |
| { |
| { |
| HitData hitData3 = new HitData(); |
| HitData hitData3 = new HitData(); |
| hitData3.m_damage.m_damage = this.m_damageSelf; |
| hitData3.m_damage.m_damage = this.m_damageSelf; |
| hitData3.m_point = hitPoint; |
| hitData3.m_point = hitPoint; |
| hitData3.m_blockable = false; |
| hitData3.m_blockable = false; |
| hitData3.m_dodgeable = false; |
| hitData3.m_dodgeable = false; |
| hitData3.m_hitType = HitData.HitType.Self; |
| hitData3.m_hitType = HitData.HitType.Self; |
| . | componentInParent.Damage(hitData3); |
| componentInParent2.Damage(hitData3); |
| } |
| } |
| } |
| } |
| flag = true; |
| flag = true; |
| } |
| } |
| . | this.m_hitEffects.Create(hitPoint, Quaternion.identity, null, 1f, -1); |
| else |
| |
| { |
| |
| Heightmap component2 = gameObject.GetComponent<Heightmap>(); |
| |
| if (component2 != null) |
| |
| { |
| |
| FootStep.GroundMaterial groundMaterial = component2.GetGroundMaterial(Vector3.up, base.transform.position, this.m_groundLavaValue); |
| |
| FootStep.GroundMaterial groundMaterial2 = component2.GetGroundMaterial(Vector3.up, base.transform.position, 0.6f); |
| |
| FootStep.GroundMaterial groundMaterial3 = ((this.m_groundLavaValue >= 0f) ? groundMaterial : groundMaterial2); |
| |
| if (this.m_spawnOnHitTerrain && (this.m_spawnOnGroundType == FootStep.GroundMaterial.Everything || this.m_spawnOnGroundType.HasFlag(groundMaterial3)) && (!this.m_hitTerrainOnlyOnce || !this.m_hasHitTerrain)) |
| |
| { |
| |
| this.m_hasHitTerrain = true; |
| |
| int num4 = ((this.m_multiSpawnMin == 0) ? 1 : UnityEngine.Random.Range(this.m_multiSpawnMin, this.m_multiSpawnMax)); |
| |
| Vector3 vector3 = base.transform.position; |
| |
| for (int i = 0; i < num4; i++) |
| |
| { |
| |
| GameObject gameObject2 = Attack.SpawnOnHitTerrain(vector3, this.m_spawnOnHitTerrain, this.m_owner, this.m_hitNoise, null, null, this.m_randomRotation); |
| |
| float num5 = ((num4 == 1) ? 0f : ((float)i / (float)(num4 - 1))); |
| |
| float num6 = UnityEngine.Random.Range(this.m_multiSpawnDistanceMin, this.m_multiSpawnDistanceMax); |
| |
| Vector2 insideUnitCircle = UnityEngine.Random.insideUnitCircle; |
| |
| vector3 += new Vector3(insideUnitCircle.x * num6, 0f, insideUnitCircle.y * num6); |
| |
| if (gameObject2 && i > 0) |
| |
| { |
| |
| gameObject2.transform.localScale = Utils.Vec3((1f - num5) * (this.m_multiSpawnScaleMax - this.m_multiSpawnScaleMin) + this.m_multiSpawnScaleMin); |
| |
| } |
| |
| if (this.m_multiSpawnSpringDelayMax > 0f) |
| |
| { |
| |
| ConditionalObject componentInChildren = gameObject2.GetComponentInChildren<ConditionalObject>(); |
| |
| if (componentInChildren != null) |
| |
| { |
| |
| componentInChildren.m_appearDelay = num5 * this.m_multiSpawnSpringDelayMax; |
| |
| } |
| |
| } |
| |
| if (this.m_placeOnGround) |
| |
| { |
| |
| gameObject2.transform.position = new Vector3(gameObject2.transform.position.x, ZoneSystem.instance.GetGroundHeight(gameObject2.transform.position), gameObject2.transform.position.z); |
| |
| } |
| |
| } |
| |
| } |
| |
| flag = true; |
| |
| } |
| |
| } |
| |
| if (gameObject.GetComponent<MineRock5>() == null) |
| |
| { |
| |
| this.m_hitEffects.Create(hitPoint, Quaternion.identity, null, 1f, -1); |
| |
| } |
| if (!this.m_gaveSkill && this.m_owner && this.m_skill > Skills.SkillType.None && flag2 && this.m_canRaiseSkill) |
| if (!this.m_gaveSkill && this.m_owner && this.m_skill > Skills.SkillType.None && flag2 && this.m_canRaiseSkill) |
| { |
| { |
| this.m_owner.RaiseSkill(this.m_skill, 1f); |
| this.m_owner.RaiseSkill(this.m_skill, 1f); |
| this.m_gaveSkill = true; |
| this.m_gaveSkill = true; |
| } |
| } |
| return flag; |
| return flag; |
| } |
| } |
| |
| |
| private int GetStatusEffect(Character character) |
| private int GetStatusEffect(Character character) |
| { |
| { |
| if (character) |
| if (character) |
| { |
| { |
| if (character.IsBoss() && this.m_statusEffectIfBossHash != 0) |
| if (character.IsBoss() && this.m_statusEffectIfBossHash != 0) |
| { |
| { |
| return this.m_statusEffectIfBossHash; |
| return this.m_statusEffectIfBossHash; |
| } |
| } |
| if (character.IsPlayer() && this.m_statusEffectIfPlayerHash != 0) |
| if (character.IsPlayer() && this.m_statusEffectIfPlayerHash != 0) |
| { |
| { |
| return this.m_statusEffectIfPlayerHash; |
| return this.m_statusEffectIfPlayerHash; |
| } |
| } |
| } |
| } |
| return this.m_statusEffectHash; |
| return this.m_statusEffectHash; |
| } |
| } |
| |
| |
| private void OnDrawGizmos() |
| private void OnDrawGizmos() |
| { |
| { |
| bool useTriggers = this.m_useTriggers; |
| bool useTriggers = this.m_useTriggers; |
| } |
| } |
| |
| |
| . | |
| public static List<IMonoUpdater> Instances { get; } = new List<IMonoUpdater>(); |
| |
| |
| |
| public string m_name = ""; |
| |
| |
| [Header("Attack (overridden by item )")] |
| [Header("Attack (overridden by item )")] |
| public bool m_useAttackSettings = true; |
| public bool m_useAttackSettings = true; |
| |
| |
| public HitData.DamageTypes m_damage; |
| public HitData.DamageTypes m_damage; |
| |
| |
| . | |
| public bool m_scaleDamageByDistance; |
| |
| |
| |
| public AnimationCurve m_distanceScaleCurve = AnimationCurve.Linear(1f, 1f, 0f, 0f); |
| |
| |
| public bool m_dodgeable; |
| public bool m_dodgeable; |
| |
| |
| public bool m_blockable; |
| public bool m_blockable; |
| |
| |
| public int m_toolTier; |
| public int m_toolTier; |
| |
| |
| public float m_attackForce; |
| public float m_attackForce; |
| |
| |
| public float m_backstabBonus = 4f; |
| public float m_backstabBonus = 4f; |
| |
| |
| public string m_statusEffect = ""; |
| public string m_statusEffect = ""; |
| |
| |
| public string m_statusEffectIfBoss = ""; |
| public string m_statusEffectIfBoss = ""; |
| |
| |
| public string m_statusEffectIfPlayer = ""; |
| public string m_statusEffectIfPlayer = ""; |
| |
| |
| private int m_statusEffectHash; |
| private int m_statusEffectHash; |
| |
| |
| private int m_statusEffectIfBossHash; |
| private int m_statusEffectIfBossHash; |
| |
| |
| private int m_statusEffectIfPlayerHash; |
| private int m_statusEffectIfPlayerHash; |
| |
| |
| [Header("Attack (other)")] |
| [Header("Attack (other)")] |
| public HitData.DamageTypes m_damagePerLevel; |
| public HitData.DamageTypes m_damagePerLevel; |
| |
| |
| public bool m_attackForceForward; |
| public bool m_attackForceForward; |
| |
| |
| . | |
| public GameObject m_spawnOnHitTerrain; |
| |
| |
| |
| public bool m_hitTerrainOnlyOnce; |
| |
| |
| |
| public FootStep.GroundMaterial m_spawnOnGroundType = FootStep.GroundMaterial.Everything; |
| |
| |
| |
| public float m_groundLavaValue = -1f; |
| |
| |
| |
| public float m_hitNoise; |
| |
| |
| |
| public bool m_placeOnGround; |
| |
| |
| |
| public bool m_randomRotation; |
| |
| |
| |
| public int m_maxTargetsFromCenter; |
| |
| |
| |
| [Header("Multi Spawn (Lava Bomb)")] |
| |
| public int m_multiSpawnMin; |
| |
| |
| |
| public int m_multiSpawnMax; |
| |
| |
| |
| public float m_multiSpawnDistanceMin; |
| |
| |
| |
| public float m_multiSpawnDistanceMax; |
| |
| |
| |
| public float m_multiSpawnScaleMin; |
| |
| |
| |
| public float m_multiSpawnScaleMax; |
| |
| |
| |
| public float m_multiSpawnSpringDelayMax; |
| |
| |
| |
| [Header("Chain Spawn")] |
| |
| public float m_chainStartChance; |
| |
| |
| |
| public float m_chainStartChanceFalloff = 0.8f; |
| |
| |
| |
| public float m_chainChancePerTarget; |
| |
| |
| |
| public GameObject m_chainObj; |
| |
| |
| |
| public float m_chainStartDelay; |
| |
| |
| |
| public int m_chainMinTargets; |
| |
| |
| |
| public int m_chainMaxTargets; |
| |
| |
| |
| public EffectList m_chainEffects = new EffectList(); |
| |
| |
| |
| private float m_chainDelay; |
| |
| |
| |
| private float m_chainChance; |
| |
| |
| [Header("Damage self")] |
| [Header("Damage self")] |
| public float m_damageSelf; |
| public float m_damageSelf; |
| |
| |
| [Header("Ignore targets")] |
| [Header("Ignore targets")] |
| public bool m_hitOwner; |
| public bool m_hitOwner; |
| |
| |
| public bool m_hitParent = true; |
| public bool m_hitParent = true; |
| |
| |
| public bool m_hitSame; |
| public bool m_hitSame; |
| |
| |
| public bool m_hitFriendly = true; |
| public bool m_hitFriendly = true; |
| |
| |
| public bool m_hitEnemy = true; |
| public bool m_hitEnemy = true; |
| |
| |
| public bool m_hitCharacters = true; |
| public bool m_hitCharacters = true; |
| |
| |
| public bool m_hitProps = true; |
| public bool m_hitProps = true; |
| |
| |
| . | |
| public bool m_hitTerrain; |
| |
| |
| public bool m_ignorePVP; |
| public bool m_ignorePVP; |
| |
| |
| . | |
| [Header("Launch Characters")] |
| |
| public bool m_launchCharacters; |
| |
| |
| |
| public Vector2 m_launchForceMinMax = Vector2.up; |
| |
| |
| |
| [Range(0f, 1f)] |
| |
| public float m_launchForceUpFactor = 0.5f; |
| |
| |
| [Header("Other")] |
| [Header("Other")] |
| public Skills.SkillType m_skill; |
| public Skills.SkillType m_skill; |
| |
| |
| public bool m_canRaiseSkill = true; |
| public bool m_canRaiseSkill = true; |
| |
| |
| public bool m_useTriggers; |
| public bool m_useTriggers; |
| |
| |
| public bool m_triggerEnterOnly; |
| public bool m_triggerEnterOnly; |
| |
| |
| public BoxCollider m_useCollider; |
| public BoxCollider m_useCollider; |
| |
| |
| public float m_radius = 4f; |
| public float m_radius = 4f; |
| |
| |
| . | |
| [global::Tooltip("Wait this long before we start doing any damage")] |
| |
| public float m_activationDelay; |
| |
| |
| public float m_ttl = 4f; |
| public float m_ttl = 4f; |
| |
| |
| . | |
| [global::Tooltip("When set, ttl will be a random value between ttl and ttlMax")] |
| |
| public float m_ttlMax; |
| |
| |
| |
| public bool m_hitAfterTtl; |
| |
| |
| public float m_hitInterval = 1f; |
| public float m_hitInterval = 1f; |
| |
| |
| . | public EffectList m_hitEffects = new EffectList(); |
| public bool m_hitOnEnable; |
| |
| |
| public bool m_attachToCaster; |
| public bool m_attachToCaster; |
| |
| |
| . | |
| public EffectList m_hitEffects = new EffectList(); |
| |
| |
| |
| public EffectList m_initiateEffect = new EffectList(); |
| |
| |
| |
| private static Collider[] s_hits = new Collider[100]; |
| |
| |
| |
| private static List<Collider> s_hitList = new List<Collider>(); |
| |
| |
| |
| private static int s_hitListCount; |
| |
| |
| |
| private static List<GameObject> s_chainObjs = new List<GameObject>(); |
| |
| |
| private ZNetView m_nview; |
| private ZNetView m_nview; |
| |
| |
| private Character m_owner; |
| private Character m_owner; |
| |
| |
| private readonly List<GameObject> m_hitList = new List<GameObject>(); |
| private readonly List<GameObject> m_hitList = new List<GameObject>(); |
| |
| |
| private float m_hitTimer; |
| private float m_hitTimer; |
| |
| |
| . | |
| private float m_activationTimer; |
| |
| |
| private Vector3 m_offset = Vector3.zero; |
| private Vector3 m_offset = Vector3.zero; |
| |
| |
| private Quaternion m_localRot = Quaternion.identity; |
| private Quaternion m_localRot = Quaternion.identity; |
| |
| |
| private int m_level; |
| private int m_level; |
| |
| |
| private int m_worldLevel = -1; |
| private int m_worldLevel = -1; |
| |
| |
| private int m_rayMask; |
| private int m_rayMask; |
| |
| |
| private bool m_gaveSkill; |
| private bool m_gaveSkill; |
| . | |
| |
| |
| private bool m_hasHitTerrain; |
| |
| |
| |
| private bool m_initRun = true; |
| |
| |
| |
| private HitData m_hitData; |
| |
| |
| |
| private ItemDrop.ItemData m_itemData; |
| |
| |
| |
| private ItemDrop.ItemData m_ammo; |
| } |
| } |
| |
| |