diff --git a/Items/CalamityGlobalItemBalance.cs b/Items/CalamityGlobalItemBalance.cs index cb00a3d67e..0463673416 100644 --- a/Items/CalamityGlobalItemBalance.cs +++ b/Items/CalamityGlobalItemBalance.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Items { ItemID.BoneArrow, Do(DamageRatio(1.1f)) }, { ItemID.BonePickaxe, Do(PickPower(55), UseTimeExact(6)) }, { ItemID.BoneSword, Do(AutoReuse, UseTurn, ScaleRatio(1.5f), DamageRatio(1.25f)) }, - { ItemID.BookofSkulls, Do(ManaExact(12)) }, + { ItemID.BookofSkulls, Do(ManaExact(12), ShootSpeedExact(9f)) }, { ItemID.BookStaff, Do(ManaExact(10), DamageRatio(1.25f)) }, { ItemID.Boomstick, pointBlank }, { ItemID.BorealWoodBow, Do(PointBlank, DamageRatio(1.1f)) }, @@ -141,7 +141,7 @@ namespace CalamityMod.Items { ItemID.DeadlySphereStaff, Do(UseExact(20)) }, { ItemID.DeathbringerPickaxe, Do(PickPower(70), UseTimeExact(10)) }, { ItemID.DemonBow, Do(PointBlank, DamageRatio(1.1f)) }, - { ItemID.DemonScythe, Do(DamageRatio(0.75f)) }, + { ItemID.DemonScythe, Do(AutoReuse, DamageExact(33), ManaExact(10)) }, { ItemID.DiamondStaff, Do(DamageExact(26)) }, { ItemID.Drax, Do(TrueMelee, PickPower(200), AxePower(110), UseTimeExact(4), TileBoostExact(+1)) }, { ItemID.DyeTradersScimitar, Do(AutoReuse, UseTurn, ScaleRatio(1.5f), DamageRatio(1.33f)) }, diff --git a/Items/Weapons/Magic/PlasmaRod.cs b/Items/Weapons/Magic/PlasmaRod.cs index 3a7b3af1ca..5bed619a6a 100644 --- a/Items/Weapons/Magic/PlasmaRod.cs +++ b/Items/Weapons/Magic/PlasmaRod.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Items.Weapons.Magic item.mana = 10; item.width = 40; item.height = 40; - item.useTime = 36; - item.useAnimation = 36; + item.useTime = 20; + item.useAnimation = 20; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 2.5f; @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Magic item.UseSound = SoundID.Item109; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 6f; + item.shootSpeed = 11f; } public override Vector2? HoldoutOrigin() diff --git a/Items/Weapons/Melee/Avalanche.cs b/Items/Weapons/Melee/Avalanche.cs index a422b73595..ce30ce4f8d 100644 --- a/Items/Weapons/Melee/Avalanche.cs +++ b/Items/Weapons/Melee/Avalanche.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Avalanche"); - Tooltip.SetDefault("Spawns ice bombs that explode after 2 seconds into ice shards on hit"); + Tooltip.SetDefault("Spawns ice bombs that explode after 3 seconds into ice shards on hit"); } public override void SetDefaults() @@ -20,10 +20,10 @@ namespace CalamityMod.Items.Weapons.Melee item.width = 64; item.height = 64; item.scale = 1.5f; - item.damage = 60; + item.damage = 100; item.melee = true; - item.useAnimation = 20; - item.useTime = 20; + item.useAnimation = 35; + item.useTime = 35; item.useTurn = true; item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 7.25f; @@ -35,97 +35,37 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - int i = Main.myPlayer; - float num72 = 6f; - float num74 = 5f; - player.itemTime = item.useTime; - 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) - { - 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 num107 = 2; - for (int num108 = 0; num108 < num107; num108++) - { - 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 * num108); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) - { - num79 *= -1f; - } - if (num79 < 20f) - { - num79 = 20f; - } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), num74, i, 0f, (float)Main.rand.Next(3)); - } + int totalProjectiles = 4; + float radians = MathHelper.TwoPi / totalProjectiles; + int type = ModContent.ProjectileType(); + float velocity = 4f; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 vector255 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(target.Center, vector255, type, (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), knockback, Main.myPlayer); + } } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - int i = Main.myPlayer; - float num72 = 6f; - float num74 = 5f; - player.itemTime = item.useTime; - 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) - { - 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 num107 = 2; - for (int num108 = 0; num108 < num107; num108++) - { - 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 * num108); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) - { - num79 *= -1f; - } - if (num79 < 20f) - { - num79 = 20f; - } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), num74, i, 0f, (float)Main.rand.Next(3)); - } - } + int totalProjectiles = 4; + float radians = MathHelper.TwoPi / totalProjectiles; + int type = ModContent.ProjectileType(); + float velocity = 4f; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 vector255 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(target.Center, vector255, type, (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), 0f, Main.myPlayer); + } + } public override void MeleeEffects(Player player, Rectangle hitbox) { diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index e65ddb145b..a742019bee 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3786,15 +3786,19 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.Creeper) { - // 50% resist to true melee. - if (projectile.Calamity().trueMelee) + // 50% resist to true melee and Demon Scythe. + if (projectile.Calamity().trueMelee || projectile.type == ProjectileID.DemonScythe) damage = (int)(damage * 0.5); } else if (EaterofWorldsIDs.Contains(npc.type)) { - // 50% resist to true melee. - if (projectile.Calamity().trueMelee) + // 50% resist to true melee and Demon Scythe. + if (projectile.Calamity().trueMelee || projectile.type == ProjectileID.DemonScythe) damage = (int)(damage * 0.5); + + // 40% resist to Sky Glaze. + else if (projectile.type == ProjectileType()) + damage = (int)(damage * 0.6); } else if (DesertScourgeIDs.Contains(npc.type)) { diff --git a/Projectiles/Boss/IceBomb.cs b/Projectiles/Boss/IceBomb.cs index 4fb3419796..c136b8b193 100644 --- a/Projectiles/Boss/IceBomb.cs +++ b/Projectiles/Boss/IceBomb.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Boss { public class IceBomb : ModProjectile diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 93b8232fdd..205a94976f 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -479,7 +479,115 @@ namespace CalamityMod.Projectiles RequiresManualResurrection = false; } - if (projectile.type == ProjectileID.Starfury) + if (projectile.type == ProjectileID.Skull && projectile.friendly) + { + if (projectile.alpha > 0) + projectile.alpha -= 75; + + if (projectile.alpha < 0) + projectile.alpha = 0; + + projectile.frame++; + if (projectile.frame > 2) + projectile.frame = 0; + + for (int num172 = 0; num172 < 2; num172++) + { + int num173 = Dust.NewDust(new Vector2(projectile.position.X + 4f, projectile.position.Y + 4f), projectile.width - 8, projectile.height - 8, 6, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 2f); + Main.dust[num173].position -= projectile.velocity * 2f; + Main.dust[num173].noGravity = true; + Main.dust[num173].velocity.X *= 0.3f; + Main.dust[num173].velocity.Y *= 0.3f; + } + + float num180 = (float)Math.Sqrt(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y); + float num181 = projectile.localAI[0]; + + if (num181 == 0f) + { + projectile.localAI[0] = num180; + num181 = num180; + } + + float num182 = projectile.position.X; + float num183 = projectile.position.Y; + float num184 = 300f; + bool flag4 = false; + int num185 = 0; + + if (projectile.ai[1] == 0f) + { + for (int num186 = 0; num186 < Main.maxNPCs; num186++) + { + if (Main.npc[num186].CanBeChasedBy(this) && (projectile.ai[1] == 0f || projectile.ai[1] == (float)(num186 + 1))) + { + float num187 = Main.npc[num186].position.X + (float)(Main.npc[num186].width / 2); + float num188 = Main.npc[num186].position.Y + (float)(Main.npc[num186].height / 2); + float num189 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num187) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num188); + if (num189 < num184 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num186].position, Main.npc[num186].width, Main.npc[num186].height)) + { + num184 = num189; + num182 = num187; + num183 = num188; + flag4 = true; + num185 = num186; + } + } + } + + if (flag4) + projectile.ai[1] = num185 + 1; + + flag4 = false; + } + + if (projectile.ai[1] > 0f) + { + int num190 = (int)(projectile.ai[1] - 1f); + if (Main.npc[num190].active && Main.npc[num190].CanBeChasedBy(this, ignoreDontTakeDamage: true) && !Main.npc[num190].dontTakeDamage) + { + float num191 = Main.npc[num190].position.X + (float)(Main.npc[num190].width / 2); + float num192 = Main.npc[num190].position.Y + (float)(Main.npc[num190].height / 2); + if (Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num191) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num192) < 1000f) + { + flag4 = true; + num182 = Main.npc[num190].position.X + (float)(Main.npc[num190].width / 2); + num183 = Main.npc[num190].position.Y + (float)(Main.npc[num190].height / 2); + } + } + else + projectile.ai[1] = 0f; + } + + if (!projectile.friendly) + flag4 = false; + + if (flag4) + { + float num193 = num181; + Vector2 vector9 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num194 = num182 - vector9.X; + float num195 = num183 - vector9.Y; + float num196 = (float)Math.Sqrt(num194 * num194 + num195 * num195); + num196 = num193 / num196; + num194 *= num196; + num195 *= num196; + int num197 = 32; + projectile.velocity.X = (projectile.velocity.X * (float)(num197 - 1) + num194) / (float)num197; + projectile.velocity.Y = (projectile.velocity.Y * (float)(num197 - 1) + num195) / (float)num197; + } + + projectile.spriteDirection = projectile.direction; + + if (projectile.direction < 0) + projectile.rotation = (float)Math.Atan2(0f - projectile.velocity.Y, 0f - projectile.velocity.X); + else + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X); + + return false; + } + + else if (projectile.type == ProjectileID.Starfury) { if (projectile.timeLeft > 45) projectile.timeLeft = 45; diff --git a/Projectiles/Magic/SparklingBeam.cs b/Projectiles/Magic/SparklingBeam.cs index e26f49cc93..b95056d17f 100644 --- a/Projectiles/Magic/SparklingBeam.cs +++ b/Projectiles/Magic/SparklingBeam.cs @@ -111,7 +111,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.life <= 0) + if (target.life <= 0 && target.lifeMax > 5) { Player player = Main.player[projectile.owner]; int shardDamage = projectile.damage / 5; diff --git a/Projectiles/Magic/StickyFeather.cs b/Projectiles/Magic/StickyFeather.cs index 957bce5890..00cdb8f767 100644 --- a/Projectiles/Magic/StickyFeather.cs +++ b/Projectiles/Magic/StickyFeather.cs @@ -35,7 +35,12 @@ namespace CalamityMod.Projectiles.Magic } } - public override void Kill(int timeLeft) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 1; + } + + public override void Kill(int timeLeft) { Main.PlaySound(SoundID.Item14, projectile.position); projectile.position.X = projectile.position.X + (float)(projectile.width / 2); diff --git a/Projectiles/Melee/IceBombFriendly.cs b/Projectiles/Melee/IceBombFriendly.cs index 64d6973bde..d17da39403 100644 --- a/Projectiles/Melee/IceBombFriendly.cs +++ b/Projectiles/Melee/IceBombFriendly.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ModLoader; @@ -12,31 +13,84 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - DisplayName.SetDefault("Bomb"); + DisplayName.SetDefault("Ice Bomb"); } public override void SetDefaults() { projectile.width = 30; projectile.height = 30; + projectile.scale = 0.5f; projectile.friendly = true; projectile.melee = true; - projectile.tileCollide = false; projectile.penetrate = 1; - projectile.timeLeft = 120; - projectile.coldDamage = true; + projectile.timeLeft = 180; } - public override void AI() + public override bool CanDamage() => projectile.ai[0] >= 120f; + + public override void AI() { - projectile.velocity *= 0.985f; - if (Main.rand.NextBool(5)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } + projectile.velocity *= 0.98f; - public override void Kill(int timeLeft) + if (projectile.localAI[0] == 0f) + { + projectile.scale += 0.01f; + projectile.alpha -= 50; + if (projectile.alpha <= 0) + { + projectile.localAI[0] = 1f; + projectile.alpha = 0; + } + } + else + { + projectile.scale -= 0.01f; + projectile.alpha += 50; + if (projectile.alpha >= 255) + { + projectile.localAI[0] = 0f; + projectile.alpha = 255; + } + } + + if (projectile.ai[0] < 120f) + { + projectile.ai[0] += 1f; + if (projectile.ai[0] == 120f) + { + for (int num621 = 0; num621 < 8; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 14; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + + projectile.scale = 1f; + CalamityGlobalProjectile.ExpandHitboxBy(projectile, (int)(30f * projectile.scale)); + Main.PlaySound(SoundID.Item30, projectile.Center); + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return Main.dayTime ? new Color(50, 50, 255, projectile.alpha) : new Color(255, 255, 255, projectile.alpha); + } + + public override void Kill(int timeLeft) { Main.PlaySound(SoundID.Item27, projectile.position); float spread = 90f * 0.0174f; @@ -57,10 +111,9 @@ namespace CalamityMod.Projectiles.Melee Main.projectile[projectile2].Calamity().forceMelee = true; } } + for (int k = 0; k < 3; k++) - { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)