示例#1
0
 private void DidDamage(PlayerController player, float damage, bool fatal, HealthHaver hh)
 {
     if (hh.gameActor != null && hh.gameActor.GetEffect("fire") != null)
     {
         hh.ApplyDamage(damage / 2f, Vector2.zero, "Heart of Fire Extra Damage", CoreDamageTypes.None, DamageCategory.Normal, true, null, false);
     }
 }
示例#2
0
        private void HandleDamaging(List <AIActor> targets, PlayerController source, float origDamage)
        {
            int    count         = targets.Count();
            float  newDamage     = 0;
            float  minMultiplier = .25f;
            float  multiplier    = .5f;
            string damageSource  = "Sympathy";

            if (Owner.PlayerHasActiveSynergy("Bloodless"))
            {
                minMultiplier = .33f;
                multiplier    = .65f;
            }
            if (count == 1)
            {
                newDamage = origDamage * minMultiplier;
            }
            else
            {
                newDamage = (origDamage * multiplier) / count;
            }
            foreach (AIActor actor in targets)
            {
                HealthHaver healthHaver = actor.healthHaver;

                healthHaver.ApplyDamage(newDamage, Vector2.zero, damageSource);
            }
        }
示例#3
0
        private IEnumerator DelayedKill(HealthHaver haverofhealth, GameObject lightning)
        {
            yield return(new WaitForSeconds(0.1f));

            if (haverofhealth)
            {
                haverofhealth.ApplyDamage(400 * LastOwner.stats.GetStatValue(PlayerStats.StatType.Damage), Vector2.zero, "THUNDERSTRUCK");
            }
            AkSoundEngine.PostEvent("Play_OBJ_lightning_flash_01", gameObject);
            yield break;
        }
示例#4
0
 public void InstaKill(HealthHaver target)
 {
     try
     {
         //ETGModConsole.Log("This poor bastard is gonna die");
         target.ApplyDamage(1E+07f, Vector2.zero, "Erasure", CoreDamageTypes.None, DamageCategory.Unstoppable, true, null, false);
     }
     catch (Exception e)
     {
         ETGModConsole.Log(e.Message);
     }
 }
 //public void PostProcessProjectile(Projectile proj, float f)
 //{
 //    proj.OnHitEnemy += this.OnHitEnemy;
 //}
 private void OnAnyEnemyReceivedDamage(float damage, bool fatal, HealthHaver enemy)
 {
     ETGModConsole.Log($"this kid took {damage} damage");
     if (enemy.IsBoss)
     {
         return;
     }
     if (!fatal && enemy != null && enemy.aiActor != null && String.IsNullOrEmpty(enemy.aiActor.EnemyGuid) && this.affectedEnemies.ContainsKey(enemy.aiActor.EnemyGuid))
     {
         enemy.ApplyDamage((damage / 10) * this.affectedEnemies[enemy.aiActor.EnemyGuid], Vector2.zero, this.Owner.ActorName, CoreDamageTypes.None, DamageCategory.Normal, false, null, false);
         ETGModConsole.Log("ay yo i recognize this kid");
     }
 }
示例#6
0
            private IEnumerator HandleDelayedDamage(SpeculativeRigidbody targetRigidbody, float damage, Vector2 damageVec, PixelCollider hitPixelCollider)
            {
                yield return(new WaitForSeconds(0.5f));

                if (targetRigidbody && targetRigidbody.healthHaver)
                {
                    HealthHaver     healthHaver     = targetRigidbody.healthHaver;
                    string          ownerName       = this.OwnerName;
                    CoreDamageTypes coreDamageTypes = this.damageTypes;
                    DamageCategory  damageCategory  = (!this.IsBlackBullet) ? DamageCategory.Normal : DamageCategory.BlackBullet;
                    healthHaver.ApplyDamage(damage, damageVec, ownerName, coreDamageTypes, damageCategory, false, hitPixelCollider, this.ignoreDamageCaps);
                }
                yield break;
            }
