Esempio n. 1
0
        protected override void DoEffect(PlayerController user)
        {
            Projectile projectile = ((Gun)ETGMod.Databases.Items[60]).DefaultModule.projectiles[0];

            projectile.AppliesFire               = true;
            projectile.FireApplyChance           = 1f;
            projectile.AdditionalScaleMultiplier = 3f;
            projectile.AdjustPlayerProjectileTint(ExtendedColours.red, 1, 0f);
            BeamController.FreeFireBeam(projectile, this.LastOwner, this.LastOwner.CurrentGun.CurrentAngle, 5f, true);
        }
        private void DoChanceBulletsEffect(Projectile source)
        {
            PlayerController m_player = source.ProjectilePlayerOwner();

            if (m_player && m_player.inventory != null)
            {
                for (int j = 0; j < m_player.inventory.AllGuns.Count; j++)
                {
                    if (m_player.inventory.AllGuns[j] && !m_player.inventory.AllGuns[j].InfiniteAmmo)
                    {
                        Gun cg2 = m_player.inventory.AllGuns[j];

                        ProjectileModule defaultModule = m_player.inventory.AllGuns[j].DefaultModule;
                        if (defaultModule.shootStyle == ProjectileModule.ShootStyle.Beam)
                        {
                            BeamController.FreeFireBeam(defaultModule.GetCurrentProjectile(), m_player, m_player.CurrentGun.CurrentAngle, 3f, true);
                        }
                        else if (defaultModule.shootStyle == ProjectileModule.ShootStyle.Charged)
                        {
                            Projectile projectile = null;
                            for (int k = 0; k < 15; k++)
                            {
                                ProjectileModule.ChargeProjectile chargeProjectile = defaultModule.chargeProjectiles[UnityEngine.Random.Range(0, defaultModule.chargeProjectiles.Count)];
                                if (chargeProjectile != null)
                                {
                                    projectile = chargeProjectile.Projectile;
                                }
                                if (projectile)
                                {
                                    break;
                                }
                            }
                            if (projectile != null)
                            {
                                StartCoroutine(EraseAndReplace(source, projectile));
                            }
                        }
                        Projectile currentProjectile = defaultModule.GetCurrentProjectile();
                        if (currentProjectile != null)
                        {
                            StartCoroutine(EraseAndReplace(source, currentProjectile));
                        }
                    }
                }
            }
        }
Esempio n. 3
0
        public void BlankModHook(Action <SilencerInstance, BlankModificationItem, Vector2, PlayerController> orig, SilencerInstance silencer, BlankModificationItem bmi, Vector2 centerPoint, PlayerController user)
        {
            orig(silencer, bmi, centerPoint, user);

            if (user.HasPickupID(ShatterblankID))
            {
                float degrees = 0;
                for (int i = 0; i < 15; i++)
                {
                    GameObject proj             = shatterProj.gameObject;
                    bool       needsToAddBounce = false;
                    bool       isBeamInstead    = false;
                    if (user.PlayerHasActiveSynergy("Frag Mental"))
                    {
                        if (user.CurrentGun && UnityEngine.Random.value <= 0.2f)
                        {
                            if (user.CurrentGun.DefaultModule.shootStyle == ProjectileModule.ShootStyle.Charged)
                            {
                                for (int j = 0; j < user.CurrentGun.DefaultModule.chargeProjectiles.Count; j++)
                                {
                                    if (user.CurrentGun.DefaultModule.chargeProjectiles[j] != null && user.CurrentGun.DefaultModule.chargeProjectiles[j].Projectile != null)
                                    {
                                        proj = user.CurrentGun.DefaultModule.chargeProjectiles[j].Projectile.gameObject;
                                        break;
                                    }
                                }
                            }
                            else if (user.CurrentGun.DefaultModule.shootStyle == ProjectileModule.ShootStyle.Beam)
                            {
                                proj          = user.CurrentGun.DefaultModule.projectiles[0].gameObject;
                                isBeamInstead = true;
                            }
                            else
                            {
                                proj = user.CurrentGun.DefaultModule.projectiles[0].gameObject;
                            }
                            needsToAddBounce = true;
                        }
                    }
                    if (isBeamInstead)
                    {
                        BeamController beam = BeamController.FreeFireBeam(proj.GetComponent <Projectile>(), user, degrees, 3, true);
                        if (beam && beam.GetComponent <Projectile>())
                        {
                            Projectile component = beam.GetComponent <Projectile>();
                            if (user.stats.GetStatValue(PlayerStats.StatType.Damage) >= 1)
                            {
                                component.baseData.damage *= user.stats.GetStatValue(PlayerStats.StatType.Damage);
                            }
                            component.baseData.range *= user.stats.GetStatValue(PlayerStats.StatType.RangeMultiplier);
                            component.baseData.speed *= user.stats.GetStatValue(PlayerStats.StatType.ProjectileSpeed);
                            component.UpdateSpeed();
                            component.baseData.range *= 4f;
                            BounceProjModifier bounce = component.gameObject.AddComponent <BounceProjModifier>();
                            bounce.numberOfBounces += 3;
                        }
                    }
                    else
                    {
                        GameObject gameObject = SpawnManager.SpawnProjectile(proj, centerPoint, Quaternion.Euler(0, 0, degrees), true);
                        Projectile component  = gameObject.GetComponent <Projectile>();
                        if (component != null)
                        {
                            component.TreatedAsNonProjectileForChallenge = true;
                            component.Owner   = user;
                            component.Shooter = user.specRigidbody;
                            user.DoPostProcessProjectile(component);
                            if (user.stats.GetStatValue(PlayerStats.StatType.Damage) >= 1)
                            {
                                component.baseData.damage *= user.stats.GetStatValue(PlayerStats.StatType.Damage);
                            }
                            component.baseData.range *= user.stats.GetStatValue(PlayerStats.StatType.RangeMultiplier);
                            component.baseData.speed *= user.stats.GetStatValue(PlayerStats.StatType.ProjectileSpeed);
                            component.UpdateSpeed();
                            if (needsToAddBounce)
                            {
                                component.baseData.range *= 4f;
                                BounceProjModifier bounce = component.gameObject.AddComponent <BounceProjModifier>();
                                bounce.numberOfBounces += 3;
                            }
                        }
                    }
                    degrees += 24;
                }
            }
        }