public override void Update()
 {
     if (Owner && !Dungeon.IsGenerating && Owner.IsInCombat && base.transform.position.GetAbsoluteRoom() == Owner.CurrentRoom)
     {
         if (timer > 0)
         {
             timer -= BraveTime.DeltaTime;
         }
         if (timer <= 0)
         {
             this.aiAnimator.PlayUntilFinished("attack", false, null, -1f, false);
             Exploder.DoRadialKnockback(this.specRigidbody.UnitCenter, 70, 10);
             float dmg = 2.5f;
             if (PassiveItem.IsFlagSetForCharacter(this.Owner, typeof(BattleStandardItem)))
             {
                 dmg *= BattleStandardItem.BattleStandardCompanionDamageMultiplier;
             }
             if (this.Owner.CurrentGun && this.Owner.CurrentGun.LuteCompanionBuffActive)
             {
                 dmg *= 2;
             }
             Exploder.DoRadialDamage(dmg, this.specRigidbody.UnitCenter, 10, false, true, false, null);
             timer = 1.5f;
         }
     }
 }
 private void OnOwnerDodgeRolled(PlayerController dodger)
 {
     if (dodger && dodger.PlayerHasActiveSynergy("Gale Force"))
     {
         this.aiAnimator.PlayUntilFinished("attack", false, null, -1f, false);
         Exploder.DoRadialKnockback(this.specRigidbody.UnitCenter, 70, 10);
         Exploder.DoRadialDamage(2.5f, this.specRigidbody.UnitCenter, 10, false, true, false, null);
         timer = 1.5f;
     }
 }
 private void DoExplosion()
 {
     if (useDefaultExplosion)
     {
         Exploder.DoDefaultExplosion(specRigidbody.GetUnitCenter(ColliderType.HitBox), Vector2.zero, null, true, CoreDamageTypes.None);
         Exploder.DoRadialDamage(120f, specRigidbody.GetUnitCenter(ColliderType.HitBox), 3.5f, true, true, false);
     }
     else
     {
         Exploder.Explode(specRigidbody.GetUnitCenter(ColliderType.HitBox), ChaosExplosionData, Vector2.zero, null, false, CoreDamageTypes.None, false);
     }
 }
Beispiel #4
0
        private void onDodgeRoll(PlayerController player, Vector2 dirVec)
        {
            int radius = 10;

            if (Owner.PlayerHasActiveSynergy("Let Loose"))
            {
                radius = 20;
            }

            Exploder.DoRadialKnockback(player.specRigidbody.UnitCenter, 100, radius);

            if (Owner.PlayerHasActiveSynergy("Scytheclone"))
            {
                float curDodgeDam = player.stats.GetStatValue(PlayerStats.StatType.DodgeRollDamage);
                Exploder.DoRadialDamage(curDodgeDam * 3, player.specRigidbody.UnitCenter, radius, false, true, false, null);
            }
        }
        private void DoExplosion()
        {
            if (ExplosionNotGuranteed)
            {
                if (Random.value > ExplosionOdds)
                {
                    return;
                }
            }

            if (useDefaultExplosion)
            {
                Exploder.DoDefaultExplosion(specRigidbody.GetUnitCenter(ColliderType.HitBox), Vector2.zero, null, true, CoreDamageTypes.None);
                Exploder.DoRadialDamage(ExplosionDamage, specRigidbody.GetUnitCenter(ColliderType.HitBox), 3.5f, true, true, false);
            }
            else
            {
                Exploder.Explode(specRigidbody.GetUnitCenter(ColliderType.HitBox), ExpandExplosionData, Vector2.zero, null, true, CoreDamageTypes.None, false);
            }
        }