示例#7
0
            protected override HandleDamageResult HandleDamage(SpeculativeRigidbody rigidbody, PixelCollider hitPixelCollider, out bool killedTarget, PlayerController player, bool alreadyPlayerDelayed = false)
            {
                killedTarget = false;
                if (rigidbody.ReflectProjectiles)
                {
                    return(Projectile.HandleDamageResult.NO_HEALTH);
                }
                if (!rigidbody.healthHaver)
                {
                    return(Projectile.HandleDamageResult.NO_HEALTH);
                }
                if (!alreadyPlayerDelayed && Projectile.s_delayPlayerDamage && player)
                {
                    return(Projectile.HandleDamageResult.HEALTH);
                }
                if (rigidbody.spriteAnimator != null && rigidbody.spriteAnimator.QueryInvulnerabilityFrame())
                {
                    return(Projectile.HandleDamageResult.HEALTH);
                }
                bool  flag = !rigidbody.healthHaver.IsDead;
                float num  = this.ModifiedDamage;

                if (this.Owner is AIActor && rigidbody && rigidbody.aiActor && (this.Owner as AIActor).IsNormalEnemy)
                {
                    num = ProjectileData.FixedFallbackDamageToEnemies;
                    if (rigidbody.aiActor.HitByEnemyBullets)
                    {
                        num /= 4f;
                    }
                }
                FieldInfo info = typeof(Projectile).GetField("m_healthHaverHitCount", BindingFlags.NonPublic | BindingFlags.Instance);
                int       m_healthHaverHitCount = (int)info.GetValue(this as Projectile);

                if (this.Owner is PlayerController && this.m_hasPierced && m_healthHaverHitCount >= 1)
                {
                    int num2 = Mathf.Clamp(m_healthHaverHitCount - 1, 0, GameManager.Instance.PierceDamageScaling.Length - 1);
                    num *= GameManager.Instance.PierceDamageScaling[num2];
                }
                if (this.OnWillKillEnemy != null && num >= rigidbody.healthHaver.GetCurrentHealth())
                {
                    this.OnWillKillEnemy(this, rigidbody);
                }
                if (rigidbody.healthHaver.IsBoss)
                {
                    num *= this.BossDamageMultiplier;
                }
                if (this.BlackPhantomDamageMultiplier != 1f && rigidbody.aiActor && rigidbody.aiActor.IsBlackPhantom)
                {
                    num *= this.BlackPhantomDamageMultiplier;
                }
                bool flag2 = false;

                if (this.DelayedDamageToExploders)
                {
                    flag2 = (rigidbody.GetComponent <ExplodeOnDeath>() && rigidbody.healthHaver.GetCurrentHealth() <= num);
                }
                if (!flag2)
                {
                    HealthHaver     healthHaver     = rigidbody.healthHaver;
                    float           damage          = num;
                    Vector2         velocity        = base.specRigidbody.Velocity;
                    CoreDamageTypes coreDamageTypes = this.damageTypes;
                    DamageCategory  damageCategory  = (!this.IsBlackBullet) ? DamageCategory.Normal : DamageCategory.BlackBullet;
                    if (healthHaver.IsBoss)
                    {
                        damage *= (base.Owner as PlayerController).stats.GetStatValue(PlayerStats.StatType.DamageToBosses);
                    }
                    healthHaver.ApplyDamage(damage, velocity, "Soul Orb Projectile", coreDamageTypes, damageCategory, false, hitPixelCollider, this.ignoreDamageCaps);
                    if (player && player.OnHitByProjectile != null)
                    {
                        player.OnHitByProjectile(this, player);
                    }
                }
                else
                {
                    rigidbody.StartCoroutine(this.HandleDelayedDamage(rigidbody, num, base.specRigidbody.Velocity, hitPixelCollider));
                }
                if (this.Owner && this.Owner is AIActor && player)
                {
                    (this.Owner as AIActor).HasDamagedPlayer = true;
                }
                killedTarget = (flag && rigidbody.healthHaver.IsDead);
                if (!killedTarget && rigidbody.gameActor != null)
                {
                    if (this.AppliesPoison && UnityEngine.Random.value < this.PoisonApplyChance)
                    {
                        rigidbody.gameActor.ApplyEffect(this.healthEffect, 1f, null);
                    }
                    if (this.AppliesSpeedModifier && UnityEngine.Random.value < this.SpeedApplyChance)
                    {
                        rigidbody.gameActor.ApplyEffect(this.speedEffect, 1f, null);
                    }
                    if (this.AppliesCharm && UnityEngine.Random.value < this.CharmApplyChance)
                    {
                        rigidbody.gameActor.ApplyEffect(this.charmEffect, 1f, null);
                    }
                    if (this.AppliesFreeze && UnityEngine.Random.value < this.FreezeApplyChance)
                    {
                        rigidbody.gameActor.ApplyEffect(this.freezeEffect, 1f, null);
                    }
                    if (this.AppliesCheese && UnityEngine.Random.value < this.CheeseApplyChance)
                    {
                        rigidbody.gameActor.ApplyEffect(this.cheeseEffect, 1f, null);
                    }
                    if (this.AppliesBleed && UnityEngine.Random.value < this.BleedApplyChance)
                    {
                        rigidbody.gameActor.ApplyEffect(this.bleedEffect, -1f, this);
                    }
                    if (this.AppliesFire && UnityEngine.Random.value < this.FireApplyChance)
                    {
                        rigidbody.gameActor.ApplyEffect(this.fireEffect, 1f, null);
                    }
                    if (this.AppliesStun && UnityEngine.Random.value < this.StunApplyChance && rigidbody.gameActor.behaviorSpeculator)
                    {
                        rigidbody.gameActor.behaviorSpeculator.Stun(this.AppliedStunDuration, true);
                    }
                    for (int i = 0; i < this.statusEffectsToApply.Count; i++)
                    {
                        rigidbody.gameActor.ApplyEffect(this.statusEffectsToApply[i], 1f, null);
                    }
                }
                m_healthHaverHitCount++;
                info.SetValue(this as Projectile, m_healthHaverHitCount);
                return((!killedTarget) ? Projectile.HandleDamageResult.HEALTH : Projectile.HandleDamageResult.HEALTH_AND_KILLED);
            }
