private void PostProcessBeam(BeamController beam)
 {
     if (beam && beam.projectile)
     {
         Exploder.DoRadialKnockback(beam.Origin, 40, 7);
         if (beam.projectile && beam.projectile.GetAbsoluteRoom() != null)
         {
             List <AIActor> activeEnemies = beam.projectile.GetAbsoluteRoom().GetActiveEnemies(RoomHandler.ActiveEnemyType.All);
             if (activeEnemies != null && activeEnemies.Count > 0)
             {
                 for (int i = 0; i < activeEnemies.Count; i++)
                 {
                     AIActor aiactor = activeEnemies[i];
                     if (aiactor.IsNormalEnemy && aiactor.behaviorSpeculator)
                     {
                         if (Vector2.Distance(beam.Origin, aiactor.sprite.WorldCenter) < 3)
                         {
                             if (UnityEngine.Random.value <= (0.25f * 2))
                             {
                                 aiactor.behaviorSpeculator.Stun(1);
                             }
                         }
                         else if (Vector2.Distance(beam.Origin, aiactor.sprite.WorldCenter) < 6)
                         {
                             if (UnityEngine.Random.value <= (0.07f * 2))
                             {
                                 aiactor.behaviorSpeculator.Stun(1);
                             }
                         }
                     }
                 }
             }
         }
     }
 }
        private IEnumerator KnockbackDoer(Projectile proj, float flot)
        {
            yield return(null);

            Exploder.DoRadialKnockback(proj.specRigidbody.UnitCenter, (20 * flot), 7);
            if (proj.GetAbsoluteRoom() != null)
            {
                List <AIActor> activeEnemies = proj.GetAbsoluteRoom().GetActiveEnemies(RoomHandler.ActiveEnemyType.All);
                if (activeEnemies != null && activeEnemies.Count > 0)
                {
                    for (int i = 0; i < activeEnemies.Count; i++)
                    {
                        AIActor aiactor = activeEnemies[i];
                        if (aiactor.IsNormalEnemy && aiactor.behaviorSpeculator)
                        {
                            if (Vector2.Distance(proj.specRigidbody.UnitCenter, aiactor.sprite.WorldCenter) < 3)
                            {
                                if (UnityEngine.Random.value <= (0.25f * flot))
                                {
                                    aiactor.behaviorSpeculator.Stun(1);
                                }
                            }
                            else if (Vector2.Distance(proj.specRigidbody.UnitCenter, aiactor.sprite.WorldCenter) < 6)
                            {
                                if (UnityEngine.Random.value <= (0.07f * flot))
                                {
                                    aiactor.behaviorSpeculator.Stun(1);
                                }
                            }
                        }
                    }
                }
            }
            yield break;
        }
 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;
         }
     }
 }
        // This is the code for the actual player dash.
        IEnumerator LaunchPlayer(PlayerController player, AIActor enemy)
        {
            player.SetIsFlying(true, "DASHIN", false);     // Make the player fly so they can cross over pits while they dash.

            var targetPosition = enemy.transform.position; // This is set to the target dash destination

            // This part sets up black afterimages on the player, for a small added effect.
            var aitc = player.gameObject.GetOrAddComponent <AfterImageTrailController>();

            aitc.dashColor       = new Color32(0, 0, 0, 255);
            aitc.shadowTimeDelay = 0.05f;
            aitc.spawnShadows    = true;

            int time = 20; // This is how many frames it'll take to travel the dash distance

            // If the player has the destination locked synergy, make the dash happen in 3 frames instead of 20
            if (player.PlayerHasActiveSynergy("Destination Locked"))
            {
                time = 3;
            }

            for (int i = 0; i < time; i++)
            {
                player.specRigidbody.Velocity += (Vector2)(targetPosition - player.transform.position) * 100f * (1f / (float)time); // Add to the players velocity so that they'll be at the location after the amount of frames using mathâ„¢
                Exploder.DoRadialKnockback(player.CenterPosition, 50f, 3f);                                                         // Deal knockback so that other enemies are pushed away. The target enemy got applied with knockback resistance so it's not affected by this
                yield return(null);
            }

            player.SetIsFlying(false, "DASHIN", false); // Remove flight from the player now that the dash is over
            aitc.spawnShadows = false;                  // Disable the player afterimages
            yield break;
        }
Example #5
0
 protected override void DoEffect(PlayerController user)
 {
     AkSoundEngine.PostEvent("Play_WPN_Gun_Musical_01", gameObject);
     Exploder.DoRadialKnockback(user.CenterPosition, 100f, 15f);
     this.Collide1(15f);
     ETGMod.SayTheMagicWord();
     ETGMod.KeepSinging();
 }
 private IEnumerator reverseKnockback()
 {
     for (int i = 0; i < 6; i++)
     {
         AkSoundEngine.PostEvent("Play_WPN_moonscraperLaser_shot_01", base.gameObject);
         Exploder.DoRadialKnockback(base.LastOwner.CenterPosition, -25f, 25f);
         yield return(new WaitForSeconds(1));
     }
     AkSoundEngine.PostEvent("Stop_WPN_All", base.gameObject);
 }
 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;
     }
 }
