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

            if (ModSabres.AINormalSlash(projectile, SlashLogic))
            {
                Lighting.AddLight(projectile.Center, SabreColour() / 2f);
            }
            else
            {
                // Charged attack
                projectile.width = 164;
                ModSabres.AISetChargeSlashVariables(player, chargeSlashDirection);
                ModSabres.NormalSlash(projectile, player);

                // Play charged sound
                if (sndOnce)
                {
                    Main.PlaySound(SoundID.Item60, projectile.Center); sndOnce = false;
                }

                Lighting.AddLight(projectile.Center, SabreColour());
            }
            projectile.damage = 0;
            FrameCheck       += 0.75f; // Framerate
        }
Ejemplo n.º 2
0
        public override void AI()
        {
            Player player = Main.player[projectile.owner];

            if (ModSabres.AINormalSlash(projectile, SlashLogic))
            {
            }
            else
            {
                // Charged attack
                ModSabres.AISetChargeSlashVariables(player, chargeSlashDirection);
                ModSabres.NormalSlash(projectile, player);

                // Play charged sound
                if (sndOnce)
                {
                    Main.PlaySound(SoundID.Item5.WithVolume(0.5f), projectile.Center); sndOnce = false;
                    preDashVelocity = player.velocity; // Save velocity before dash
                }
            }

            if (SlashLogic == 0)
            {
                float dashFrameDuration = 3;
                float dashSpeed         = player.maxRunSpeed * 4f;
                int   freezeFrame       = 2;
                ModSabres.AIDashSlash(player, projectile, dashFrameDuration, dashSpeed, freezeFrame, ref preDashVelocity);
            }

            projectile.damage = 0;
            projectile.ai[0] += 1f; // Framerate
        }
Ejemplo n.º 3
0
        public override void AI()
        {
            Player player = Main.player[projectile.owner];

            if (ModSabres.AINormalSlash(projectile, SlashLogic))
            {
            }
            else
            {
                // Charged attack
                ModSabres.AISetChargeSlashVariables(player, chargeSlashDirection);
                ModSabres.NormalSlash(projectile, player);
            }
            projectile.damage = 0;
            projectile.ai[0] += 1f; // Framerate
        }
Ejemplo n.º 4
0
        public override void AI()
        {
            Player player = Main.player[projectile.owner];

            if (ModSabres.AINormalSlash(projectile, SlashLogic))
            {
            }
            else
            {
                // Charged attack
                ModSabres.AISetChargeSlashVariables(player, chargeSlashDirection);
                ModSabres.NormalSlash(projectile, player);

                // Play charged sound
                if (sndOnce)
                {
                    Main.PlaySound(SoundID.Item5.WithVolume(0.5f), projectile.Center); sndOnce = false;
                }
            }
            projectile.damage = 0;
            projectile.ai[0] += 1f; // Framerate
        }
Ejemplo n.º 5
0
        public override void AI()
        {
            Player player = Main.player[projectile.owner];

            if (ModSabres.AINormalSlash(projectile, SlashLogic))
            {
                FrameCheck += 1f;
            }
            else
            {
                // Charged attack
                projectile.height = 228;
                projectile.width  = 140;
                ModSabres.AISetChargeSlashVariables(player, chargeSlashDirection);
                ModSabres.NormalSlash(projectile, player);

                // Play charged sound
                if (sndOnce)
                {
                    Main.PlaySound(SoundID.Item71, projectile.Center); sndOnce = false;
                }

                float pow = (specialProjFrames - SlashLogic) / 16f;
                Lighting.AddLight(new Vector2(projectile.Center.X + 70, projectile.Center.Y),
                                  new Vector3(pow, pow * 0.2f, pow * 0.8f));
                Lighting.AddLight(new Vector2(projectile.Center.X - 70, projectile.Center.Y),
                                  new Vector3(pow, pow * 0.2f, pow * 0.8f));
                Lighting.AddLight(new Vector2(projectile.Center.X, projectile.Center.Y + 70),
                                  new Vector3(pow, pow * 0.2f, pow * 0.8f));
                Lighting.AddLight(new Vector2(projectile.Center.X, projectile.Center.Y - 70),
                                  new Vector3(pow, pow * 0.2f, pow * 0.8f));

                FrameCheck += 0.5f;
            }
            projectile.damage = 0;
        }
