Ejemplo n.º 1
0
        public override void Kill(int timeLeft)
        {
            Player player = Main.player[projectile.owner];

            SoundUtil.PlayCustomSound("Sounds/Awakening", player, 1.5f);
            Projectile.NewProjectile(player.Center.X - 40, player.Center.Y + 90, 0, 0, mod.ProjectileType("SSJ1AuraProjStart"), 0, 0, player.whoAmI);
        }
Ejemplo n.º 2
0
        public override void Kill(int timeLeft)
        {
            Player player = Main.player[projectile.owner];

            Transformations.DoTransform(player, Transformations.SSJG, DBZMOD.instance, false);
            MyPlayer.ModPlayer(player).IsTransforming = false;
            SoundUtil.PlayCustomSound("Sounds/SSJAscension");
        }
Ejemplo n.º 3
0
        public override void Kill(int timeLeft)
        {
            int maxdusts = 20;

            SoundUtil.PlayCustomSound("Sounds/GroundRumble", projectile.Center);
            for (int i = 0; i < maxdusts; i++)
            {
                int num304 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 20, 0f, 0f, 100, default(Color), 0.8f);
                Main.dust[num304].noGravity = true;
                Main.dust[num304].velocity *= 1.2f;
                Main.dust[num304].velocity -= projectile.oldVelocity * 0.3f;
            }
        }
Ejemplo n.º 4
0
        public override void AI()
        {
            if (!player.channel || (ChargeLevel >= ChargeLimit))
            {
                if (ChargeLevel >= 1)
                {
                    float rot = (float)Math.Atan2((Main.mouseY + Main.screenPosition.Y) - projectile.Center.Y, (Main.mouseX + Main.screenPosition.X) - projectile.Center.X);
                    Projectile.NewProjectileDirect(new Vector2(projectile.Center.X, projectile.Center.Y), new Vector2((float)((Math.Cos(rot) * 15)), (float)((Math.Sin(rot) * 15))), mod.ProjectileType("BigBangKamehamehaBlast"), projectile.damage + (ChargeLevel * 65), projectile.knockBack, projectile.owner);

                    //ChargeLevel = 0;
                    SoundUtil.PlayCustomSound("Sounds/BasicBeamFire", projectile.Center);

                    projectile.Kill();

                    for (int i = 0; i < 100; i++)
                    {
                        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 + 3.0f * projectile.scale)), projectile.width, projectile.height, DustType, 0f, 0f, 213, default(Color), 3.0f);
                        tDust.velocity  = -0.5f * Vector2.Normalize((projectile.position + (projectile.Size / 2)) - tDust.position) * 2;
                        tDust.noGravity = true;
                    }
                }
                chargeSoundSlotId = SoundUtil.KillTrackedSound(chargeSoundSlotId);
            }

            if (!startingCharge)
            {
                startingCharge = true;
                if (!Main.dedServ)
                {
                    chargeSoundSlotId = SoundUtil.PlayCustomSound("Sounds/EnergyWaveCharge", projectile.Center);
                }
            }

            SoundUtil.UpdateTrackedSound(chargeSoundSlotId, projectile.Center);
        }
Ejemplo n.º 5
0
        public override void AI()
        {
            Player player = Main.player[projectile.owner];

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

            // cancel channeling if the projectile is maxed
            if (player.channel && projectile.scale > 2.5)
            {
                player.channel = false;
            }

            if (player.channel && HeldTime > 0)
            {
                projectile.scale = BASE_SCALE + SCALE_INCREASE * HeldTime;
                Vector2 projectileOffset = new Vector2(-projectile.width * 0.5f, -projectile.height * 0.5f);
                projectileOffset   += new Vector2(0, -(80 + projectile.scale * 115f));
                projectile.position = player.Center + projectileOffset;
                HeldTime++;

                projectile.netUpdate = true;

                //Rock effect
                projectile.ai[1]++;
                if (projectile.ai[1] % 7 == 0)
                {
                    Projectile.NewProjectile(projectile.Center.X + Main.rand.NextFloat(-500, 600), projectile.Center.Y + 1000, 0, -10, mod.ProjectileType("StoneBlockDestruction"), projectile.damage, 0f, projectile.owner);
                }
                Projectile.NewProjectile(projectile.Center.X + Main.rand.NextFloat(-500, 600), projectile.Center.Y + 1000, 0, -10, mod.ProjectileType("DirtBlockDestruction"), projectile.damage, 0f, projectile.owner);

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

                projectile.netUpdate2 = true;

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

                // depleted check, release the ball
                if (MyPlayer.ModPlayer(player).IsKiDepleted())
                {
                    player.channel = false;
                }
                int soundtimer = 0;
                soundtimer++;
                if (soundtimer > 120)
                {
                    SoundUtil.PlayCustomSound("Sounds/SuperNovaCharge", player, 0.6f);
                    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) * 6;
                projectile.tileCollide = false;
                projectile.damage     *= (int)Math.Ceiling(projectile.scale * 3f);
                SoundUtil.PlayCustomSound("Sounds/SuperNovaThrow", player, 0.6f);
            }
        }
