diff --git a/Items/Weapons/Ranged/Deathwind.cs b/Items/Weapons/Ranged/Deathwind.cs index 9632dcfee7..3f4eec196d 100644 --- a/Items/Weapons/Ranged/Deathwind.cs +++ b/Items/Weapons/Ranged/Deathwind.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Typeless; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -16,10 +18,10 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 40; Item.height = 82; - Item.damage = 154; + Item.damage = 4000; Item.DamageType = DamageClass.Ranged; - Item.useTime = 14; - Item.useAnimation = 14; + Item.useTime = 45; + Item.useAnimation = 45; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; @@ -30,6 +32,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; Item.useAmmo = AmmoID.Arrow; + Item.channel = true; Item.Calamity().canFirePointBlankShots = true; } @@ -37,9 +40,66 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Ranged/DeathwindGlow").Value); } - + private int storedDMG = 1; + private float storedKB = 1; + public override void UseItemFrame(Player player) + { + if (player.direction == -1) + player.itemRotation -= MathHelper.Pi; + if (player.itemTime < 60) + { + player.itemRotation = player.DirectionTo(player.Calamity().mouseWorld).ToRotation(); + float scale = (1 - (player.itemTime - 10) / 50f) * 0.3f; + if (player.itemTime < 10) + { + scale = ((player.itemTime) / 10f) * 0.3f; + } + GeneralParticleHandler.SpawnParticle(new DirectionalPulseRing(player.Center + Vector2.UnitX.RotatedBy(player.itemRotation) * (48 + scale*96), Vector2.Zero, Color.Cyan, Vector2.One, 0, scale, scale, 3)); + if (player.itemTime == 1) + { + if (player.channel) + { + player.itemTime = 180; + player.itemAnimation = 180; + } + else if (Main.myPlayer == player.whoAmI) + { + Projectile.NewProjectile(Item.GetSource_FromThis(), player.Center + Vector2.UnitX.RotatedBy(player.itemRotation) * 1016, Vector2.UnitX.RotatedBy(player.itemRotation), ModContent.ProjectileType(), storedDMG, storedKB, player.whoAmI,-1,1); + } + } + } + else + { + player.itemRotation += MathHelper.Clamp(MathHelper.WrapAngle(player.DirectionTo(player.Calamity().mouseWorld).ToRotation() - player.itemRotation), -0.04f, 0.04f); + float scale = (1- (player.itemTime-70) / 110f) * 0.75f; + if (player.itemTime < 70) + { + scale = ((player.itemTime - 60) / 10f) * 0.75f; + } + GeneralParticleHandler.SpawnParticle(new DirectionalPulseRing(player.Center + Vector2.UnitX.RotatedBy(player.itemRotation) * (48 + scale * 96), Vector2.Zero, Color.Fuchsia, Vector2.One, 0, scale, scale, 3)); + if (player.itemTime == 60) + { + if (Main.myPlayer == player.whoAmI) + { + int p = Projectile.NewProjectile(Item.GetSource_FromThis(), player.Center + Vector2.UnitX.RotatedBy(player.itemRotation) * 1016, Vector2.UnitX.RotatedBy(player.itemRotation), ModContent.ProjectileType(), storedDMG*4, storedKB, player.whoAmI,-0.25f,1); + if (Main.projectile.IndexInRange(p)) + { + Main.projectile[p].scale = 4; + } + } + player.itemTime = 0; + player.itemAnimation = 0; + } + } + player.direction = player.itemRotation.ToRotationVector2().X.DirectionalSign(); + if (player.direction == -1) + player.itemRotation += MathHelper.Pi; + } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + storedDMG = damage; + storedKB = knockback; + return false; for (int index = 0; index < 4; ++index) { float SpeedX = velocity.X + Main.rand.Next(-20, 21) * 0.05f; diff --git a/Projectiles/Typeless/FriendlyLaserWallBeam.cs b/Projectiles/Typeless/FriendlyLaserWallBeam.cs index f2131eee7e..46ad0aae42 100644 --- a/Projectiles/Typeless/FriendlyLaserWallBeam.cs +++ b/Projectiles/Typeless/FriendlyLaserWallBeam.cs @@ -20,11 +20,11 @@ namespace CalamityMod.Projectiles.Typeless public new string LocalizationCategory => "Projectiles.Boss"; public float time = 0; public ref float attackSpeed => ref Projectile.ai[0]; - public ref float laserType => ref Projectile.ai[2]; + public ref float laserType => ref Projectile.ai[1]; public bool canDamage => doneAttack && laserFX >= 1f; public bool doneAttack = false; public int attackTime = 30; - public float laserLength => 3000; + public float laserLength => laserType == 0 ? 2000 : 1000; public float laserFX = 0; public float storedTime = 0; public Color drawColor = Color.Magenta; @@ -57,9 +57,6 @@ namespace CalamityMod.Projectiles.Typeless sine = (float)Math.Sin(time * 4f / MathHelper.Pi); if (time == 0) { - laserType = 1; - if (CalamityWorld.LegendaryMode) - Projectile.scale = 6; laserRot = Projectile.velocity.ToRotation(); beamStart = targetPos + Vector2.UnitX.RotatedBy(laserRot) * laserLength; @@ -68,7 +65,15 @@ namespace CalamityMod.Projectiles.Typeless //Projectile.Center += Main.rand.NextVector2CircularEdge(400, 400); // Some default values for if the projectile spawns without them set if (attackSpeed == 0) + { attackSpeed = 3f; + } + //Negative speed causes instant attack with the set speed + if (attackSpeed < 0) + { + attackSpeed = -attackSpeed; + time = attackTime; + } Projectile.velocity = Vector2.Zero; laserFX = 1f; Projectile.ForceNetUpdate(); @@ -132,22 +137,32 @@ namespace CalamityMod.Projectiles.Typeless return false; Texture2D beam = ModContent.Request("CalamityMod/Particles/BloomLineThick").Value; Texture2D bBeam = ModContent.Request("CalamityMod/Particles/LineThick").Value; - Texture2D bloom = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Texture2D angleBeam = ModContent.Request("CalamityMod/Particles/GlowBlade").Value; float opacity = (doneAttack ? 0.65f : 0.35f) * (float)Math.Pow(Math.Min(laserFX, 1), 2); Color beamColor = drawColor with { A = 0 }; if (CalamityClientConfig.Instance.Photosensitivity) opacity = 0.2f; - for (int t = 0; t < (!doneAttack ? 1 : 5); t++) - { - bool black = (t > 0); - Texture2D usedTex = (black ? bBeam : beam); - - float beamThickness = 0.03f * (black ? (0.8f - 0.15f * t) : 1f) * (laserFX <= 1 ? (float)Math.Pow(Math.Min(laserFX, 1), 2) : laserFX) * Utils.Remap(sine, -1, 1, 0.8f, 1.1f); - float rot = beamStart.DirectionTo(targetPos).ToRotation() + (MathHelper.PiOver2); - Main.EntitySpriteDraw(usedTex, beamStart - Main.screenPosition, null, (black ? Color.Black * opacity : beamColor * opacity) * (black ? (0.2f + 0.15f * t) : 1), rot, new Vector2(beam.Width / 2, beam.Height), new Vector2(beamThickness, laserLength / 975) * Projectile.scale, SpriteEffects.None); - } - //Main.EntitySpriteDraw(bloom, Projectile.Center - Main.screenPosition, null, Color.Red with { A = 0 }, 0, bloom.Size() / 2, 0.3f, SpriteEffects.None); + if (laserType == 0) + { + for (int t = 0; t < (!doneAttack ? 1 : 5); t++) + { + bool black = (t > 0); + Texture2D usedTex = (black ? bBeam : beam); + float beamThickness = 0.03f * (black ? (0.8f - 0.15f * t) : 1f) * (laserFX <= 1 ? (float)Math.Pow(Math.Min(laserFX, 1), 2) : laserFX) * Utils.Remap(sine, -1, 1, 0.8f, 1.1f); + float rot = beamStart.DirectionTo(targetPos).ToRotation() + (MathHelper.PiOver2); + Main.EntitySpriteDraw(usedTex, beamStart - Main.screenPosition, null, (black ? beamColor * opacity : beamColor * opacity) * (black ? (0.2f + 0.15f * t) : 1), rot, new Vector2(beam.Width / 2, beam.Height), new Vector2(beamThickness * Projectile.scale, laserLength / 975 * (usedTex == beam ? 1 : 0.8277f)), SpriteEffects.None); + } + } + else + { + for (int t = 0; t < (!doneAttack ? 1 : 4 * Projectile.scale); t++) + { + bool inFront = t > 0; + float beamThickness = 16/1960f * Projectile.scale * (inFront ? t/4f : 1) * (laserFX <= 1 ? (float)Math.Pow(Math.Min(laserFX, 1), 2) : laserFX) * Utils.Remap(sine, -1, 1, 0.8f, 1.1f); + Main.EntitySpriteDraw(angleBeam, beamStart - Main.screenPosition, null, beamColor * (1 - t * 0.3f) * opacity * (inFront ? (0.2f + 0.15f * t / Projectile.scale) : 1), directionToTarget.ToRotation() + MathHelper.PiOver2, new Vector2(angleBeam.Width / 2, angleBeam.Height), new Vector2(beamThickness * Projectile.scale, laserLength / 975 * 0.8277f), SpriteEffects.None); + } + } return false; } }