Beispiel #1
0
        public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            JetwelderPlayer modPlayer = player.GetModPlayer <JetwelderPlayer>();

            if (player.altFunctionUse == 2)
            {
                clickingRight = true;
                type          = ModContent.ProjectileType <JetwelderSelector>();
            }
            return(true);
        }
Beispiel #2
0
        public override void AI()
        {
            JetwelderPlayer modPlayer = player.GetModPlayer <JetwelderPlayer>();

            projectile.velocity = Vector2.Zero;
            projectile.Center   = player.Center;
            if (Main.mouseRight)
            {
                if (scaleCounter < 1)
                {
                    scaleCounter += 0.05f;
                }

                projectile.timeLeft = 2;

                direction = player.DirectionTo(Main.MouseWorld);
                direction.Normalize();

                player.ChangeDir(Math.Sign(direction.X));

                player.itemTime     = player.itemAnimation = 2;
                player.itemRotation = direction.ToRotation();
                if (player.direction != 1)
                {
                    player.itemRotation -= 3.14f;
                }

                player.itemRotation = MathHelper.WrapAngle(player.itemRotation);

                rotation = MathHelper.WrapAngle(direction.ToRotation());

                if (Main.mouseLeft)
                {
                    projectile.active = false;
                }

                if (rotation >= PiOverFour * -3 && rotation < PiOverFour * -1 && modPlayer.scrap >= 5)
                {
                    if (crawlerScale < 1)
                    {
                        crawlerScale += 0.1f;
                    }
                    projType = ModContent.ProjectileType <JetwelderCrawler>();
                }
                else if (crawlerScale > 0)
                {
                    crawlerScale -= 0.1f;
                }

                if (rotation >= PiOverFour * -1 && rotation < PiOverFour * 1 && modPlayer.scrap >= 10)
                {
                    if (jumperScale < 1)
                    {
                        jumperScale += 0.1f;
                    }
                    projType = ModContent.ProjectileType <JetwelderJumper>();
                }
                else if (jumperScale > 0)
                {
                    jumperScale -= 0.1f;
                }

                if (rotation >= PiOverFour * 1 && rotation < PiOverFour * 3 && modPlayer.scrap >= 15)
                {
                    if (gatlerScale < 1)
                    {
                        gatlerScale += 0.1f;
                    }
                    projType = ModContent.ProjectileType <JetwelderGatler>();
                }
                else if (gatlerScale > 0)
                {
                    gatlerScale -= 0.1f;
                }

                if ((rotation >= PiOverFour * 3 || rotation < PiOverFour * -3) && modPlayer.scrap >= 20)
                {
                    if (finalScale < 1)
                    {
                        finalScale += 0.1f;
                    }
                    projType = ModContent.ProjectileType <JetwelderFinal>();
                }
                else if (finalScale > 0)
                {
                    finalScale -= 0.1f;
                }
            }
            else
            {
                projectile.active = false;

                if (projType == ModContent.ProjectileType <JetwelderCrawler>() && modPlayer.scrap >= 5)
                {
                    modPlayer.scrap -= 5;
                }
                if (projType == ModContent.ProjectileType <JetwelderJumper>() && modPlayer.scrap >= 10)
                {
                    modPlayer.scrap -= 10;
                }
                if (projType == ModContent.ProjectileType <JetwelderGatler>() && modPlayer.scrap >= 15)
                {
                    modPlayer.scrap -= 15;
                }
                if (projType == ModContent.ProjectileType <JetwelderFinal>() && modPlayer.scrap >= 20)
                {
                    modPlayer.scrap -= 20;
                }

                // modPlayer.scrap = 20;
                //Main.NewText(modPlayer.scrap.ToString(), Color.Orange);
                Vector2 position = player.Center;
                if (projType == ModContent.ProjectileType <JetwelderCrawler>() || projType == ModContent.ProjectileType <JetwelderJumper>())
                {
                    position = FindFirstTile(player.Center, projType);
                }
                if (projType == ModContent.ProjectileType <JetwelderGatler>())
                {
                    position.Y -= 10;
                }

                if (projType != -1)
                {
                    int j;
                    for (j = 0; j < 18; j++)
                    {
                        Vector2 direction = Main.rand.NextFloat(6.28f).ToRotationVector2();
                        Dust.NewDustPerfect((position + (direction * 6)) + new Vector2(0, 35), ModContent.DustType <Dusts.BuzzSpark>(), direction.RotatedBy(Main.rand.NextFloat(-0.2f, 0.2f) - 1.57f) * Main.rand.Next(2, 10), 0, new Color(255, 255, 60) * 0.8f, 1.6f);
                    }
                    for (j = 0; j < 3; j++)
                    {
                        for (int k = 1; k < 4; k++)
                        {
                            Gore.NewGore(position + Main.rand.NextVector2Circular(15, 15), Main.rand.NextVector2Circular(5, 5), ModGore.GetGoreSlot(Texture + "_Gore" + k.ToString()), 1f);
                        }
                    }
                    Projectile.NewProjectile(position, Vector2.Zero, projType, projectile.damage, projectile.knockBack, player.whoAmI);
                }
            }
        }