Ejemplo n.º 6
0
        public void HandleChargingKi(Player player)
        {
            bool IsCharging = false;

            FinalChargeLimit = ChargeLimit + MyPlayer.ModPlayer(player).ChargeLimitAdd;

            // stop channeling if the player is out of ki
            if (MyPlayer.ModPlayer(player).IsKiDepleted())
            {
                player.channel = false;
            }

            // keep alive routine.
            if (projectile.timeLeft < 4)
            {
                projectile.timeLeft = 10;
            }

            MyPlayer modPlayer = MyPlayer.ModPlayer(player);

            // The energy in the projectile decays if the player stops channeling.
            if (!player.channel && !modPlayer.IsMouseRightHeld && !IsSustainingFire)
            {
                // kill the tracked charge sound if the player let go, immediately
                ChargeSoundSlotId = SoundUtil.KillTrackedSound(ChargeSoundSlotId);

                if (ChargeLevel > 0f)
                {
                    ChargeLevel = Math.Max(0, ChargeLevel - DecayRate());

                    // don't draw the ball when firing.
                    if (!IsSustainingFire)
                    {
                        ProjectileUtil.DoChargeDust(GetChargeBallPosition(), DustType, DecayDustFrequency, true, ChargeSize.ToVector2());
                    }
                }
                else
                {
                    // the charge level zeroed out, kill the projectile.
                    projectile.Kill();
                }
            }

            // charge the ball if the proper keys are held.
            // increment the charge timer if channeling and apply slowdown effect
            if (player.channel && projectile.active && modPlayer.IsMouseRightHeld && !IsSustainingFire)
            {
                // the player can hold the charge all they like once it's fully charged up. Currently this doesn't incur a movespeed debuff either.
                if (ChargeLevel < FinalChargeLimit && !modPlayer.IsKiDepleted())
                {
                    IsCharging = true;

                    // drain ki from the player when charging
                    if (DBZMOD.IsTickRateElapsed(CHARGE_KI_DRAIN_WINDOW))
                    {
                        MyPlayer.ModPlayer(player).AddKi(-ChargeKiDrainRate(), true, false);
                    }

                    // increase the charge
                    ChargeLevel = Math.Min(FinalChargeLimit, ChargeRate() + ChargeLevel);

                    // slow down the player while charging.
                    ProjectileUtil.ApplyChannelingSlowdown(player);

                    // shoot some dust into the ball to show it's charging, and to look cool.
                    if (!IsSustainingFire)
                    {
                        ProjectileUtil.DoChargeDust(GetChargeBallPosition(), DustType, ChargeDustFrequency, false, ChargeSize.ToVector2());
                    }
                }
            }

            // play the sound if the player just started charging and the audio is "off cooldown"
            if (!WasCharging && IsCharging && ChargeSoundCooldown == 0f)
            {
                if (!Main.dedServ)
                {
                    ChargeSoundSlotId = SoundUtil.PlayCustomSound(ChargeSoundKey, projectile.Center);
                }
                ChargeSoundCooldown = ChargeSoundDelay;
            }
            else
            {
                ChargeSoundCooldown = Math.Max(0f, ChargeSoundCooldown - 1);
            }

            // set the wasCharging flag for proper tracking
            WasCharging = IsCharging;
        }
