Ejemplo n.º 1
0
        public override void AI()
        {
            Player   player    = Main.player[projectile.owner];
            MyPlayer modPlayer = player.GetModPlayer <MyPlayer>();

            if (!_isInitialized)
            {
                modPlayer.isMassiveBlastCharging = true;
                //modPlayer.isMassiveBlastInUse = true;
                HeldTime       = 1;
                _isInitialized = true;
            }

            if (player.channel && modPlayer.isMassiveBlastCharging)
            {
                projectile.scale    = BASE_SCALE + SCALE_INCREASE * (HeldTime / 3f);
                projectile.position = player.Center + new Vector2(0, -40 - (projectile.scale * 17));
                HeldTime++;

                // reduced from 25.
                for (int d = 0; d < 15; d++)
                {
                    // loop hitch for variance.
                    if (Main.rand.NextFloat() < 0.3f)
                    {
                        continue;
                    }

                    float   angle    = Main.rand.NextFloat(360);
                    float   angleRad = MathHelper.ToRadians(angle);
                    Vector2 position = new Vector2((float)Math.Cos(angleRad), (float)Math.Sin(angleRad));

                    Dust tDust = Dust.NewDustDirect(projectile.position + (position * (20 + 12.5f * projectile.scale)), projectile.width, projectile.height, 230, 0f, 0f, 213, default(Color), 2.0f);
                    tDust.velocity  = Vector2.Normalize((projectile.position + (projectile.Size / 2)) - tDust.position) * 2;
                    tDust.noGravity = true;
                }

                //Rock effect
                if (DBZMOD.IsTickRateElapsed(10) && _rocksFloating < MAX_ROCKS)
                {
                    // only some of the time, keeps it a little more varied.
                    if (Main.rand.NextFloat() < 0.6f)
                    {
                        _rocksFloating++;
                        BaseFloatingDestructionProj.SpawnNewFloatingRock(player, projectile);
                    }
                }

                if (projectile.timeLeft < 399)
                {
                    projectile.timeLeft = 400;
                }

                MyPlayer.ModPlayer(player).AddKi(-5, true, false);
                player.ApplyChannelingSlowdown();

                // depleted check, release the ball
                if (MyPlayer.ModPlayer(player).IsKiDepleted())
                {
                    player.channel = false;
                }
                if (_soundtimer == 0)
                {
                    _soundInfo = SoundHelper.PlayCustomSound("Sounds/SpiritBombCharge", player, 0.5f);
                }
                _soundtimer++;
                if (_soundtimer > 120)
                {
                    _soundtimer = 0;
                }
            }
            else if (modPlayer.isMassiveBlastCharging)
            {
                modPlayer.isMassiveBlastCharging = false;
                float projectileWidthFactor = projectile.width * projectile.scale / TRAVEL_SPEED_COEFFICIENT;
                projectile.timeLeft    = (int)Math.Ceiling(projectileWidthFactor) + 180;
                projectile.velocity    = Vector2.Normalize(Main.MouseWorld - player.Center) * TRAVEL_SPEED_COEFFICIENT;
                projectile.tileCollide = false;
                projectile.damage     *= (int)projectile.scale / 2;
                _soundInfo             = SoundHelper.KillTrackedSound(_soundInfo);
                SoundHelper.PlayCustomSound("Sounds/SpiritBombFire", player);
            }
            projectile.netUpdate  = true;
            projectile.netUpdate2 = true;
        }
        public override void AI()
        {
            Player player = Main.player[projectile.owner];

            if (!isInitialized)
            {
                HeldTime      = 1;
                isInitialized = true;
            }

            if (player.channel && HeldTime > 0)
            {
                projectile.scale    = BASE_SCALE + SCALE_INCREASE * HeldTime;
                projectile.position = player.Center + new Vector2(0, -40 - (projectile.scale * 17));
                HeldTime++;

                // reduced from 25.
                for (int d = 0; d < 15; d++)
                {
                    // loop hitch for variance.
                    if (Main.rand.NextFloat() < 0.3f)
                    {
                        continue;
                    }

                    float   angle    = Main.rand.NextFloat(360);
                    float   angleRad = MathHelper.ToRadians(angle);
                    Vector2 position = new Vector2((float)Math.Cos(angleRad), (float)Math.Sin(angleRad));

                    Dust tDust = Dust.NewDustDirect(projectile.position + (position * (20 + 12.5f * projectile.scale)), projectile.width, projectile.height, 230, 0f, 0f, 213, default(Color), 2.0f);
                    tDust.velocity  = Vector2.Normalize((projectile.position + (projectile.Size / 2)) - tDust.position) * 2;
                    tDust.noGravity = true;
                }

                //Rock effect
                if (DBZMOD.IsTickRateElapsed(10) && rocksFloating < MAX_ROCKS)
                {
                    // only some of the time, keeps it a little more varied.
                    if (Main.rand.NextFloat() < 0.6f)
                    {
                        rocksFloating++;
                        BaseFloatingDestructionProj.SpawnNewFloatingRock(player, projectile);
                    }
                }

                projectile.netUpdate = true;

                if (projectile.timeLeft < 399)
                {
                    projectile.timeLeft = 400;
                }

                MyPlayer.ModPlayer(player).AddKi(-5, true, false);
                ProjectileUtil.ApplyChannelingSlowdown(player);

                projectile.netUpdate2 = true;

                // depleted check, release the ball
                if (MyPlayer.ModPlayer(player).IsKiDepleted())
                {
                    player.channel = false;
                }
                int soundtimer = 0;
                soundtimer++;
                if (soundtimer > 120)
                {
                    SoundUtil.PlayCustomSound("Sounds/SpiritBombCharge", player, 0.5f);
                    soundtimer = 0;
                }
            }
            else if (HeldTime > 0)
            {
                HeldTime               = 0;
                projectile.timeLeft    = (int)Math.Ceiling(projectile.scale * 15) + 600;
                projectile.velocity    = Vector2.Normalize(Main.MouseWorld - player.Center) * 2.8f;
                projectile.tileCollide = false;
                projectile.damage     *= (int)projectile.scale / 2;
                SoundUtil.PlayCustomSound("Sounds/SpiritBombFire", player);
            }
        }