diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index a350a75f46..7e516c1683 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -8363,7 +8363,7 @@ namespace CalamityMod.CalPlayer // Sword else if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || - item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) + item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) { Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/ExcelsusGlow"); if (item.type == ModContent.ItemType()) @@ -8376,6 +8376,8 @@ namespace CalamityMod.CalPlayer texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/TerrorBladeGlow"); else if (item.type == ModContent.ItemType()) texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Summon/EtherealSubjugatorGlow"); + else if (item.type == ModContent.ItemType()) + texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/PrismaticBreakerGlow"); float yOffset = drawPlayer.gravDir == -1f ? 0f : (float)Main.itemTexture[item.type].Height; diff --git a/Items/Weapons/Magic/AlphaRay.cs b/Items/Weapons/Magic/AlphaRay.cs index 8718caa872..2d0190fcad 100644 --- a/Items/Weapons/Magic/AlphaRay.cs +++ b/Items/Weapons/Magic/AlphaRay.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Magic { if (player.altFunctionUse == 2) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)(damage * 1.75), knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)(damage * 1.75), knockBack, player.whoAmI, 0f, 0f); } else { diff --git a/Items/Weapons/Melee/PrismaticBreaker.cs b/Items/Weapons/Melee/PrismaticBreaker.cs index a99583fb4b..f2c5e0563d 100644 --- a/Items/Weapons/Melee/PrismaticBreaker.cs +++ b/Items/Weapons/Melee/PrismaticBreaker.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Magic; using CalamityMod.Projectiles.Melee; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; @@ -18,10 +19,11 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { - DisplayName.SetDefault("Elemental Excalibur"); - Tooltip.SetDefault("Freezes enemies and heals the player on hit\n" + - "Fires rainbow beams that change their behavior based on their color\n" + - "Right click for true melee"); + DisplayName.SetDefault("Prismatic Breaker"); + Tooltip.SetDefault("Seems to belong to a certain magical girl. Radiates with intense cosmic energy.\n" + + "Fires a rainbow colored wave\n" + + "Right click to instead fire a rainbow laser beam of doom\n" + + "The sword is boosted by both melee and ranged damage"); } public override void SetDefaults() @@ -33,21 +35,30 @@ namespace CalamityMod.Items.Weapons.Melee item.useTime = 3; item.useTurn = true; item.melee = true; - item.knockBack = 8f; + item.knockBack = 7f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.width = 92; - item.height = 92; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.rare = 10; + item.width = 50; + item.height = 50; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; + item.value = CalamityGlobalItem.Rarity14BuyPrice; + item.rare = 10; item.Calamity().customRarity = CalamityRarity.Dedicated; } + //Cancel out normal melee damage boosts and replace it with the average of melee and ranged damage boosts + //all damage boosts should still apply + public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) + { + float damageMult = (player.meleeDamage + player.rangedDamage - 2f) / 2f; + add += damageMult - player.meleeDamage; + } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Vector2 origin = new Vector2(46f, 44f); + //item.width and then item.height - 2f + Vector2 origin = new Vector2(25f, 23f); spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/PrismaticBreakerGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); } @@ -55,7 +66,8 @@ namespace CalamityMod.Items.Weapons.Melee { if (player.altFunctionUse == 2) { - Projectile.NewProjectile(position.X, position.Y, speedX * 0.5f, speedY * 0.5f, ModContent.ProjectileType(), (int)(damage * 1), knockBack, player.whoAmI, 0f, 0f); + swing = 0; + Projectile.NewProjectile(position.X, position.Y, speedX * 0.5f, speedY * 0.5f, ModContent.ProjectileType(), (int)(damage * 0.5), knockBack, player.whoAmI, 0f, 0f); } else { @@ -72,54 +84,29 @@ namespace CalamityMod.Items.Weapons.Melee public override bool AltFunctionUse(Player player) => true; + public override bool CanUseItem(Player player) => base.CanUseItem(player); + public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(4)) { - Color color = new Color(255, 0, 0, alpha); - switch (Main.rand.Next(12)) - { - case 0: // Red - break; - case 1: // Orange - color = new Color(255, 128, 0, alpha); - break; - case 2: // Yellow - color = new Color(255, 255, 0, alpha); - break; - case 3: // Lime - color = new Color(128, 255, 0, alpha); - break; - case 4: // Green - color = new Color(0, 255, 0, alpha); - break; - case 5: // Turquoise - color = new Color(0, 255, 128, alpha); - break; - case 6: // Cyan - color = new Color(0, 255, 255, alpha); - break; - case 7: // Light Blue - color = new Color(0, 128, 255, alpha); - break; - case 8: // Blue - color = new Color(0, 0, 255, alpha); - break; - case 9: // Purple - color = new Color(128, 0, 255, alpha); - break; - case 10: // Fuschia - color = new Color(255, 0, 255, alpha); - break; - case 11: // Hot Pink - color = new Color(255, 0, 128, alpha); - break; - default: - break; - } - - Dust dust24 = Main.dust[Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 267, 0f, 0f, alpha, color, 0.8f)]; - dust24.noGravity = true; + Color color = Utils.SelectRandom(Main.rand, new Color[] + { + new Color(255, 0, 0, alpha), //Red + new Color(255, 128, 0, alpha), //Orange + new Color(255, 255, 0, alpha), //Yellow + new Color(128, 255, 0, alpha), //Lime + new Color(0, 255, 0, alpha), //Green + new Color(0, 255, 128, alpha), //Turquoise + new Color(0, 255, 255, alpha), //Cyan + new Color(0, 128, 255, alpha), //Light Blue + new Color(0, 0, 255, alpha), //Blue + new Color(128, 0, 255, alpha), //Purple + new Color(255, 0, 255, alpha), //Fuschia + new Color(255, 0, 128, alpha) //Hot Pink + }); + Dust rainbow = Main.dust[Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 267, 0f, 0f, alpha, color, 0.8f)]; + rainbow.noGravity = true; } } diff --git a/Items/Weapons/Melee/PrismaticBreakerGlow.png b/Items/Weapons/Melee/PrismaticBreakerGlow.png new file mode 100644 index 0000000000..2defec7094 Binary files /dev/null and b/Items/Weapons/Melee/PrismaticBreakerGlow.png differ diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 733c1d5776..96a9fdac15 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1229,14 +1229,14 @@ namespace CalamityMod.Projectiles modPlayer.godSlayerDmg += num; } } - else if (projectile.melee) + if (projectile.melee) { if (modPlayer.ataxiaGeyser && player.ownedProjectileCounts[ProjectileType()] < 3) { Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.15, 35), 0f, projectile.owner, 0f, 0f); } } - else if (rogue) + if (rogue) { if (modPlayer.xerocSet && modPlayer.xerocDmg <= 0 && player.ownedProjectileCounts[ProjectileType()] < 3 && player.ownedProjectileCounts[ProjectileType()] < 3) { @@ -1383,7 +1383,7 @@ namespace CalamityMod.Projectiles target.AddBuff(BuffID.Venom, 240); } } - else if (projectile.minion || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type) || ProjectileID.Sets.MinionShot[projectile.type] || ProjectileID.Sets.SentryShot[projectile.type]) + if (projectile.minion || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type) || ProjectileID.Sets.MinionShot[projectile.type] || ProjectileID.Sets.SentryShot[projectile.type]) { if (modPlayer.profanedCrystalBuffs || (modPlayer.pArtifact && !modPlayer.profanedCrystal)) { diff --git a/Projectiles/Melee/PrismaticBeam.cs b/Projectiles/Melee/PrismaticBeam.cs new file mode 100644 index 0000000000..89b1012f0c --- /dev/null +++ b/Projectiles/Melee/PrismaticBeam.cs @@ -0,0 +1,87 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Melee +{ + public class PrismaticBeam : ModProjectile + { + private int alpha = 50; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Doom"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.ranged = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.extraUpdates = 100; + projectile.timeLeft = 100; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 30; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, Main.DiscoR * 0.25f / 255f, Main.DiscoG * 0.25f / 255f, Main.DiscoB * 0.25f / 255f); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + Color color = Utils.SelectRandom(Main.rand, new Color[] + { + new Color(255, 0, 0, alpha), //Red + new Color(255, 128, 0, alpha), //Orange + new Color(255, 255, 0, alpha), //Yellow + new Color(128, 255, 0, alpha), //Lime + new Color(0, 255, 0, alpha), //Green + new Color(0, 255, 128, alpha), //Turquoise + new Color(0, 255, 255, alpha), //Cyan + new Color(0, 128, 255, alpha), //Light Blue + new Color(0, 0, 255, alpha), //Blue + new Color(128, 0, 255, alpha), //Purple + new Color(255, 0, 255, alpha), //Fuschia + new Color(255, 0, 128, alpha) //Hot Pink + }); + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * 0.25f; + int num448 = Dust.NewDust(vector33, 1, 1, 267, 0f, 0f, alpha, color, 2.5f); + Main.dust[num448].position = vector33; + Main.dust[num448].velocity *= 0.1f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + 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); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + 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); + } + } +} diff --git a/Projectiles/Melee/PrismaticBeam.png b/Projectiles/Melee/PrismaticBeam.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/Melee/PrismaticBeam.png differ diff --git a/Projectiles/Melee/PrismaticWave.cs b/Projectiles/Melee/PrismaticWave.cs new file mode 100644 index 0000000000..2afaa1ac45 --- /dev/null +++ b/Projectiles/Melee/PrismaticWave.cs @@ -0,0 +1,155 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class PrismaticWave : ModProjectile + { + private int alpha = 50; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wave"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } + + public override void SetDefaults() + { + projectile.width = 36; + projectile.height = 36; + aiType = ProjectileID.FrostWave; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.ranged = true; + projectile.melee = true; + projectile.penetrate = 2; + projectile.timeLeft = 200; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.02f; + projectile.alpha += 30; + if (projectile.alpha >= 250) + { + projectile.alpha = 255; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.02f; + projectile.alpha -= 30; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } + Lighting.AddLight(projectile.Center, Main.DiscoR * 0.5f / 255f, Main.DiscoG * 0.5f / 255f, Main.DiscoB * 0.5f / 255f); + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + if (Main.rand.NextBool(2)) + { + Color color = Utils.SelectRandom(Main.rand, new Color[] + { + new Color(255, 0, 0, alpha), //Red + new Color(255, 128, 0, alpha), //Orange + new Color(255, 255, 0, alpha), //Yellow + new Color(128, 255, 0, alpha), //Lime + new Color(0, 255, 0, alpha), //Green + new Color(0, 255, 128, alpha), //Turquoise + new Color(0, 255, 255, alpha), //Cyan + new Color(0, 128, 255, alpha), //Light Blue + new Color(0, 0, 255, alpha), //Blue + new Color(128, 0, 255, alpha), //Purple + new Color(255, 0, 255, alpha), //Fuschia + new Color(255, 0, 128, alpha) //Hot Pink + }); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 267, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, alpha, color); + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (projectile.timeLeft > 195) + return false; + + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + + public override Color? GetAlpha(Color lightColor) => new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, alpha); + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 3; k++) + { + Color color = Utils.SelectRandom(Main.rand, new Color[] + { + new Color(255, 0, 0, alpha), //Red + new Color(255, 128, 0, alpha), //Orange + new Color(255, 255, 0, alpha), //Yellow + new Color(128, 255, 0, alpha), //Lime + new Color(0, 255, 0, alpha), //Green + new Color(0, 255, 128, alpha), //Turquoise + new Color(0, 255, 255, alpha), //Cyan + new Color(0, 128, 255, alpha), //Light Blue + new Color(0, 0, 255, alpha), //Blue + new Color(128, 0, 255, alpha), //Purple + new Color(255, 0, 255, alpha), //Fuschia + new Color(255, 0, 128, alpha) //Hot Pink + }); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 267, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, alpha, color); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + 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); + projectile.velocity *= 0.75f; + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + 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); + projectile.velocity *= 0.75f; + } + } +}