Ejemplo n.º 7
0
        // The AI of the projectile
        public override void AI()
        {
            Player player = Main.player[projectile.owner];

            ProcessKillRoutine(player);

            // stationary beams are instantaneously "detached", they behave weirdly.
            if (IsStationaryBeam && !IsDetached)
            {
                DetachmentTimer = 1;
            }

            // capture the current mouse vector, we're going to normalize movement prior to updating the charge ball location.
            if (projectile.owner == Main.myPlayer)
            {
                Vector2 mouseVector = Main.MouseWorld;

                if (OriginalMouseVector == Vector2.Zero)
                {
                    OriginalMouseVector = mouseVector;
                }

                if (IsStationaryBeam && OriginalMouseVector != Vector2.Zero)
                {
                    mouseVector = OriginalMouseVector;
                }

                Vector2 screenPosition = Main.screenPosition;

                if (OriginalScreenPosition == Vector2.Zero)
                {
                    OriginalScreenPosition = screenPosition;
                }

                if (IsStationaryBeam && OriginalScreenPosition != Vector2.Zero)
                {
                    screenPosition = OriginalScreenPosition;
                }

                if (OldMouseVector != Vector2.Zero && !IsStationaryBeam)
                {
                    Vector2 mouseMovementVector = (mouseVector - OldMouseVector) / RotationSlowness;
                    Vector2 screenChange        = screenPosition - OldScreenPosition;
                    mouseVector = OldMouseVector + mouseMovementVector + screenChange;
                }

                UpdateBeamTailLocationAndDirection(player, mouseVector);

                OldMouseVector = mouseVector;

                OldScreenPosition = screenPosition;
            }

            UpdateBeamPlayerItemUse(player);

            // handle whether the beam should be visible, and how visible.
            HandleBeamVisibility();

            // handle the distance routine
            // the difference between distance and tracked distance is that distance is the actual travel.
            // tracked distance is with collision, and resets distance if it's too high.
            Distance += BeamSpeed;
            float TrackedDistance;

            for (TrackedDistance = 0f; TrackedDistance <= MaxBeamDistance; TrackedDistance += BEAM_TILE_DISTANCE_GRADIENT)
            {
                Vector2 origin = TailPositionStart() + projectile.velocity * (TrackedDistance + HeadSize.Y - StepLength());

                if (!ProjectileUtil.CanHitLine(TailPositionStart(), origin))
                {
                    // changed to a while loop at a much finer gradient to smooth out beam transitions. Experimental.
                    TrackedDistance -= BEAM_TILE_DISTANCE_GRADIENT;
                    if (TrackedDistance <= 0)
                    {
                        TrackedDistance = 0;
                    }
                    break;
                }
            }

            // handle animation frames on animated beams
            if (IsBeamSegmentAnimated)
            {
                BeamSegmentAnimation += 8;
                if (BeamSegmentAnimation >= StepLength())
                {
                    BeamSegmentAnimation = 0;
                }
            }

            // if distance is about to be throttled, we're hitting something. Spawn some dust.
            if (Distance >= TrackedDistance)
            {
                var dustVector = TailPositionStart() + (TrackedDistance + HeadSize.Y - StepLength()) * projectile.velocity;
                ProjectileUtil.DoBeamCollisionDust(DustType, CollisionDustFrequency, projectile.velocity, dustVector);
            }

            // throttle distance by collision
            Distance = Math.Min(TrackedDistance, Distance);

            // shoot sweet sweet particles
            for (var i = 0; i < FireParticleDensity; i++)
            {
                ProjectileUtil.DoBeamDust(projectile.position, projectile.velocity, DustType, DustFrequency, Distance, TailHeldDistance, TailSize.ToVector2(), BeamSpeed);
            }

            // Handle the audio playing, note this positionally tracks at the head position end for effect.
            if (JustFired)
            {
                BeamSoundSlotId = SoundUtil.PlayCustomSound(BeamSoundKey, HeadPositionEnd());
            }

            JustFired = false;

            // Update tracked audio
            SoundUtil.UpdateTrackedSound(BeamSoundSlotId, HeadPositionEnd());

            //Add lights
            DelegateMethods.v3_1 = new Vector3(0.8f, 0.8f, 1f);
            Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * (Distance - TailHeldDistance), BeamSize.Y, DelegateMethods.CastLight);
        }
