private IEnumerator Quake()
            {
                yield return(null);

                RoomHandler room = self.GetAbsoluteRoom();

                if (room != null)
                {
                    Exploder.DoRadialMinorBreakableBreak(base.transform.position, 20);
                    List <AIActor> enemies = room.GetActiveEnemies(RoomHandler.ActiveEnemyType.All);
                    if (enemies != null && enemies.Count > 0)
                    {
                        for (int i = 0; i < enemies.Count; i++)
                        {
                            AIActor enemy = enemies[i];
                            if (enemy && enemy.healthHaver && enemy.healthHaver.IsAlive)
                            {
                                float knockback = 20;

                                float dmg = self.baseData.damage;

                                if (self.ProjectilePlayerOwner())
                                {
                                    knockback *= self.ProjectilePlayerOwner().stats.GetStatValue(PlayerStats.StatType.KnockbackMultiplier);
                                    if (enemy.healthHaver.IsBoss)
                                    {
                                        dmg *= self.ProjectilePlayerOwner().stats.GetStatValue(PlayerStats.StatType.DamageToBosses);
                                    }
                                    if (enemy.aiActor.IsBlackPhantom)
                                    {
                                        dmg *= self.BlackPhantomDamageMultiplier;
                                    }
                                }

                                enemy.healthHaver.ApplyDamage(dmg, UnityEngine.Random.insideUnitCircle, "Quake");
                                if (enemy.knockbackDoer)
                                {
                                    enemy.knockbackDoer.ApplyKnockback(UnityEngine.Random.insideUnitCircle, knockback, false);
                                }

                                List <GameActorEffect> effects = self.GetFullListOfStatusEffects();
                                if (effects.Count > 0)
                                {
                                    foreach (GameActorEffect effect in effects)
                                    {
                                        enemy.ApplyEffect(effect);
                                    }
                                }
                                if (enemy.behaviorSpeculator && self.AppliesStun && UnityEngine.Random.value <= self.StunApplyChance)
                                {
                                    enemy.behaviorSpeculator.Stun(self.AppliedStunDuration);
                                }
                            }
                        }
                    }
                }
                UnityEngine.Object.Destroy(self.gameObject);
                yield break;
            }
        private void BeginHammerState(ExpandHammerState state)
        {
            if (state == ExpandHammerState.InitialDelay)
            {
                TargetAnimator.renderer.enabled    = false;
                HitEffectAnimator.renderer.enabled = false;
                sprite.renderer.enabled            = false;
                m_timer = InitialDelay;
            }
            else if (state == ExpandHammerState.PreSwing)
            {
                if (m_Owner != null)
                {
                    m_targetPlayer = m_Owner;
                }
                else
                {
                    m_targetPlayer = GameManager.Instance.GetRandomActivePlayer();
                }
                if (TracksRandomEnemy)
                {
                    m_SelectedEnemy = m_room.GetRandomActiveEnemy(false);
                    if (DisablesRegularForgeHammers && GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.FORGEGEON)
                    {
                        if (StaticReferenceManager.AllForgeHammers != null && StaticReferenceManager.AllForgeHammers.Count > 0)
                        {
                            List <ForgeHammerController> AllForgeHammers = StaticReferenceManager.AllForgeHammers;
                            for (int i = 0; i < AllForgeHammers.Count; i++)
                            {
                                if (AllForgeHammers[i].transform.position.GetAbsoluteRoom() == m_room)
                                {
                                    AllForgeHammers[i].Deactivate();
                                }
                            }
                        }
                    }
                }
                if (GameManager.Instance.CurrentGameType == GameManager.GameType.COOP_2_PLAYER)
                {
                    List <PlayerController> list = new List <PlayerController>(2);
                    Vector2 unitBottomLeft       = m_room.area.UnitBottomLeft;
                    Vector2 unitTopRight         = m_room.area.UnitTopRight;
                    for (int i = 0; i < GameManager.Instance.AllPlayers.Length; i++)
                    {
                        PlayerController playerController = GameManager.Instance.AllPlayers[i];
                        if (playerController && playerController.healthHaver.IsAlive)
                        {
                            Vector2 centerPosition = playerController.CenterPosition;
                            if (BraveMathCollege.AABBContains(unitBottomLeft - Vector2.one, unitTopRight + Vector2.one, centerPosition))
                            {
                                list.Add(playerController);
                            }
                        }
                    }
                    if (list.Count > 0)
                    {
                        m_targetPlayer = BraveUtility.RandomElement(list);
                    }
                }
                IntVector2 a = m_targetPlayer.CenterPosition.ToIntVector2(VectorConversions.Floor);
                if (ForceLeft)
                {
                    m_attackIsLeft = true;
                }
                else if (ForceRight)
                {
                    m_attackIsLeft = false;
                }
                else
                {
                    int num = 0;
                    while (GameManager.Instance.Dungeon.data[a + IntVector2.Left * num].type != CellType.WALL)
                    {
                        num++;
                    }
                    int num2 = 0;
                    while (GameManager.Instance.Dungeon.data[a + IntVector2.Right * num2].type != CellType.WALL)
                    {
                        num2++;
                    }
                    m_attackIsLeft = (num < num2);
                }
                m_inAnim  = ((!m_attackIsLeft) ? Hammer_Anim_In_Right : Hammer_Anim_In_Left);
                m_outAnim = ((!m_attackIsLeft) ? Hammer_Anim_Out_Right : Hammer_Anim_Out_Left);
                TargetAnimator.StopAndResetFrame();
                if (TracksPlayer | TracksRandomEnemy)
                {
                    TargetAnimator.renderer.enabled = true;
                }
                else
                {
                    TargetAnimator.renderer.enabled = false;
                }
                TargetAnimator.PlayAndDisableRenderer((!m_attackIsLeft) ? "hammer_right_target" : "hammer_left_target");
                m_targetOffset = ((!m_attackIsLeft) ? new Vector2(4.625f, 1.9375f) : new Vector2(1.9375f, 1.9375f));
                m_timer        = FlashDurationBeforeAttack;
            }
            else if (state == ExpandHammerState.Swing)
            {
                sprite.renderer.enabled = true;
                spriteAnimator.Play(m_inAnim);
                ShadowAnimator.renderer.enabled = true;
                ShadowAnimator.Play((!m_attackIsLeft) ? "hammer_right_slam_shadow" : "hammer_left_slam_shadow");
                sprite.HeightOffGround = -2.5f;
                sprite.UpdateZDepth();
                m_additionalTrackTimer = AdditionalTrackingTime;
            }
            else if (state == ExpandHammerState.Grounded)
            {
                if (DoScreenShake)
                {
                    GameManager.Instance.MainCameraController.DoScreenShake(ScreenShake, new Vector2?(specRigidbody.UnitCenter), false);
                }
                specRigidbody.enabled = true;
                specRigidbody.PixelColliders[0].ManualOffsetX = ((!m_attackIsLeft) ? 59 : 16);
                specRigidbody.PixelColliders[1].ManualOffsetX = ((!m_attackIsLeft) ? 59 : 16);
                specRigidbody.ForceRegenerate(null, null);
                specRigidbody.Reinitialize();
                Exploder.DoRadialMinorBreakableBreak(TargetAnimator.sprite.WorldCenter, 4f);
                HitEffectAnimator.renderer.enabled = true;
                HitEffectAnimator.PlayAndDisableRenderer((!m_attackIsLeft) ? "hammer_right_slam_vfx" : "hammer_left_slam_vfx");
                List <SpeculativeRigidbody> overlappingRigidbodies = PhysicsEngine.Instance.GetOverlappingRigidbodies(specRigidbody, null, false);
                for (int j = 0; j < overlappingRigidbodies.Count; j++)
                {
                    if (overlappingRigidbodies[j].gameActor)
                    {
                        Vector2 direction = overlappingRigidbodies[j].UnitCenter - specRigidbody.UnitCenter;
                        if (overlappingRigidbodies[j].gameActor is PlayerController)
                        {
                            PlayerController playerController2 = overlappingRigidbodies[j].gameActor as PlayerController;
                            if (overlappingRigidbodies[j].CollideWithOthers)
                            {
                                if (!playerController2.DodgeRollIsBlink || !playerController2.IsDodgeRolling)
                                {
                                    if (overlappingRigidbodies[j].healthHaver)
                                    {
                                        overlappingRigidbodies[j].healthHaver.ApplyDamage(0.5f, direction, StringTableManager.GetEnemiesString("#FORGE_HAMMER", -1), CoreDamageTypes.None, DamageCategory.Normal, false, null, false);
                                    }
                                    if (overlappingRigidbodies[j].knockbackDoer)
                                    {
                                        overlappingRigidbodies[j].knockbackDoer.ApplyKnockback(direction, KnockbackForcePlayers, false);
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (overlappingRigidbodies[j].healthHaver)
                            {
                                overlappingRigidbodies[j].healthHaver.ApplyDamage(DamageToEnemies, direction, StringTableManager.GetEnemiesString("#FORGE_HAMMER", -1), CoreDamageTypes.None, DamageCategory.Normal, false, null, false);
                            }
                            if (overlappingRigidbodies[j].knockbackDoer)
                            {
                                overlappingRigidbodies[j].knockbackDoer.ApplyKnockback(direction, KnockbackForceEnemies, false);
                            }
                        }
                    }
                }
                PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(specRigidbody, null, false);
                if (DoGoopOnImpact)
                {
                    DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(GoopToDo).AddGoopRect(specRigidbody.UnitCenter + new Vector2(-1f, -1.25f), specRigidbody.UnitCenter + new Vector2(1f, 0.75f));
                }
                if (DoesBulletsOnImpact && m_isActive)
                {
                    ShootPoint.transform.position = specRigidbody.UnitCenter;
                    CellData cell = ShootPoint.transform.position.GetCell();
                    if (cell != null && cell.type != CellType.WALL)
                    {
                        if (!m_bulletSource)
                        {
                            m_bulletSource = ShootPoint.gameObject.GetOrAddComponent <BulletScriptSource>();
                        }
                        m_bulletSource.BulletManager = bulletBank;
                        m_bulletSource.BulletScript  = BulletScript;
                        m_bulletSource.Initialize();
                        if (TracksRandomEnemy && m_Owner != null)
                        {
                            if (bulletBank)
                            {
                                bulletBank.OnProjectileCreated = (Action <Projectile>)Delegate.Combine(bulletBank.OnProjectileCreated, new Action <Projectile>(HandleForgeHammerPostProcessProjectile));

                                /*if (gameObject.GetComponent<AIBulletBank>()) {
                                 *  AIBulletBank aiBulletBank = gameObject.GetComponent<AIBulletBank>();
                                 *  aiBulletBank.Bullets[0].forceCanHitEnemies = true;
                                 * }*/
                            }
                        }
                    }
                }
                m_timer = UnityEngine.Random.Range(MinTimeToRestOnGround, MaxTimeToRestOnGround);
            }
            else if (state == ExpandHammerState.UpSwing)
            {
                spriteAnimator.Play(m_outAnim);
                ShadowAnimator.PlayAndDisableRenderer((!m_attackIsLeft) ? "hammer_right_out_shadow" : "hammer_left_out_shadow");
            }
            else if (state == ExpandHammerState.Gone)
            {
                sprite.renderer.enabled = false;
                m_timer = UnityEngine.Random.Range(MinTimeBetweenAttacks, MaxTimeBetweenAttacks);
            }
        }