示例#8
0
        private IEnumerator HandleExplosion(Vector3 position, ExplosionData data, Vector2 sourceNormal, Action onExplosionBegin, bool ignoreQueues, CoreDamageTypes damageTypes, bool ignoreDamageCaps)
        {
            if (data.usesComprehensiveDelay)
            {
                yield return(new WaitForSeconds(data.comprehensiveDelay));
            }
            Exploder.OnExplosionTriggered?.Invoke();
            bool addFireGoop       = (damageTypes | CoreDamageTypes.Fire) == damageTypes;
            bool addFreezeGoop     = (damageTypes | CoreDamageTypes.Ice) == damageTypes;
            bool addPoisonGoop     = (damageTypes | CoreDamageTypes.Poison) == damageTypes;
            bool isFreezeExplosion = data.isFreezeExplosion;

            if (!data.isFreezeExplosion && addFreezeGoop)
            {
                isFreezeExplosion = true;
                data.freezeRadius = data.damageRadius;
                data.freezeEffect = GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultFreezeExplosionEffect;
            }
            // Be sure to use a clone of ExplosionManager for this else explosion queueing breaks! //
            // (it won't let you use ExplosionManager's original code on a new Exploder class normally. ;) - [Apache Thunder] //
            if (!ignoreQueues)
            {
                ChaosExplosionManager.Instance.Queue(this);
                while (!ChaosExplosionManager.Instance.IsExploderReady(this))
                {
                    yield return(null);
                }
                ChaosExplosionManager.Instance.Dequeue();
                if (ChaosExplosionManager.Instance.QueueCount == 0)
                {
                    ChaosExplosionManager.Instance.StartCoroutine(HandleCurrentExplosionNotification(0.5f));
                }
            }
            onExplosionBegin?.Invoke();
            float damageRadius            = data.GetDefinedDamageRadius();
            float pushSqrRadius           = data.pushRadius * data.pushRadius;
            float bulletDeletionSqrRadius = damageRadius * damageRadius;

            if (addFreezeGoop)
            {
                DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultFreezeGoop).TimedAddGoopCircle(position.XY(), damageRadius, 0.5f, false);
                DeadlyDeadlyGoopManager.FreezeGoopsCircle(position.XY(), damageRadius);
            }
            if (addFireGoop)
            {
                DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultFireGoop).TimedAddGoopCircle(position.XY(), damageRadius, 0.5f, false);
            }
            if (addPoisonGoop)
            {
                DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultPoisonGoop).TimedAddGoopCircle(position.XY(), damageRadius, 0.5f, false);
            }
            if (!isFreezeExplosion)
            {
                DeadlyDeadlyGoopManager.IgniteGoopsCircle(position.XY(), damageRadius);
            }
            if (data.effect)
            {
                GameObject gameObject;
                if (data.effect.GetComponent <ParticleSystem>() != null || data.effect.GetComponentInChildren <ParticleSystem>() != null)
                {
                    gameObject = SpawnManager.SpawnVFX(data.effect, position, Quaternion.identity);
                }
                else
                {
                    gameObject = SpawnManager.SpawnVFX(data.effect, position, Quaternion.identity);
                }
                if (data.rotateEffectToNormal && gameObject)
                {
                    gameObject.transform.rotation = Quaternion.Euler(0f, 0f, sourceNormal.ToAngle());
                }
                tk2dBaseSprite component = gameObject.GetComponent <tk2dBaseSprite>();
                if (component)
                {
                    component.HeightOffGround += UnityEngine.Random.Range(-0.1f, 0.2f);
                    component.UpdateZDepth();
                }
                ExplosionDebrisLauncher[] componentsInChildren = gameObject.GetComponentsInChildren <ExplosionDebrisLauncher>();
                Vector3    position2   = gameObject.transform.position.WithZ(gameObject.transform.position.y);
                GameObject gameObject2 = new GameObject("SoundSource");
                gameObject2.transform.position = position2;
                if (data.playDefaultSFX)
                {
                    AkSoundEngine.PostEvent("Play_WPN_grenade_blast_01", gameObject2);
                }
                Destroy(gameObject2, 5f);
                for (int i = 0; i < componentsInChildren.Length; i++)
                {
                    if (componentsInChildren[i])
                    {
                        if (sourceNormal == Vector2.zero)
                        {
                            componentsInChildren[i].Launch();
                        }
                        else
                        {
                            componentsInChildren[i].Launch(sourceNormal);
                        }
                    }
                }
                if (gameObject)
                {
                    Transform transform = gameObject.transform.Find("scorch");
                    if (transform)
                    {
                        transform.gameObject.SetLayerRecursively(LayerMask.NameToLayer("BG_Critical"));
                    }
                }
                if (data.doExplosionRing)
                {
                }
            }
            yield return(new WaitForSeconds(data.explosionDelay));

            List <HealthHaver> allHealth = StaticReferenceManager.AllHealthHavers;

            if (allHealth != null && (data.doDamage || data.doForce))
            {
                for (int j = 0; j < allHealth.Count; j++)
                {
                    HealthHaver healthHaver = allHealth[j];
                    if (healthHaver)
                    {
                        if (healthHaver && healthHaver.aiActor)
                        {
                            if (!healthHaver.aiActor.HasBeenEngaged)
                            {
                                goto IL_A82;
                            }
                            if (healthHaver.aiActor.CompanionOwner && data.damageToPlayer == 0f)
                            {
                                goto IL_A82;
                            }
                        }
                        if (!data.ignoreList.Contains(healthHaver.specRigidbody))
                        {
                            if (position.GetAbsoluteRoom() == allHealth[j].transform.position.GetAbsoluteRoom())
                            {
                                for (int k = 0; k < healthHaver.NumBodyRigidbodies; k++)
                                {
                                    SpeculativeRigidbody bodyRigidbody    = healthHaver.GetBodyRigidbody(k);
                                    PlayerController     playerController = (!bodyRigidbody) ? null : (bodyRigidbody.gameActor as PlayerController);
                                    Vector2 a      = healthHaver.transform.position.XY();
                                    Vector2 vector = a - position.XY();
                                    bool    flag   = false;
                                    float   num;
                                    if (bodyRigidbody.HitboxPixelCollider != null)
                                    {
                                        a      = bodyRigidbody.HitboxPixelCollider.UnitCenter;
                                        vector = a - position.XY();
                                        num    = BraveMathCollege.DistToRectangle(position.XY(), bodyRigidbody.HitboxPixelCollider.UnitBottomLeft, bodyRigidbody.HitboxPixelCollider.UnitDimensions);
                                    }
                                    else
                                    {
                                        a      = healthHaver.transform.position.XY();
                                        vector = a - position.XY();
                                        num    = vector.magnitude;
                                    }
                                    if (!playerController || ((!data.doDamage || num >= damageRadius) && (!isFreezeExplosion || num >= data.freezeRadius) && (!data.doForce || num >= data.pushRadius)) || !IsPlayerBlockedByWall(playerController, position))
                                    {
                                        if (playerController)
                                        {
                                            if (!bodyRigidbody.CollideWithOthers)
                                            {
                                                goto IL_A6E;
                                            }
                                            if (playerController.DodgeRollIsBlink && playerController.IsDodgeRolling)
                                            {
                                                goto IL_A6E;
                                            }
                                        }
                                        if (data.doDamage && num < damageRadius)
                                        {
                                            if (playerController)
                                            {
                                                bool flag2 = true;
                                                if (PassiveItem.ActiveFlagItems.ContainsKey(playerController) && PassiveItem.ActiveFlagItems[playerController].ContainsKey(typeof(HelmetItem)) && num > damageRadius * HelmetItem.EXPLOSION_RADIUS_MULTIPLIER)
                                                {
                                                    flag2 = false;
                                                }
                                                if (flag2 && !playerController.IsEthereal)
                                                {
                                                    HealthHaver     healthHaver2   = healthHaver;
                                                    float           damage         = data.damageToPlayer;
                                                    Vector2         direction      = vector;
                                                    string          enemiesString  = StringTableManager.GetEnemiesString("#EXPLOSION", -1);
                                                    CoreDamageTypes damageTypes2   = CoreDamageTypes.None;
                                                    DamageCategory  damageCategory = DamageCategory.Normal;
                                                    healthHaver2.ApplyDamage(damage, direction, enemiesString, damageTypes2, damageCategory, false, null, ignoreDamageCaps);
                                                }
                                            }
                                            else
                                            {
                                                HealthHaver     healthHaver3   = healthHaver;
                                                float           damage         = data.damage;
                                                Vector2         direction      = vector;
                                                string          enemiesString  = StringTableManager.GetEnemiesString("#EXPLOSION", -1);
                                                CoreDamageTypes damageTypes2   = CoreDamageTypes.None;
                                                DamageCategory  damageCategory = DamageCategory.Normal;
                                                healthHaver3.ApplyDamage(damage, direction, enemiesString, damageTypes2, damageCategory, false, null, ignoreDamageCaps);
                                                if (data.IsChandelierExplosion && (!healthHaver || healthHaver.healthHaver.IsDead))
                                                {
                                                    GameStatsManager.Instance.RegisterStatChange(TrackedStats.ENEMIES_KILLED_WITH_CHANDELIERS, 1f);
                                                }
                                            }
                                            flag = true;
                                        }
                                        if (isFreezeExplosion && num < data.freezeRadius)
                                        {
                                            if (healthHaver && healthHaver.gameActor != null && !healthHaver.IsDead && (!healthHaver.aiActor || !healthHaver.aiActor.IsGone))
                                            {
                                                healthHaver.gameActor.ApplyEffect(data.freezeEffect, 1f, null);
                                            }
                                            flag = true;
                                        }
                                        if (data.doForce && num < data.pushRadius)
                                        {
                                            KnockbackDoer knockbackDoer = healthHaver.knockbackDoer;
                                            if (knockbackDoer)
                                            {
                                                float num2 = 1f - num / data.pushRadius;
                                                if (data.preventPlayerForce && healthHaver.GetComponent <PlayerController>())
                                                {
                                                    num2 = 0f;
                                                }
                                                knockbackDoer.ApplyKnockback(vector.normalized, num2 * data.force, false);
                                            }
                                            flag = true;
                                        }
                                        if (flag)
                                        {
                                            break;
                                        }
                                    }
                                    IL_A6E :;
                                }
                            }
                        }
                    }
                    IL_A82 :;
                }
            }
            List <MinorBreakable> allBreakables = StaticReferenceManager.AllMinorBreakables;

            if (allBreakables != null)
            {
                for (int l = 0; l < allBreakables.Count; l++)
                {
                    MinorBreakable minorBreakable = allBreakables[l];
                    if (minorBreakable)
                    {
                        if (!minorBreakable.resistsExplosions)
                        {
                            if (!minorBreakable.OnlyBrokenByCode)
                            {
                                Vector2 vector2 = minorBreakable.CenterPoint - position.XY();
                                if (vector2.sqrMagnitude < pushSqrRadius)
                                {
                                    minorBreakable.Break(vector2.normalized);
                                }
                            }
                        }
                    }
                }
            }
            if (data.doDestroyProjectiles)
            {
                float            duration         = 0.2f;
                PlayerController bestActivePlayer = GameManager.Instance.BestActivePlayer;
                if (bestActivePlayer && bestActivePlayer.CurrentRoom != null && bestActivePlayer.CurrentRoom.area != null && bestActivePlayer.CurrentRoom.area.PrototypeRoomCategory == PrototypeDungeonRoom.RoomCategory.BOSS)
                {
                    duration = 0.035f;
                }
                GameManager.Instance.Dungeon.StartCoroutine(HandleBulletDeletionFrames(position, bulletDeletionSqrRadius, duration));
            }
            if (data.doDamage || data.breakSecretWalls)
            {
                List <MajorBreakable> allMajorBreakables = StaticReferenceManager.AllMajorBreakables;
                if (allMajorBreakables != null)
                {
                    for (int m = 0; m < allMajorBreakables.Count; m++)
                    {
                        MajorBreakable majorBreakable = allMajorBreakables[m];
                        if (majorBreakable)
                        {
                            if (majorBreakable.enabled)
                            {
                                if (!majorBreakable.IgnoreExplosions)
                                {
                                    Vector2 sourceDirection = majorBreakable.CenterPoint - position.XY();
                                    if (sourceDirection.sqrMagnitude < pushSqrRadius && (!majorBreakable.IsSecretDoor || !data.forcePreventSecretWallDamage))
                                    {
                                        if (data.doDamage)
                                        {
                                            majorBreakable.ApplyDamage(data.damage, sourceDirection, false, true, false);
                                        }
                                        if (data.breakSecretWalls && majorBreakable.IsSecretDoor)
                                        {
                                            StaticReferenceManager.AllMajorBreakables[m].ApplyDamage(1E+10f, Vector2.zero, false, true, true);
                                            StaticReferenceManager.AllMajorBreakables[m].ApplyDamage(1E+10f, Vector2.zero, false, true, true);
                                            StaticReferenceManager.AllMajorBreakables[m].ApplyDamage(1E+10f, Vector2.zero, false, true, true);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if (data.doForce)
            {
                Exploder.DoRadialPush(position, data.debrisForce, data.pushRadius);
            }
            if (data.doScreenShake && GameManager.Instance.MainCameraController != null)
            {
                GameManager.Instance.MainCameraController.DoScreenShake(data.ss, new Vector2?(position), false);
            }
            if (data.doStickyFriction && GameManager.Instance.MainCameraController != null)
            {
                StickyFrictionManager.Instance.RegisterExplosionStickyFriction();
            }
            for (int n = 0; n < StaticReferenceManager.AllRatTrapdoors.Count; n++)
            {
                if (StaticReferenceManager.AllRatTrapdoors[n])
                {
                    StaticReferenceManager.AllRatTrapdoors[n].OnNearbyExplosion(position);
                }
            }
            Destroy(this.gameObject);
            yield break;
        }
示例#9
0
        public static void DoRadialDamage(float damage, Vector3 position, float radius, bool damagePlayers, bool damageEnemies, bool ignoreDamageCaps = false, VFXPool hitVFX = null)
        {
            List <HealthHaver> allHealthHavers = StaticReferenceManager.AllHealthHavers;

            if (allHealthHavers != null)
            {
                for (int i = 0; i < allHealthHavers.Count; i++)
                {
                    HealthHaver healthHaver = allHealthHavers[i];
                    if (healthHaver)
                    {
                        if (healthHaver.gameObject.activeSelf)
                        {
                            if (!healthHaver.aiActor || !healthHaver.aiActor.IsGone)
                            {
                                if (!healthHaver.aiActor || healthHaver.aiActor.isActiveAndEnabled)
                                {
                                    for (int j = 0; j < healthHaver.NumBodyRigidbodies; j++)
                                    {
                                        SpeculativeRigidbody bodyRigidbody = healthHaver.GetBodyRigidbody(j);
                                        Vector2 a      = healthHaver.transform.position.XY();
                                        Vector2 vector = a - position.XY();
                                        bool    flag   = false;
                                        bool    flag2  = false;
                                        float   num;
                                        if (bodyRigidbody.HitboxPixelCollider != null)
                                        {
                                            a      = bodyRigidbody.HitboxPixelCollider.UnitCenter;
                                            vector = a - position.XY();
                                            num    = BraveMathCollege.DistToRectangle(position.XY(), bodyRigidbody.HitboxPixelCollider.UnitBottomLeft, bodyRigidbody.HitboxPixelCollider.UnitDimensions);
                                        }
                                        else
                                        {
                                            a      = healthHaver.transform.position.XY();
                                            vector = a - position.XY();
                                            num    = vector.magnitude;
                                        }
                                        if (num < radius)
                                        {
                                            PlayerController component = healthHaver.GetComponent <PlayerController>();
                                            if (component != null)
                                            {
                                                bool flag3 = true;
                                                if (PassiveItem.ActiveFlagItems.ContainsKey(component) && PassiveItem.ActiveFlagItems[component].ContainsKey(typeof(HelmetItem)) && num > radius * HelmetItem.EXPLOSION_RADIUS_MULTIPLIER)
                                                {
                                                    flag3 = false;
                                                }
                                                if (IsPlayerBlockedByWall(component, position))
                                                {
                                                    flag3 = false;
                                                }
                                                if (damagePlayers && flag3 && !component.IsEthereal)
                                                {
                                                    HealthHaver     healthHaver2   = healthHaver;
                                                    float           damage2        = 0.5f;
                                                    Vector2         direction      = vector;
                                                    string          enemiesString  = StringTableManager.GetEnemiesString("#EXPLOSION", -1);
                                                    CoreDamageTypes damageTypes    = CoreDamageTypes.None;
                                                    DamageCategory  damageCategory = DamageCategory.Normal;
                                                    healthHaver2.ApplyDamage(damage2, direction, enemiesString, damageTypes, damageCategory, false, null, ignoreDamageCaps);
                                                    flag2 = true;
                                                }
                                            }
                                            else if (damageEnemies)
                                            {
                                                AIActor aiActor = healthHaver.aiActor;
                                                if (damagePlayers || !aiActor || aiActor.IsNormalEnemy)
                                                {
                                                    HealthHaver     healthHaver3   = healthHaver;
                                                    Vector2         direction      = vector;
                                                    string          enemiesString  = StringTableManager.GetEnemiesString("#EXPLOSION", -1);
                                                    CoreDamageTypes damageTypes    = CoreDamageTypes.None;
                                                    DamageCategory  damageCategory = DamageCategory.Normal;
                                                    healthHaver3.ApplyDamage(damage, direction, enemiesString, damageTypes, damageCategory, false, null, ignoreDamageCaps);
                                                    flag2 = true;
                                                }
                                            }
                                            flag = true;
                                        }
                                        if (flag2 && hitVFX != null)
                                        {
                                            if (bodyRigidbody.HitboxPixelCollider != null)
                                            {
                                                PixelCollider pixelCollider = bodyRigidbody.GetPixelCollider(ColliderType.HitBox);
                                                Vector2       v             = BraveMathCollege.ClosestPointOnRectangle(position, pixelCollider.UnitBottomLeft, pixelCollider.UnitDimensions);
                                                hitVFX.SpawnAtPosition(v, 0f, null, null, null, null, false, null, null, false);
                                            }
                                            else
                                            {
                                                hitVFX.SpawnAtPosition(healthHaver.transform.position.XY(), 0f, null, null, null, null, false, null, null, false);
                                            }
                                        }
                                        if (flag)
                                        {
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        protected override HandleDamageResult HandleDamage(SpeculativeRigidbody rigidbody, PixelCollider hitPixelCollider, out bool killedTarget, PlayerController player, bool alreadyPlayerDelayed = false)
        {
            killedTarget = false;
            if (rigidbody.ReflectProjectiles)
            {
                return(HandleDamageResult.NO_HEALTH);
            }
            if (!rigidbody.healthHaver)
            {
                return(HandleDamageResult.NO_HEALTH);
            }
            if (!alreadyPlayerDelayed && s_delayPlayerDamage && player)
            {
                return(HandleDamageResult.HEALTH);
            }
            bool  flag = !rigidbody.healthHaver.IsDead;
            float num  = ModifiedDamage;

            if (Owner is AIActor && rigidbody && rigidbody.aiActor && (Owner as AIActor).IsNormalEnemy)
            {
                num = ProjectileData.FixedFallbackDamageToEnemies;
                if (rigidbody.aiActor.HitByEnemyBullets)
                {
                    num /= 4f;
                }
            }
            int healthHaverHitCount = (int)ProjectileHealthHaverHitCountInfo.GetValue(this);

            if (Owner is PlayerController && m_hasPierced && healthHaverHitCount >= 1)
            {
                int num2 = Mathf.Clamp(healthHaverHitCount - 1, 0, GameManager.Instance.PierceDamageScaling.Length - 1);
                num *= GameManager.Instance.PierceDamageScaling[num2];
            }
            if (OnWillKillEnemy != null && num >= rigidbody.healthHaver.GetCurrentHealth())
            {
                OnWillKillEnemy(this, rigidbody);
            }
            if (rigidbody.healthHaver.IsBoss)
            {
                num *= BossDamageMultiplier;
            }
            if (BlackPhantomDamageMultiplier != 1f && rigidbody.aiActor && rigidbody.aiActor.IsBlackPhantom)
            {
                num *= BlackPhantomDamageMultiplier;
            }
            bool flag2 = false;

            if (DelayedDamageToExploders)
            {
                flag2 = (rigidbody.GetComponent <ExplodeOnDeath>() && rigidbody.healthHaver.GetCurrentHealth() <= num);
            }
            if (!flag2)
            {
                HealthHaver     healthHaver     = rigidbody.healthHaver;
                float           damage          = num;
                Vector2         velocity        = specRigidbody.Velocity;
                string          ownerName       = OwnerName;
                CoreDamageTypes coreDamageTypes = damageTypes;
                DamageCategory  damageCategory  = (!IsBlackBullet) ? DamageCategory.Normal : DamageCategory.BlackBullet;
                healthHaver.ApplyDamage(damage, velocity, ownerName, coreDamageTypes, damageCategory, true, hitPixelCollider, ignoreDamageCaps);
                if (player && player.OnHitByProjectile != null)
                {
                    player.OnHitByProjectile(this, player);
                }
            }
            else
            {
                rigidbody.StartCoroutine((IEnumerator)ProjectileHandleDelayedDamageInfo.Invoke(this, new object[] { rigidbody, num, specRigidbody.Velocity, hitPixelCollider }));
            }
            if (Owner && Owner is AIActor && player)
            {
                (Owner as AIActor).HasDamagedPlayer = true;
            }
            killedTarget = (flag && rigidbody.healthHaver.IsDead);
            if (!killedTarget && rigidbody.gameActor != null)
            {
                if (AppliesPoison && UnityEngine.Random.value < PoisonApplyChance)
                {
                    rigidbody.gameActor.ApplyEffect(healthEffect, 1f, null);
                }
                if (AppliesSpeedModifier && UnityEngine.Random.value < SpeedApplyChance)
                {
                    rigidbody.gameActor.ApplyEffect(speedEffect, 1f, null);
                }
                if (AppliesCharm && UnityEngine.Random.value < CharmApplyChance)
                {
                    rigidbody.gameActor.ApplyEffect(charmEffect, 1f, null);
                }
                if (AppliesFreeze && UnityEngine.Random.value < FreezeApplyChance)
                {
                    rigidbody.gameActor.ApplyEffect(freezeEffect, 1f, null);
                }
                if (AppliesCheese && UnityEngine.Random.value < CheeseApplyChance)
                {
                    rigidbody.gameActor.ApplyEffect(cheeseEffect, 1f, null);
                }
                if (AppliesBleed && UnityEngine.Random.value < BleedApplyChance)
                {
                    rigidbody.gameActor.ApplyEffect(bleedEffect, -1f, this);
                }
                if (AppliesFire && UnityEngine.Random.value < FireApplyChance)
                {
                    rigidbody.gameActor.ApplyEffect(fireEffect, 1f, null);
                }
                if (AppliesStun && UnityEngine.Random.value < StunApplyChance && rigidbody.gameActor.behaviorSpeculator)
                {
                    rigidbody.gameActor.behaviorSpeculator.Stun(AppliedStunDuration, true);
                }
                for (int i = 0; i < statusEffectsToApply.Count; i++)
                {
                    rigidbody.gameActor.ApplyEffect(statusEffectsToApply[i], 1f, null);
                }
            }
            ProjectileHealthHaverHitCountInfo.SetValue(this, healthHaverHitCount + 1);
            return((!killedTarget) ? HandleDamageResult.HEALTH : HandleDamageResult.HEALTH_AND_KILLED);
        }