Example #8
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 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;
        }
Example #10
0
        private void OnTableFlipped(FlippableCover obj)
        {
            if (Owner && obj)
            {
                int selectedEffect = UnityEngine.Random.Range(1, (27 + 1));
                ETGModConsole.Log("Selected Effect: " + selectedEffect);
                switch (selectedEffect)
                {
                case 1:
                    SpawnFoldingTable();
                    break;

                case 2:
                    DoSafeExplosion(obj.specRigidbody.UnitCenter);
                    break;

                case 3:
                    DoGoop(obj.specRigidbody.UnitCenter, EasyGoopDefinitions.FireDef);
                    break;

                case 4:
                    DoGoop(obj.specRigidbody.UnitCenter, EasyGoopDefinitions.PoisonDef);
                    break;

                case 5:
                    DoGoop(obj.specRigidbody.UnitCenter, EasyGoopDefinitions.CharmGoopDef);
                    break;

                case 6:
                    DoGoop(obj.specRigidbody.UnitCenter, EasyGoopDefinitions.CheeseDef);
                    break;

                case 7:
                    LootEngine.SpawnCurrency(obj.specRigidbody.UnitCenter, UnityEngine.Random.Range(5, 10), false);
                    break;

                case 8:
                    Owner.DoEasyBlank(obj.specRigidbody.UnitCenter, EasyBlankType.FULL);
                    break;

                case 9:
                    Owner.DoEasyBlank(obj.specRigidbody.UnitCenter, EasyBlankType.MINI);
                    break;

                case 10:
                    FullRoomStatusEffect(StaticStatusEffects.charmingRoundsEffect);
                    break;

                case 11:
                    FullRoomStatusEffect(PickupObjectDatabase.GetById(569).GetComponent <ChaosBulletsItem>().FreezeModifierEffect);
                    break;

                case 12:
                    FullRoomStatusEffect(StaticStatusEffects.tripleCrossbowSlowEffect);
                    break;

                case 13:
                    Exploder.DoRadialKnockback(obj.specRigidbody.UnitCenter, 200, 100);
                    break;

                case 14:
                    SpawnBlackHole(obj.specRigidbody.UnitCenter);
                    break;

                case 15:
                    if (Owner.CurrentGun != null)
                    {
                        Owner.CurrentGun.GainAmmo(UnityEngine.Random.Range(5, 26));
                    }
                    break;

                case 16:
                    FreezeTime();
                    break;

                case 17:
                    TurnTableIntoRocket(obj);
                    break;

                case 18:
                    StunEnemies();
                    break;

                case 19:
                    LootEngine.SpawnCurrency(obj.specRigidbody.UnitCenter, UnityEngine.Random.Range(2, 6), true);
                    break;

                case 20:
                    CompanionisedEnemyUtility.SpawnCompanionisedEnemy(Owner, "01972dee89fc4404a5c408d50007dad5", Owner.sprite.WorldCenter.ToIntVector2(), false, Color.red, 7, 2, false, true);
                    break;

                case 21:
                    int numBullat = UnityEngine.Random.Range(2, 6);
                    for (int i = 0; i < numBullat; i++)
                    {
                        CompanionisedEnemyUtility.SpawnCompanionisedEnemy(Owner, "2feb50a6a40f4f50982e89fd276f6f15", Owner.sprite.WorldCenter.ToIntVector2(), false, Color.red, 15, 2, false, false);
                    }
                    break;

                case 22:
                    FullRoomStatusEffect(StaticStatusEffects.hotLeadEffect);
                    break;

                case 23:
                    float degrees = 0;
                    for (int i = 0; i < 15; i++)
                    {
                        SpawnBullets((PickupObjectDatabase.GetById(50) as Gun).DefaultModule.projectiles[0], obj.specRigidbody.UnitCenter, degrees);
                        degrees += 24;
                    }
                    break;

                case 24:
                    SpawnBullets((PickupObjectDatabase.GetById(372) as Gun).DefaultModule.projectiles[0], Owner.sprite.WorldCenter, Owner.sprite.WorldCenter.GetVectorToNearestEnemy().ToAngle());
                    break;

                case 25:
                    StartCoroutine(HandleShield(Owner, 7));
                    break;

                case 26:
                    Owner.StartCoroutine(this.HandleSlowBullets());
                    break;

                case 27:
                    Owner.Enrage(4f);
                    break;
                }
            }
        }