Ejemplo n.º 6
0
        public override void AI()
        {
            Player player = Main.player[projectile.owner];

            if (ModSabres.AINormalSlash(projectile, SlashLogic))
            {
            }
            else
            {
                // Charged attack
                ModSabres.AISetChargeSlashVariables(player, chargeSlashDirection);
                ModSabres.NormalSlash(projectile, player);

                // Play charged sound
                if (sndOnce)
                {
                    Main.PlaySound(2, player.Center, 28); sndOnce = false;
                    preDashVelocity = null; // Save velocity before dash
                }
            }

            if (SlashLogic == 0)
            {
                float dashFrameDuration = 6;
                float dashSpeed         = 32f;
                int   freezeFrame       = 2;
                bool  dashing           = ModSabres.AIDashSlash(player, projectile, dashFrameDuration, dashSpeed, freezeFrame, ref preDashVelocity);

                if (dashing)
                {
                    Dust.NewDust(player.Center - new Vector2(6, 6), 4, 4, 20);

                    // Coloured line trail
                    Vector2 dashStep = player.position - player.oldPosition;
                    for (int i = 0; i < 8; i++)
                    {
                        Dust d = Main.dust[Dust.NewDust(player.Center - (dashStep / 8) * i,
                                                        0, 0, 181, dashStep.X / 32, dashStep.Y / 32, 0, default(Color), 1.3f)];
                        d.noGravity = true;
                        d.velocity *= 0.1f;
                    }
                }

                // Calculate ending position dust
                if (firstFrame)
                {
                    firstFrame = false;

                    Vector2 endPosition = player.position;
                    Vector2 dashVector  = projectile.velocity * dashSpeed;
                    for (int i = 0; i < dashFrameDuration * 2; i++)
                    {
                        Vector2 move = Collision.TileCollision(
                            endPosition, dashVector / 2,
                            player.width, player.height,
                            false, false, (int)player.gravDir);
                        if (move == Vector2.Zero)
                        {
                            break;
                        }
                        endPosition += move;
                    }

                    // dash dust from the total distance over the duration
                    Vector2 totalDistanceStep =
                        (endPosition + new Vector2(player.width / 2, player.height / 2)
                         - player.Center) / dashFrameDuration;
                    for (int i = 0; i < dashFrameDuration; i++)
                    {
                        Vector2 pos = player.Center + (totalDistanceStep * i) - new Vector2(4, 4);
                        for (int j = 0; j < 5; j++)
                        {
                            pos += totalDistanceStep * (j / 5f);
                            Dust d = Main.dust[Dust.NewDust(pos, 0, 0,
                                                            175, projectile.velocity.X, projectile.velocity.Y,
                                                            0, Color.White, 1f)];
                            d.noGravity = true;
                            d.velocity *= 0.05f;
                        }
                    }
                }
            }

            projectile.damage = 0;
            FrameCheck       += 1f; // Framerate
        }
Ejemplo n.º 7
0
        public override void AI()
        {
            Player player = Main.player[projectile.owner];

            if (ModSabres.AINormalSlash(projectile, SlashLogic))
            {
                FrameCheck += 1f;
                targets     = null;
            }
            else
            {
                // Charged attack
                ModSabres.AISetChargeSlashVariables(player, chargeSlashDirection);
                ModSabres.NormalSlash(projectile, player);

                // Play charged sound & set targets
                if (sndOnce)
                {
                    Vector2 mouse;
                    if (Main.myPlayer == player.whoAmI)
                    {
                        mouse = new Vector2(Main.screenPosition.X + Main.mouseX, Main.screenPosition.Y + Main.mouseY);
                    }
                    else
                    {
                        mouse = player.Center + new Vector2(player.direction * 256);
                    }                                                                // an estimation
                    targets = RaidenUtils.GetTargettableNPCs(player.Center, mouse, RaidenUtils.GetFocusRadius(player), RaidenUtils.focusTargets);
                    if (targets.Count > 0)
                    {
                        Main.PlaySound(SoundID.Item71, projectile.Center); sndOnce = false;


                        // Set up initial ending position as where we started
                        if (player.whoAmI == Main.myPlayer)
                        {
                            endingPositionCenter = player.Center;
                        }

                        // Set ending slash direction
                        if (targets.Last().Center.X > player.Center.X)
                        {
                            player.direction = 1;
                        }
                        else
                        {
                            player.direction = -1;
                        }
                    }
                }

                if (targets != null && targets.Count > 0)
                {
                    ChargeSlashAI(player);
                }
                else
                {
                    SlashLogic = 1;
                    ModSabres.AINormalSlash(projectile, SlashLogic);
                    FrameCheck += 1f;
                    targets     = null;
                }
            }
            projectile.damage = 0;
        }