Ejemplo n.º 8
0
        public override void Kill(int timeLeft)
        {
            if (!projectile.active)
            {
                return;
            }
            projectile.tileCollide = false;
            projectile.ai[1]       = 0f;
            projectile.alpha       = 255;

            projectile.position.X = projectile.position.X + (float)(projectile.width / 2);
            projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2);
            projectile.width      = 22;
            projectile.height     = 22;
            projectile.position.X = projectile.position.X - (float)(projectile.width / 2);
            projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2);
            projectile.knockBack  = 8f;
            projectile.Damage();

            Main.projectileIdentity[projectile.owner, projectile.identity] = -1;
            int num = projectile.timeLeft;

            projectile.timeLeft = 0;

            SoundUtil.PlayCustomSound("Sounds/Explosion", projectile.Center, .3f);

            projectile.position.X = projectile.position.X + (float)(projectile.width / 2);
            projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2);
            projectile.width      = 22;
            projectile.height     = 22;
            projectile.position.X = projectile.position.X - (float)(projectile.width / 2);
            projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2);
            for (int num615 = 0; num615 < 30; num615++)
            {
                int num616 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default(Color), 1.5f);
                Main.dust[num616].velocity *= 1.4f;
            }
            for (int num617 = 0; num617 < 20; num617++)
            {
                int num618 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 3.5f);
                Main.dust[num618].noGravity = true;
                Main.dust[num618].velocity *= 7f;
                num618 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 1.5f);
                Main.dust[num618].velocity *= 3f;
            }
            for (int num619 = 0; num619 < 2; num619++)
            {
                float scaleFactor9 = 3f;
                if (num619 == 1)
                {
                    scaleFactor9 = 3f;
                }
                int num620 = Gore.NewGore(new Vector2(projectile.position.X, projectile.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f);
                Main.gore[num620].velocity *= scaleFactor9;
                Gore gore97 = Main.gore[num620];
                gore97.velocity.X = gore97.velocity.X + 1f;
                Gore gore98 = Main.gore[num620];
                gore98.velocity.Y           = gore98.velocity.Y + 1f;
                num620                      = Gore.NewGore(new Vector2(projectile.position.X, projectile.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f);
                Main.gore[num620].velocity *= scaleFactor9;
                Gore gore99 = Main.gore[num620];
                gore99.velocity.X = gore99.velocity.X - 1f;
                Gore gore100 = Main.gore[num620];
                gore100.velocity.Y          = gore100.velocity.Y + 1f;
                num620                      = Gore.NewGore(new Vector2(projectile.position.X, projectile.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f);
                Main.gore[num620].velocity *= scaleFactor9;
                Gore gore101 = Main.gore[num620];
                gore101.velocity.X = gore101.velocity.X + 1f;
                Gore gore102 = Main.gore[num620];
                gore102.velocity.Y          = gore102.velocity.Y - 1f;
                num620                      = Gore.NewGore(new Vector2(projectile.position.X, projectile.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f);
                Main.gore[num620].velocity *= scaleFactor9;
                Gore gore103 = Main.gore[num620];
                gore103.velocity.X = gore103.velocity.X - 1f;
                Gore gore104 = Main.gore[num620];
                gore104.velocity.Y = gore104.velocity.Y - 1f;
            }
            projectile.active = false;
        }
Ejemplo n.º 9
0
        private void GrantWish(UIMouseEvent evt, UIElement listeningelement)
        {
            Player   player    = Main.LocalPlayer;
            MyPlayer modplayer = Main.LocalPlayer.GetModPlayer <MyPlayer>();
            bool     UsedWish  = false;

            switch (WishSelection)
            {
            case WishSelectionID.Power:
                if (modplayer.PowerWishesLeft > 0)
                {
                    UsedWish = true;
                    DoPowerWish();
                    SoundUtil.PlayCustomSound("Sounds/WishGranted", player.Center);
                }
                else
                {
                    Main.PlaySound(SoundID.MenuClose);
                }
                break;

            case WishSelectionID.Wealth:
                UsedWish = true;
                DoWealthWish();
                SoundUtil.PlayCustomSound("Sounds/WishGranted", player.Center);
                break;

            case WishSelectionID.Immortality:
                if (modplayer.ImmortalityWishesLeft > 0)
                {
                    UsedWish = true;
                    DoImmortalityWish();
                    SoundUtil.PlayCustomSound("Sounds/WishGranted", player.Center);
                }
                else
                {
                    Main.PlaySound(SoundID.MenuClose);
                }
                break;

            case WishSelectionID.Genetic:
                UsedWish = true;
                DoGeneticWish();
                SoundUtil.PlayCustomSound("Sounds/WishGranted", player.Center);
                break;

            case WishSelectionID.Awakening:
                if (modplayer.AwakeningWishesLeft > 0)
                {
                    UsedWish = true;
                    DoAwakeningWish();
                    SoundUtil.PlayCustomSound("Sounds/WishGranted", player.Center);
                }
                else
                {
                    Main.PlaySound(SoundID.MenuClose);
                }
                break;

            default:
                break;
            }

            if (UsedWish)
            {
                DebugUtil.Log("Wish has been used.");
                WishSelection = WishSelectionID.None;
                DBZWorld.DestroyAndRespawnDragonBalls();
                modplayer.WishActive = false;
                Main.PlaySound(SoundID.MenuClose);
            }

            Initialize();
            DBZMOD.ActivateWishmenu();
        }
Ejemplo n.º 10
0
        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);
            }
        }
Ejemplo n.º 11
0
 public void InitializeVanishState()
 {
     isInitialized = true;
     SoundUtil.PlayCustomSound("Sounds/Transmission", projectile.Center, .7f, .2f);
 }
Ejemplo n.º 12
0
        public override void Kill(int timeLeft)
        {
            Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y - 0, 0, 0, mod.ProjectileType("SuperEnergyBarrageExplosion"), projectile.damage, 4f, projectile.owner, 0, projectile.rotation);

            SoundUtil.PlayCustomSound("Sounds/Kiplosion", projectile.position, 1.0f);
        }