diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 1795b6bdfc..e6b3f526ad 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -4813,7 +4813,7 @@ namespace CalamityMod.CalPlayer if (proj.type == ModContent.ProjectileType()) { if (target.buffImmune[ModContent.BuffType()]) - damageMult += 0.2; + damageMult += 0.1; } else if (proj.type == ProjectileID.InfernoFriendlyBlast) { diff --git a/Items/Weapons/Magic/HadopelagicEcho.cs b/Items/Weapons/Magic/HadopelagicEcho.cs index 954141ad63..40c2f922ce 100644 --- a/Items/Weapons/Magic/HadopelagicEcho.cs +++ b/Items/Weapons/Magic/HadopelagicEcho.cs @@ -21,14 +21,14 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 609; + item.damage = 769; item.magic = true; item.mana = 15; item.width = 60; item.height = 60; item.useTime = 8; item.reuseDelay = 20; - item.useAnimation = 40; + item.useAnimation = 30; item.useStyle = 5; item.noMelee = true; item.knockBack = 1.5f; diff --git a/Items/Weapons/Magic/VividClarity.cs b/Items/Weapons/Magic/VividClarity.cs index 6428eb0e58..db4ea0882c 100644 --- a/Items/Weapons/Magic/VividClarity.cs +++ b/Items/Weapons/Magic/VividClarity.cs @@ -15,22 +15,24 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Vivid Clarity"); - Tooltip.SetDefault("Fires 3 beams of elemental energy near the mouse cursor that bounce\n" + - "The beams split when enemies are near\n" + - "The more enemies and tiles the beams hit the more damage they do\n" + - "High IQ required"); + Tooltip.SetDefault("Fires five randomized beams of elemental energy at the cursor\n" + + "On enemy and tile hits, beams either explode into a big flash,\n" + + "summon an additonal laser from the sky,\n" + + "or split into energy orbs\n" + + "High IQ increases the weapon's potential"); Item.staff[item.type] = true; } public override void SetDefaults() { - item.damage = 500; + item.damage = 550; item.magic = true; - item.mana = 150; + item.mana = 69; item.width = 90; item.height = 112; - item.useTime = 33; - item.useAnimation = 33; + item.useAnimation = 20; + item.useTime = 4; + item.reuseDelay = item.useAnimation; item.useStyle = 5; item.noMelee = true; item.knockBack = 7.5f; @@ -38,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Magic item.rare = 10; item.UseSound = SoundID.Item60; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 6f; item.Calamity().postMoonLordRarity = 15; } @@ -50,50 +52,29 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float num72 = item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X + vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y + vector2.Y; - if (player.gravDir == -1f) + float num72 = item.shootSpeed; + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + float f = Main.rand.NextFloat() * 6.28318548f; + float value12 = 20f; + float value13 = 60f; + Vector2 vector13 = vector2 + f.ToRotationVector2() * MathHelper.Lerp(value12, value13, Main.rand.NextFloat()); + for (int num202 = 0; num202 < 50; num202++) { - num79 = Main.screenPosition.Y + (float)Main.screenHeight + (float)Main.mouseY + vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - - int num130 = 3; - for (int num131 = 0; num131 < num130; num131++) - { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - vector2.Y -= (float)(100 * num131); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) + vector13 = vector2 + f.ToRotationVector2() * MathHelper.Lerp(value12, value13, Main.rand.NextFloat()); + if (Collision.CanHit(vector2, 0, 0, vector13 + (vector13 - vector2).SafeNormalize(Vector2.UnitX) * 8f, 0, 0)) { - num79 *= -1f; + break; } - if (num79 < 20f) - { - num79 = 20f; - } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float speedX4 = num78 + (float)Main.rand.Next(-40, 41) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + f = Main.rand.NextFloat() * 6.28318548f; } + Vector2 mouseWorld = Main.MouseWorld; + Vector2 vector14 = mouseWorld - vector13; + Vector2 vector15 = new Vector2(num78, num79).SafeNormalize(Vector2.UnitY) * num72; + vector14 = vector14.SafeNormalize(vector15) * num72; + vector14 = Vector2.Lerp(vector14, vector15, 0.25f); + Projectile.NewProjectile(vector13, vector14, type, damage, knockBack, player.whoAmI, 0f, Main.rand.Next(3)); return false; } @@ -103,7 +84,7 @@ namespace CalamityMod.Items.Weapons.Magic recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); diff --git a/Projectiles/Magic/VividBeam.cs b/Projectiles/Magic/VividBeam.cs new file mode 100644 index 0000000000..e33121670d --- /dev/null +++ b/Projectiles/Magic/VividBeam.cs @@ -0,0 +1,154 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Magic +{ + public class VividBeam : ModProjectile + { + private bool counter = true; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 1; + projectile.extraUpdates = 100; + projectile.timeLeft = 240; + } + + public override void AI() + { + Vector2 value7 = new Vector2(5f, 10f); + projectile.ai[0] += 1f; + if (projectile.ai[0] == 48f) + { + projectile.ai[0] = 0f; + } + else + { + for (int num41 = 0; num41 < 2; num41++) + { + Vector2 value8 = Vector2.UnitX * -12f; + value8 = -Vector2.UnitY.RotatedBy((double)(projectile.ai[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 - projectile.rotation.ToRotationVector2() * 10f; + int num42 = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num42].scale = 0.75f; + Main.dust[num42].noGravity = true; + Main.dust[num42].position = projectile.Center + value8; + Main.dust[num42].velocity = projectile.velocity; + } + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num447 = 0; num447 < 2; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num448].noGravity = true; + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } + + if (counter) + { + counter = false; + float num98 = 16f; + int num99 = 0; + while ((float)num99 < num98) + { + Vector2 vector11 = Vector2.UnitX * 0f; + vector11 += -Vector2.UnitY.RotatedBy((double)((float)num99 * (6.28318548f / num98)), default) * new Vector2(1f, 4f); + vector11 = vector11.RotatedBy((double)projectile.velocity.ToRotation(), default); + int num100 = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num100].scale = 1.5f; + Main.dust[num100].noGravity = true; + Main.dust[num100].position = projectile.Center + vector11; + Main.dust[num100].velocity = projectile.velocity * 0f + vector11.SafeNormalize(Vector2.UnitY) * 1f; + num99++; + } + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.owner == Main.myPlayer) + { + SummonLasers(); + } + return true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (projectile.owner == Main.myPlayer) + { + SummonLasers(); + } + target.AddBuff(ModContent.BuffType(), 30); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } + + private void SummonLasers() + { + if (projectile.ai[1] == 0f) + { + float x = projectile.position.X + (float)Main.rand.Next(-400, 400); + float y = projectile.position.Y - (float)Main.rand.Next(500, 800); + Vector2 vector = new Vector2(x, y); + float num15 = projectile.position.X + (float)(projectile.width / 2) - vector.X; + float num16 = projectile.position.Y + (float)(projectile.height / 2) - vector.Y; + num15 += (float)Main.rand.Next(-100, 101); + float num17 = 6f; + float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); + num18 = num17 / num18; + num15 *= num18; + num16 *= num18; + int num19 = Projectile.NewProjectile(x, y, num15, num16, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[num19].ai[1] = projectile.position.Y; + } + if (projectile.ai[1] == 1f) + { + int boom = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((double)projectile.damage * 2f), projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[boom].Calamity().forceMagic = true; + } + if (projectile.ai[1] == 2f) + { + float spread = 30f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < 4; i++) + { + offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)((double)projectile.damage * 0.2f), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)((double)projectile.damage * 0.2f), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + } + } +} diff --git a/Projectiles/Magic/VividBeam.png b/Projectiles/Magic/VividBeam.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/Magic/VividBeam.png differ diff --git a/Projectiles/Magic/VividClarityBeam.cs b/Projectiles/Magic/VividClarityBeam.cs index 413a195ec0..63e76a1d48 100644 --- a/Projectiles/Magic/VividClarityBeam.cs +++ b/Projectiles/Magic/VividClarityBeam.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Magic public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.damage = (int)((double)projectile.damage * 1.1); + projectile.damage = (int)((double)projectile.damage * 1.2); projectile.penetrate--; if (projectile.penetrate <= 0) { @@ -96,11 +96,6 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy) - { - return; - } - projectile.damage = (int)((double)projectile.damage * 1.05); target.AddBuff(ModContent.BuffType(), 30); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); @@ -110,6 +105,11 @@ namespace CalamityMod.Projectiles.Magic target.AddBuff(BuffID.Frostburn, 120); target.AddBuff(BuffID.OnFire, 120); target.AddBuff(BuffID.Ichor, 120); + if (target.type == NPCID.TargetDummy) + { + return; + } + projectile.damage = (int)((double)projectile.damage * 1.1); } } } diff --git a/Projectiles/Magic/VividLaser2.cs b/Projectiles/Magic/VividLaser2.cs new file mode 100644 index 0000000000..efb9ed4047 --- /dev/null +++ b/Projectiles/Magic/VividLaser2.cs @@ -0,0 +1,125 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Magic +{ + public class VividLaser2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Vivid Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.alpha = 255; + projectile.timeLeft = 120; + projectile.penetrate = 1; + projectile.magic = true; + } + + public override void AI() + { + Vector2 value7 = new Vector2(5f, 10f); + projectile.ai[1] += 1f; + for (int dust = 0; dust < 2; dust++) + { + Vector2 value8 = Vector2.UnitX * -12f; + value8 = -Vector2.UnitY.RotatedBy((double)(projectile.ai[1] * 0.1308997f + (float)dust * 3.14159274f), default) * value7 - projectile.rotation.ToRotationVector2() * 10f; + int num42 = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num42].scale = 0.75f; + Main.dust[num42].noGravity = true; + Main.dust[num42].position = projectile.Center + value8; + Main.dust[num42].velocity = projectile.velocity; + } + if (projectile.timeLeft < 110) + projectile.ai[0] = 1f; + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + if (projectile.ai[0] >= 1f) + { + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 30f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + return; + } + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 3; k++) + { + int randomDust = Utils.SelectRandom(Main.rand, new int[] + { + 107, + 234, + 269 + }); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 30); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } + + // Cannot deal damage for the first several frames of existence. + public override bool? CanHitNPC(NPC target) + { + if (projectile.timeLeft >= 110) + { + return false; + } + return null; + } + + public override bool CanHitPvp(Player target) + { + return projectile.timeLeft < 110; + } + } +} diff --git a/Projectiles/Magic/VividLaser2.png b/Projectiles/Magic/VividLaser2.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/Magic/VividLaser2.png differ