Beispiel #6
0
        private void SelfDestructOnKick()
        {
            int     currentCurse                 = PlayerStats.GetTotalCurse();
            int     currentCoolness              = PlayerStats.GetTotalCoolness();
            float   ExplodeOnKickChances         = 0.25f;
            float   ExplodeOnKickDamageToEnemies = 150f;
            Vector2 ExplosionCenterPosition      = sprite.WorldCenter;


            bool ExplodeOnKickDamagesPlayer = BraveUtility.RandomBool();

            if (willDefinitelyExplode)
            {
                ExplodeOnKickDamagesPlayer   = false;
                ExplodeOnKickDamageToEnemies = 200f;
            }
            else
            {
                if (currentCoolness >= 3)
                {
                    ExplodeOnKickDamagesPlayer   = false;
                    ExplodeOnKickDamageToEnemies = 175f;
                }
                if (currentCurse >= 3)
                {
                    ExplodeOnKickChances         = 0.35f;
                    ExplodeOnKickDamageToEnemies = 200f;
                }
            }

            if (!ExplodeOnKickDamagesPlayer)
            {
                TableExplosionData.damageToPlayer = 0;
            }

            if (spawnObjectOnSelfDestruct && SpawnedObject != null && !m_objectSpawned)
            {
                m_objectSpawned = true;
                GameObject PlacedGlitchObject = ExpandUtility.GenerateDungeonPlacable(SpawnedObject, false, true).InstantiateObject(transform.position.GetAbsoluteRoom(), (specRigidbody.GetUnitCenter(ColliderType.HitBox) - transform.position.GetAbsoluteRoom().area.basePosition.ToVector2()).ToIntVector2(VectorConversions.Floor));
                PlacedGlitchObject.transform.parent = transform.position.GetAbsoluteRoom().hierarchyParent;

                if (PlacedGlitchObject.GetComponent <PickupObject>() != null)
                {
                    PickupObject PlacedGltichObjectComponent = PlacedGlitchObject.GetComponent <PickupObject>();
                    PlacedGltichObjectComponent.RespawnsIfPitfall = true;
                }
            }

            if (UnityEngine.Random.value <= ExplodeOnKickChances | willDefinitelyExplode)
            {
                if (useDefaultExplosion)
                {
                    Exploder.DoDefaultExplosion(ExplosionCenterPosition, Vector2.zero, null, true, CoreDamageTypes.None);
                    Exploder.DoRadialDamage(ExplodeOnKickDamageToEnemies, ExplosionCenterPosition, 4f, ExplodeOnKickDamagesPlayer, true, true);
                }
                else
                {
                    Exploder.Explode(ExplosionCenterPosition, TableExplosionData, Vector2.zero, null, false, CoreDamageTypes.None, false);
                }
                Destroy(gameObject);
                return;
            }
            return;
        }
        private IEnumerator Jump(Vector2 direction)
        {
            m_isJumping = true;
            if (player.CurrentFireMeterValue > 0f)
            {
                player.CurrentFireMeterValue = Mathf.Max(0f, player.CurrentFireMeterValue -= 0.5f);
                if (player.CurrentFireMeterValue == 0f)
                {
                    player.IsOnFire = false;
                }
            }
            Func <bool, bool> noFallsForYou = ((bool b) => false);
            AnimationCurve    jumpCurve     = new AnimationCurve(new Keyframe[] { new Keyframe {
                                                                                      time = 0, value = 6f
                                                                                  }, new Keyframe {
                                                                                      time = (0.5f * player.rollStats.GetModifiedTime(player)), value = 0f
                                                                                  }, new Keyframe {
                                                                                      time =
                                                                                          player.rollStats.GetModifiedTime(player), value = -6f
                                                                                  } });

            player.SetInputOverride("king slime's jump");
            player.ToggleGunRenderers(false, "king slime's jump");
            player.ToggleHandRenderers(false, "king slime's jump");
            player.OnAboutToFall += noFallsForYou;
            player.specRigidbody.AddCollisionLayerIgnoreOverride(CollisionMask.LayerToMask(CollisionLayer.Projectile));
            player.specRigidbody.AddCollisionLayerIgnoreOverride(CollisionMask.LayerToMask(CollisionLayer.EnemyHitBox));
            player.specRigidbody.AddCollisionLayerIgnoreOverride(CollisionMask.LayerToMask(CollisionLayer.EnemyCollider));
            float ela = 0f;

            while (ela < (player.rollStats.GetModifiedTime(player)))
            {
                ela = BraveTime.DeltaTime + ela;
                player.sprite.transform.position = new Vector2(player.sprite.transform.position.x, Mathf.Max(player.sprite.transform.position.y + (jumpCurve.Evaluate(ela) * BraveTime.DeltaTime), player.ShadowObject.GetAnyComponent <tk2dBaseSprite>().WorldCenter.y));
                float time  = Mathf.Clamp01((ela - BraveTime.DeltaTime) / player.rollStats.GetModifiedTime(player));
                float time2 = Mathf.Clamp01(ela / player.rollStats.GetModifiedTime(player));
                float num   = (Mathf.Clamp01(player.rollStats.speed.Evaluate(time2)) - Mathf.Clamp01(player.rollStats.speed.Evaluate(time))) * player.rollStats.GetModifiedDistance(player);
                player.specRigidbody.Velocity = direction.normalized * (num / BraveTime.DeltaTime) + player.knockbackComponent + player.immutableKnockbackComponent;
                yield return(null);
            }
            player.specRigidbody.Velocity = Vector2.zero;
            player.specRigidbody.RemoveCollisionLayerIgnoreOverride(CollisionMask.LayerToMask(CollisionLayer.Projectile));
            player.specRigidbody.RemoveCollisionLayerIgnoreOverride(CollisionMask.LayerToMask(CollisionLayer.EnemyHitBox));
            player.specRigidbody.RemoveCollisionLayerIgnoreOverride(CollisionMask.LayerToMask(CollisionLayer.EnemyCollider));
            player.OnAboutToFall -= noFallsForYou;
            player.ToggleGunRenderers(true, "king slime's jump");
            player.ToggleHandRenderers(true, "king slime's jump");
            player.ClearInputOverride("king slime's jump");
            Exploder.DoRadialPush(player.sprite.WorldBottomCenter.ToVector3ZUp(player.sprite.WorldBottomCenter.y), 22f, 1.5f);
            Exploder.DoRadialKnockback(player.sprite.WorldBottomCenter.ToVector3ZUp(player.sprite.WorldBottomCenter.y), 100f, 1.5f);
            Exploder.DoRadialDamage(5f * player.stats.GetStatValue(PlayerStats.StatType.DodgeRollDamage), player.sprite.WorldBottomCenter.ToVector3ZUp(player.sprite.WorldBottomCenter.y), 1.5f, false, true, false, null);
            GameObject gameObject = SpawnManager.SpawnVFX(BraveResources.Load <GameObject>("Global VFX/VFX_DBZ_Charge", ".prefab"), false);

            gameObject.transform.position = player.specRigidbody.UnitCenter;
            tk2dBaseSprite component = gameObject.GetComponent <tk2dBaseSprite>();

            component.HeightOffGround = -1f;
            component.UpdateZDepth();
            m_isJumping = false;
            yield break;
        }
        private void SelfDestructOnKick()
        {
            int   currentCurse                 = PlayerStats.GetTotalCurse();
            int   currentCoolness              = PlayerStats.GetTotalCoolness();
            float ExplodeOnKickChances         = 0.25f;
            float ExplodeOnKickDamageToEnemies = 150f;

            bool ExplodeOnKickDamagesPlayer = BraveUtility.RandomBool();

            if (willDefinitelyExplode)
            {
                ExplodeOnKickChances         = 1f;
                ExplodeOnKickDamagesPlayer   = false;
                ExplodeOnKickDamageToEnemies = 200f;
            }
            else
            {
                if (currentCoolness >= 3)
                {
                    ExplodeOnKickDamagesPlayer   = false;
                    ExplodeOnKickDamageToEnemies = 175f;
                }
                if (currentCurse >= 3)
                {
                    ExplodeOnKickChances         = 0.35f;
                    ExplodeOnKickDamageToEnemies = 200f;
                }
            }

            if (spawnObjectOnSelfDestruct && SpawnedObject != null && !m_objectSpawned)
            {
                m_objectSpawned = true;
                GameObject PlacedGlitchObject = ChaosUtility.GenerateDungeonPlacable(SpawnedObject, false, true).InstantiateObject(transform.position.GetAbsoluteRoom(), (specRigidbody.GetUnitCenter(ColliderType.HitBox) - transform.position.GetAbsoluteRoom().area.basePosition.ToVector2()).ToIntVector2(VectorConversions.Floor));
                PlacedGlitchObject.transform.parent = transform.position.GetAbsoluteRoom().hierarchyParent;

                if (PlacedGlitchObject.GetComponent <PickupObject>() != null)
                {
                    PickupObject PlacedGltichObjectComponent = PlacedGlitchObject.GetComponent <PickupObject>();
                    PlacedGltichObjectComponent.RespawnsIfPitfall = true;
                }
            }

            if (UnityEngine.Random.value <= ExplodeOnKickChances)
            {
                if (useDefaultExplosion)
                {
                    Exploder.DoDefaultExplosion(specRigidbody.GetUnitCenter(ColliderType.HitBox), Vector2.zero, null, true, CoreDamageTypes.None);
                    Exploder.DoRadialDamage(ExplodeOnKickDamageToEnemies, sprite.WorldCenter, 4f, ExplodeOnKickDamagesPlayer, true, true);
                }
                else
                {
                    Exploder.Explode(specRigidbody.GetUnitCenter(ColliderType.HitBox), TableExplosionData, Vector2.zero, null, false, CoreDamageTypes.None, false);
                }

                /*if (gameObject.GetComponent<FlippableCover>() != null) {
                 *  FlippableCover flippableCover = gameObject.GetComponent<FlippableCover>();
                 *      flippableCover.DestroyCover();
                 * } else if (gameObject.GetComponent<MajorBreakable>() != null) {
                 *  MajorBreakable majorBreakableComponent = gameObject.GetComponent<MajorBreakable>();
                 *  if (m_lastDirectionKicked.HasValue) {
                 *      majorBreakableComponent.Break(m_lastDirectionKicked.Value.ToVector2());
                 *  } else {
                 *      majorBreakableComponent.Break(new Vector2(0, 0));
                 *  }
                 * } else if (gameObject.GetComponent<MinorBreakable>() != null) {
                 *  MinorBreakable minorBreakableComponent = gameObject.GetComponent<MinorBreakable>();
                 *  minorBreakableComponent.Break();
                 * } else {
                 *  Destroy(gameObject);
                 * }*/
                Destroy(gameObject);
                return;
            }
            return;
        }