Ejemplo n.º 1
0
        public override void TFShoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            Vector2 spawnPosition = ShootSpawnPos(player, 26f, -6f) + new Vector2(player.direction * -12f, 0f);

            if (Collision.CanHitLine(player.MountedCenter, 0, 0, spawnPosition, 0, 0))
            {
                if (player.CountItem(item.useAmmo, 1) >= 1)
                {
                    Projectile projectile = Projectile.NewProjectileDirect(spawnPosition, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI);
                    if (critting)
                    {
                        if (projectile.modProjectile is TFProjectile TFProjectile)
                        {
                            TFProjectile.CritBoost();
                        }
                    }
                    player.ConsumeItem(item.useAmmo);
                }
            }
            else if (player.CountItem(item.useAmmo, 1) >= 1)
            {
                spawnPosition = position;

                Projectile projectile = Projectile.NewProjectileDirect(spawnPosition, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI);
                if (critting)
                {
                    if (projectile.modProjectile is TFProjectile TFProjectile)
                    {
                        TFProjectile.CritBoost();
                    }
                }
                player.ConsumeItem(item.useAmmo);
            }
        }
Ejemplo n.º 2
0
        public override void TFShoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            Vector2 spawnPosition = ShootSpawnPos(player, 36f, -2f) + new Vector2(player.direction * -4f, 0f);

            if (Collision.CanHitLine(player.MountedCenter, 0, 0, spawnPosition, 0, 0))
            {
                if (player.CountItem(item.useAmmo, 1) >= 1)
                {
                    float projectiles = 10;
                    float rotation    = 1f;
                    spawnPosition += Vector2.Normalize(new Vector2(speedX, speedY)) * rotation;
                    rotation       = MathHelper.ToRadians(rotation);
                    for (int i = 0; i < projectiles; i++)
                    {
                        Vector2    perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (projectiles - 1)));
                        Projectile projectile     = Projectile.NewProjectileDirect(spawnPosition, perturbedSpeed, type, (int)((damage * 1.5f) / projectiles), knockBack, player.whoAmI); if (critting)
                        {
                            if (critting)
                            {
                                if (projectile.modProjectile is TFProjectile TFProjectile)
                                {
                                    TFProjectile.CritBoost();
                                }
                            }
                        }
                    }
                    player.ConsumeItem(item.useAmmo);
                }
            }
            else if (player.CountItem(item.useAmmo, 1) >= 1)
            {
                spawnPosition = position;

                float projectiles = 10;
                float rotation    = 1f;
                spawnPosition += Vector2.Normalize(new Vector2(speedX, speedY)) * rotation;
                rotation       = MathHelper.ToRadians(rotation);
                for (int i = 0; i < projectiles; i++)
                {
                    Vector2    perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (projectiles - 1)));
                    Projectile projectile     = Projectile.NewProjectileDirect(spawnPosition, perturbedSpeed, ModContent.ProjectileType <TFBullet>(), (int)((damage * 1.5f) / projectiles), knockBack, player.whoAmI);
                    if (critting)
                    {
                        if (projectile.modProjectile is TFProjectile TFProjectile)
                        {
                            TFProjectile.CritBoost();
                        }
                    }
                }
                player.ConsumeItem(item.useAmmo);
            }
        }
Ejemplo n.º 3
0
        public override void TFShoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            Vector2 speed = new Vector2(speedX, speedY);

            if (fullyRevved)
            {
                Vector2 spawnPosition = ShootSpawnPos(player, 34f, 0f) + new Vector2(player.direction * -4f, 0f);
                if (Collision.CanHitLine(player.MountedCenter, 0, 0, spawnPosition, 0, 0))
                {
                    if (player.CountItem(item.useAmmo, 1) >= 1)
                    {
                        float projectiles = 4;
                        float rotation    = 35f;
                        rotation = MathHelper.ToRadians(rotation);
                        for (int i = 0; i < projectiles; i++)
                        {
                            Vector2    perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (projectiles - 1)));
                            Projectile projectile     = Projectile.NewProjectileDirect(spawnPosition + perturbedSpeed, speed, type, (int)((damage * 1.5f) / projectiles), knockBack, player.whoAmI);
                            if (critting)
                            {
                                if (projectile.modProjectile is TFProjectile TFProjectile)
                                {
                                    TFProjectile.CritBoost();
                                    TFProjectile.critDamageMultiplier = 2f;
                                }
                            }
                        }
                        player.ConsumeItem(item.useAmmo);
                    }
                }
                else if (player.CountItem(item.useAmmo, 1) >= 1)
                {
                    spawnPosition = position;

                    float projectiles = 4;
                    for (int i = 0; i < projectiles; i++)
                    {
                        Projectile projectile = Projectile.NewProjectileDirect(spawnPosition, speed, type, (int)((damage * 1.5f) / projectiles), knockBack, player.whoAmI);
                        if (critting)
                        {
                            if (projectile.modProjectile is TFProjectile TFProjectile)
                            {
                                TFProjectile.CritBoost();
                                TFProjectile.critDamageMultiplier = 2f;
                            }
                        }
                    }
                    player.ConsumeItem(item.useAmmo);
                }
            }
        }
Ejemplo n.º 4
0
        public override void TFShoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            if (player == Main.player[Main.myPlayer])
            {
                Vector2 spawnPosition = ShootSpawnPos(player, 23f, -5f);
                if (player.altFunctionUse != 2)
                {
                    if (Collision.CanHitLine(player.MountedCenter, 0, 0, spawnPosition, 0, 0))
                    {
                        if (player.CountItem(item.useAmmo, 1) >= 1)
                        {
                            Projectile projectile = Projectile.NewProjectileDirect(spawnPosition, new Vector2(speedX, speedY), type, (int)(damage * 1.2f), knockBack, player.whoAmI);
                            if (projectile.modProjectile is StickybombLauncherStickybomb stickyBomb)
                            {
                                stickyBomb.armingTimer     = 42;
                                stickyBomb.detonationTimer = 12;
                            }
                            if (critting)
                            {
                                if (projectile.modProjectile is TFProjectile TFProjectile)
                                {
                                    TFProjectile.CritBoost();
                                }
                            }
                            player.ConsumeItem(item.useAmmo);
                        }
                    }
                    else if (player.CountItem(item.useAmmo, 1) >= 1)
                    {
                        spawnPosition = position;

                        Projectile projectile = Projectile.NewProjectileDirect(spawnPosition, new Vector2(speedX, speedY), type, (int)(damage * 1.2f), knockBack, player.whoAmI);
                        if (projectile.modProjectile is StickybombLauncherStickybomb stickyBomb)
                        {
                            stickyBomb.detonationTimer = 42;
                            stickyBomb.detonationTimer = 12;
                        }
                        if (critting)
                        {
                            if (projectile.modProjectile is TFProjectile TFProjectile)
                            {
                                TFProjectile.CritBoost();
                            }
                        }
                        player.ConsumeItem(item.useAmmo);
                    }
                }
            }
        }