diff --git a/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs b/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs index 6e956ede84..bbe33b81dd 100644 --- a/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs +++ b/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs @@ -64,12 +64,8 @@ namespace CalamityMod.CalPlayer.DrawLayers glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/IridescentExcaliburGlow").Value; else if (itemType == ModContent.ItemType()) glowMask = ModContent.Request("CalamityMod/Items/Weapons/Magic/FatesRevealGlow").Value; - else if (itemType == ModContent.ItemType()) - glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/GrandGuardianGlow").Value; else if (itemType == ModContent.ItemType()) glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/GreatswordofJudgementGlow").Value; - else if (itemType == ModContent.ItemType()) - glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/MajesticGuardGlow").Value; else if (itemType == ModContent.ItemType()) glowMask = ModContent.Request("CalamityMod/Items/SummonItems/NecroplasmicBeaconGlow").Value; else if (itemType == ModContent.ItemType()) @@ -174,11 +170,6 @@ namespace CalamityMod.CalPlayer.DrawLayers break;*/ } - if (itemType == ModContent.ItemType()) - { - color = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, heldItem.alpha); - } - Vector2 origin = new Vector2((float)itemDrawFrame.Width * 0.5f - (float)itemDrawFrame.Width * 0.5f * (float)drawPlayer.direction, itemDrawFrame.Height); if (heldItem.useStyle == ItemUseStyleID.DrinkLiquid && drawPlayer.itemAnimation > 0) { diff --git a/CalamityLists.cs b/CalamityLists.cs index 978ea0b167..6e6e1399c2 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -1930,6 +1930,9 @@ namespace CalamityMod ProjectileType(), ProjectileType(), ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), diff --git a/Items/Weapons/Melee/GrandDad.cs b/Items/Weapons/Melee/GrandDad.cs index 88725ed86c..500a257e2d 100644 --- a/Items/Weapons/Melee/GrandDad.cs +++ b/Items/Weapons/Melee/GrandDad.cs @@ -1,11 +1,13 @@ using CalamityMod.Items.BaseItems; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; -using CalamityMod.Rarities; -using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Rarities; +using System.Collections.Generic; namespace CalamityMod.Items.Weapons.Melee { @@ -19,13 +21,12 @@ namespace CalamityMod.Items.Weapons.Melee Item.damage = 2777; Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = 77; - Item.useStyle = ItemUseStyleID.Swing; Item.useTime = 77; Item.useTurn = true; - Item.knockBack = 7f; + Item.knockBack = 12f; Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityRedBuyPrice; - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; + Item.rare = ModContent.RarityType(); Item.channel = true; Item.shoot = ModContent.ProjectileType(); @@ -33,12 +34,18 @@ namespace CalamityMod.Items.Weapons.Melee Item.noMelee = true; Item.useStyle = ItemUseStyleID.Shoot; } - + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Melee/GrandDadGlow").Value); + } public override bool MeleePrefix() => true; + + // Has a GFB tooltip stuffed to the brim with various references + public override void ModifyTooltips(List list) => list.FindAndReplace("[GFB]", this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal")); public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(). AddIngredient(3). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Weapons/Melee/GrandDadGlow.png b/Items/Weapons/Melee/GrandDadGlow.png new file mode 100644 index 0000000000..4fbb8322fd Binary files /dev/null and b/Items/Weapons/Melee/GrandDadGlow.png differ diff --git a/Items/Weapons/Melee/GrandGuardian.cs b/Items/Weapons/Melee/GrandGuardian.cs index 339dbd02c4..e0791b2d3a 100644 --- a/Items/Weapons/Melee/GrandGuardian.cs +++ b/Items/Weapons/Melee/GrandGuardian.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Healing; +using CalamityMod.Items.BaseItems; +using CalamityMod.Projectiles.Healing; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -8,109 +9,38 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class GrandGuardian : ModItem, ILocalizedModType + public class GrandGuardian : CustomUseProjItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - - internal const int TotalHealOrbs = 3; - - internal const int HealPerOrb = 3; - - internal const int TotalHealed = TotalHealOrbs * HealPerOrb; - public override void SetDefaults() { Item.width = 130; Item.height = 130; - Item.damage = 150; - Item.DamageType = DamageClass.Melee; - Item.useAnimation = 22; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 22; + Item.damage = 304; + Item.DamageType = TrueMeleeDamageClass.Instance; + Item.useAnimation = 40; + Item.useTime = 40; Item.useTurn = true; - Item.knockBack = 8.5f; - Item.UseSound = SoundID.Item1; + Item.knockBack = 9f; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.rare = ItemRarityID.Red; - Item.shootSpeed = 12f; - } + Item.channel = true; + Item.shoot = ModContent.ProjectileType(); + Item.noUseGraphic = true; + Item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Melee/GrandGuardianGlow").Value); } - - public override void UseStyle(Player player, Rectangle heldItemFrame) - { - player.itemLocation += new Vector2(-12f * player.direction, 2f * player.gravDir).RotatedBy(player.itemRotation); - } - - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - if (target.Calamity().miscDefenseLoss < target.defense) - target.Calamity().miscDefenseLoss += 1; - - OnHitEffects(player, target.Center, target.life, target.lifeMax, Item.knockBack, Item.damage); - - if (target.Calamity().miscDefenseLoss >= target.defense) - { - if (player.moonLeech || player.lifeSteal <= 0f || target.lifeMax <= 5) - return; - - int heal = 6; - player.lifeSteal -= heal; - player.statLife += heal; - player.HealEffect(heal); - if (player.statLife > player.statLifeMax2) - player.statLife = player.statLifeMax2; - } - } - - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - OnHitEffects(player, target.Center, target.statLife, target.statLifeMax2, Item.knockBack, Item.damage); - } - - private void OnHitEffects(Player player, Vector2 targetPos, int targetLife, int targetMaxLife, float knockback, int damage) - { - var source = player.GetSource_ItemUse(Item); - - // Grand Guardian is classed as a regular melee weapon, so despite being a true melee on-hit, these scale with regular melee. - StatModifier playerMeleeDmg = player.GetTotalDamage(); - int rainbowBoomDamage = (int)playerMeleeDmg.ApplyTo(damage * 0.5f); - int rainBoltDamage = (int)playerMeleeDmg.ApplyTo(damage * 0.75f); - - Projectile.NewProjectile(source, targetPos, Vector2.Zero, ModContent.ProjectileType(), rainbowBoomDamage, 0f, player.whoAmI); - - if (targetLife <= (targetMaxLife * 0.5f) && player.ownedProjectileCounts[ModContent.ProjectileType()] < 3) - { - float randomSpeedX = Main.rand.NextFloat(6f, 12f); - float randomSpeedY = Main.rand.NextFloat(6f, 12f); - Projectile.NewProjectile(source, targetPos.X, targetPos.Y, -randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), rainBoltDamage, knockback, player.whoAmI); - Projectile.NewProjectile(source, targetPos.X, targetPos.Y, randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), rainBoltDamage, knockback, player.whoAmI); - Projectile.NewProjectile(source, targetPos.X, targetPos.Y, 0f, -randomSpeedY, ModContent.ProjectileType(), rainBoltDamage, knockback, player.whoAmI); - } - - if (player.moonLeech || player.lifeSteal <= 0f) - return; - - if (targetLife <= 0 && !player.moonLeech && player.ownedProjectileCounts[ModContent.ProjectileType()] < 3 && targetMaxLife > 5) - { - player.lifeSteal -= TotalHealed; - float randomSpeedX = Main.rand.NextFloat(3f, 4.5f); - float randomSpeedY = Main.rand.NextFloat(3f, 4.5f); - Projectile.NewProjectile(source, targetPos.X, targetPos.Y, -randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); - Projectile.NewProjectile(source, targetPos.X, targetPos.Y, randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); - Projectile.NewProjectile(source, targetPos.X, targetPos.Y, 0f, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); - } - } - + public override bool MeleePrefix() => true; public override void AddRecipes() { CreateRecipe(). AddIngredient(). - AddIngredient(). AddIngredient(ItemID.FragmentNebula, 6). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Weapons/Melee/GrandGuardianGlow.png b/Items/Weapons/Melee/GrandGuardianGlow.png index 7b6f39623c..32db8cd911 100644 Binary files a/Items/Weapons/Melee/GrandGuardianGlow.png and b/Items/Weapons/Melee/GrandGuardianGlow.png differ diff --git a/Items/Weapons/Melee/MajesticGuard.cs b/Items/Weapons/Melee/MajesticGuard.cs index 47319cb373..3439359161 100644 --- a/Items/Weapons/Melee/MajesticGuard.cs +++ b/Items/Weapons/Melee/MajesticGuard.cs @@ -1,4 +1,7 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.BaseItems; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -6,7 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class MajesticGuard : ModItem, ILocalizedModType + public class MajesticGuard : CustomUseProjItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; @@ -14,53 +17,43 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 100; Item.height = 100; - Item.damage = 70; - Item.DamageType = DamageClass.Melee; - Item.useAnimation = 22; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 22; + Item.damage = 365; + Item.DamageType = TrueMeleeDamageClass.Instance; + Item.useAnimation = 60; + Item.useTime = 60; Item.useTurn = true; - Item.knockBack = 7.5f; - Item.UseSound = SoundID.Item1; + Item.knockBack = 12f; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - } + Item.channel = true; + Item.shoot = ModContent.ProjectileType(); + Item.noUseGraphic = true; + Item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + } + public override bool MeleePrefix() => true; public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Melee/MajesticGuardGlow").Value); } - - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - if (target.Calamity().miscDefenseLoss < target.defense) - target.Calamity().miscDefenseLoss += 1; - - if (target.Calamity().miscDefenseLoss >= target.defense) - { - if (player.moonLeech || player.lifeSteal <= 0f || target.lifeMax <= 5) - return; - - int heal = 3; - player.lifeSteal -= heal; - player.statLife += heal; - player.HealEffect(heal); - if (player.statLife > player.statLifeMax2) - player.statLife = player.statLifeMax2; - } - } - public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.AdamantiteSword). - AddIngredient(ItemID.SoulofMight, 15). + AddIngredient(ItemID.GoldBroadsword). + AddRecipeGroup("AnyMythrilBar", 15). + AddIngredient(3). + AddIngredient(3). + AddIngredient(3). AddTile(TileID.MythrilAnvil). Register(); CreateRecipe(). - AddIngredient(ItemID.TitaniumSword). - AddIngredient(ItemID.SoulofMight, 15). + AddIngredient(ItemID.PlatinumBroadsword). + AddRecipeGroup("AnyMythrilBar", 15). + AddIngredient(3). + AddIngredient(3). + AddIngredient(3). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/MajesticGuardGlow.png b/Items/Weapons/Melee/MajesticGuardGlow.png index 61542093d6..ae3594d46e 100644 Binary files a/Items/Weapons/Melee/MajesticGuardGlow.png and b/Items/Weapons/Melee/MajesticGuardGlow.png differ diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index f44092f522..2baf9ff923 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -636,12 +636,22 @@ GoldplumeSpear: { GrandDad: { DisplayName: Grand Dad - Tooltip: + Tooltip: "[GFB]" + TooltipNormal: ''' - A high quality blade that rips through enemies + A high quality blade that rips through enemies using its immense weight +Heals you on hit Striking weaker enemies will launch them with incredible force Launched enemies take immense damage when colliding with walls and floors - Holding will heavily reduce the damage of the blade and increase its launch damage and velocity + Holding while swinging will heavily reduce the damage of the blade and increase its launch damage and velocity + [c/00B8DF:'How are you swinging something that has half the mass of a star?'] + ''' + TooltipGFB: + ''' + A high quality blade that rips through enemies + Striking weaker enemies will yeet them with incredible force, often leaving them Stuck Inside tiles + Yeeted enemies will turn to JAM when SLAMED into walls and floors + Listening to KFAD will heavily reduce the damage of the blade and increase its yeet damage and velocity, nice >:] [c/00B8DF:'Please read the weapon description.'] ''' } @@ -650,11 +660,8 @@ GrandGuardian: { DisplayName: Grand Guardian Tooltip: ''' - Lowers enemy defense by 1 with every strike - If enemy defense is 0 or below your attacks will heal you - Striking enemies causes a large explosion - Striking enemies that are under half life will cause them to release rainbow bolts - Enemies spawn healing orbs on death + An ornate winged blade that easily cuts through enemies + Creates cosmic explosions and heals you slightly on hit ''' } @@ -765,8 +772,8 @@ MajesticGuard: { DisplayName: Majestic Guard Tooltip: ''' - Lowers enemy defense by 1 with every strike - If enemy defense is 0 or below your attacks will heal you + An intricate blade, heavy enough to crush anything it wouldn't cut + Heals you slightly on hit ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index 5e2347b746..4524c9c5ee 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -317,3 +317,4 @@ YinYoDark.DisplayName: Dark Shard YinYoLight.DisplayName: Light Shard RespiteblockHoldout.DisplayName: Respiteblock RespiteblockBlood.DisplayName: Respiteblock Blood +GrandGuardianBoom.DisplayName: Grand Guardian Boom diff --git a/NPCs/CalamityFallDamageNPC.cs b/NPCs/CalamityFallDamageNPC.cs index 1e2553d890..f64fb3f830 100644 --- a/NPCs/CalamityFallDamageNPC.cs +++ b/NPCs/CalamityFallDamageNPC.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Projectiles/Healing/RainHeal.cs b/Projectiles/Healing/RainHeal.cs index 4b72eba2a6..f28b94ec5c 100644 --- a/Projectiles/Healing/RainHeal.cs +++ b/Projectiles/Healing/RainHeal.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Healing if (Projectile.timeLeft > SlowDownTime) Projectile.velocity *= 0.9f; else - Projectile.HealingProjectile(GrandGuardian.HealPerOrb, Projectile.owner, 12f, 15f); + Projectile.HealingProjectile(10, Projectile.owner, 12f, 15f); } int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB)); diff --git a/Projectiles/Melee/GrandDadHoldout.cs b/Projectiles/Melee/GrandDadHoldout.cs index 9e0087aae7..3689cae6f1 100644 --- a/Projectiles/Melee/GrandDadHoldout.cs +++ b/Projectiles/Melee/GrandDadHoldout.cs @@ -1,6 +1,5 @@ using System; using CalamityMod.CalPlayer; -using CalamityMod.Items; using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs.PrimordialWyrm; using CalamityMod.Particles; @@ -22,7 +21,7 @@ namespace CalamityMod.Projectiles.Melee public override int AssignedItemID => ModContent.ItemType(); public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - + public override string Texture => "CalamityMod/Items/Weapons/Melee/GrandDad"; public override float HitboxOutset => 125; public override Vector2 HitboxSize => new Vector2(170, 170); @@ -177,10 +176,22 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(fire3 with { Volume = 0.8f }, Projectile.Center); } if (Projectile.numHits == 0) + { Owner.Calamity().GeneralScreenShakePower = 6.5f; + } + + int heal = (int)(MathHelper.Clamp(12 - Projectile.numHits * 3, 1, 12)); + if (Main.player[Main.myPlayer].lifeSteal > 0f) + { + Owner.lifeSteal -= heal; + Owner.statLife += heal; + Owner.HealEffect(heal); + if (Owner.statLife > Owner.statLifeMax2) + Owner.statLife = Owner.statLifeMax2; + } bool isAPillar = target.type == NPCID.LunarTowerSolar || target.type == NPCID.LunarTowerVortex || target.type == NPCID.LunarTowerNebula || target.type == NPCID.LunarTowerStardust; - if (!isAPillar && !target.boss && target.IsAnEnemy(true, true) && !CalamityPlayer.areThereAnyDamnBosses && target.CanBeChasedBy(Projectile, false) || Main.zenithWorld || target.type == ModContent.NPCType()) + if (!isAPillar && !target.boss && target.IsAnEnemy(true, true, false) && !CalamityPlayer.areThereAnyDamnBosses && target.CanBeChasedBy(Projectile, false) || Main.zenithWorld || target.type == ModContent.NPCType()) { if (target.type == ModContent.NPCType()) { @@ -198,15 +209,11 @@ namespace CalamityMod.Projectiles.Melee Vector2 launchVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * (Main.zenithWorld ? -50 : -30) * (rightClicked ? 2 : 1); target.velocity = launchVel * 0.5f; - // If enemies are sitting on platforms, force them down so they can get dunked on the floor - if (launchVel.Y > 0) - target.Center += new Vector2(3, 0); - // Remove knockback resist, just like it used to target.knockBackResist = 1; // Apply tile collison damage (is bonus on GFB and even further is both final bosses are gone) - target.FallingNPC().ApplyFallDamage(target, Projectile.damage * (Main.zenithWorld ? (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs ? 1000 : 25) : 3) * (rightClicked ? 3 : 1), launchVel, 5f, true); + target.FallingNPC().ApplyFallDamage(target, Projectile.damage * (Main.zenithWorld ? (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs ? 1000 : 77) : 3) * (rightClicked ? 3 : 1), launchVel, 5f, true); } Particle spark = new VoidSparkParticle(target.Center, (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35, false, 13, 0.5f, Color.DodgerBlue); GeneralParticleHandler.SpawnParticle(spark); @@ -227,7 +234,7 @@ namespace CalamityMod.Projectiles.Melee modifiers.SourceDamage *= 0.0025f; else { - float minMult = 0.3f; + float minMult = 0.5f; int hitsToMinMult = 7; float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); modifiers.SourceDamage *= damageMult; @@ -239,6 +246,7 @@ namespace CalamityMod.Projectiles.Melee if ((useAnim > 0 || DrawUnconditionally) && Owner.ItemAnimationActive) { Asset tex = ModContent.Request(Texture); + Asset glowTex = ModContent.Request("CalamityMod/Items/Weapons/Melee/GrandDadGlow"); float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f; @@ -252,6 +260,7 @@ namespace CalamityMod.Projectiles.Melee } Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + Main.EntitySpriteDraw(glowTex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), glowTex.Frame(1, FrameCount, 0, Frame), Color.White, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(glowTex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } return false; diff --git a/Projectiles/Melee/GrandDadHoldout.png b/Projectiles/Melee/GrandDadHoldout.png deleted file mode 100644 index 09d8d4c91b..0000000000 Binary files a/Projectiles/Melee/GrandDadHoldout.png and /dev/null differ diff --git a/Projectiles/Melee/GrandGuardianBoom.cs b/Projectiles/Melee/GrandGuardianBoom.cs new file mode 100644 index 0000000000..875b820907 --- /dev/null +++ b/Projectiles/Melee/GrandGuardianBoom.cs @@ -0,0 +1,62 @@ +using System; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class GrandGuardianBoom : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Color mainColor = Color.White; + public int time = 0; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 400; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 35; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + if (mainColor == Color.White) + { + mainColor = Main.rand.NextBool() ? Color.Cyan : Color.DarkOrchid; + Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * 0.45f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 2.56f, 35); + GeneralParticleHandler.SpawnParticle(bolt2); + Particle bolt3 = new CustomPulse(Projectile.Center, Vector2.Zero, (mainColor == Color.Cyan ? Color.Orchid : Color.Cyan) * 0.65f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 1.26f, 15); + GeneralParticleHandler.SpawnParticle(bolt3); + + for (int i = 0; i < 25; i++) + { + Vector2 dustVel = new Vector2(7, 7).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.8f) * 1; + Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel * 9, Main.rand.NextBool(4) ? 264 : 66, dustVel * 4, 0, default, Main.rand.NextFloat(0.8f, 1.4f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.Lerp(mainColor, Color.White, 0.5f) : mainColor; + + bool color = Main.rand.NextBool(); + GenericSparkle sparker = new GenericSparkle(Projectile.Center + dustVel * 9, dustVel * 4, color ? Color.Cyan : Color.DarkOrchid, color ? Color.DarkOrchid : Color.Cyan, Main.rand.NextFloat(0.6f, 0.8f), 11, Main.rand.NextFloat(-0.1f, 0.1f), 2.68f); + GeneralParticleHandler.SpawnParticle(sparker); + } + } + if (time == 6) + { + //Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * 0.65f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 2.56f, 3.26f, 24); + //GeneralParticleHandler.SpawnParticle(bolt2); + } + time++; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f, targetHitbox); + } +} diff --git a/Projectiles/Melee/GrandGuardianGhost.png b/Projectiles/Melee/GrandGuardianGhost.png new file mode 100644 index 0000000000..03e54cf6e6 Binary files /dev/null and b/Projectiles/Melee/GrandGuardianGhost.png differ diff --git a/Projectiles/Melee/GrandGuardianHoldout.cs b/Projectiles/Melee/GrandGuardianHoldout.cs new file mode 100644 index 0000000000..5bd8af7f40 --- /dev/null +++ b/Projectiles/Melee/GrandGuardianHoldout.cs @@ -0,0 +1,262 @@ +using System; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs.PrimordialWyrm; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class GrandGuardianHoldout : BaseCustomUseStyleProjectile, ILocalizedModType + { + public override int AssignedItemID => ModContent.ItemType(); + + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override string Texture => "CalamityMod/Items/Weapons/Melee/GrandGuardian"; + public override float HitboxOutset => 105; + + public override Vector2 HitboxSize => new Vector2(150, 150); + public override float HitboxRotationOffset => MathHelper.ToRadians(-45); + + public override Vector2 SpriteOrigin => new(0, 124); + public Vector2 mousePos; + public Vector2 aimVel; + public bool doSwing = true; + public bool postSwing = false; + public float fadeIn = 0; + public int useAnim; + public int swingCount; + public bool spawnBoom = true; + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.DamageType = TrueMeleeDamageClass.Instance; + } + public override void OnSpawn(IEntitySource source) + { + Projectile.scale = 1; + Projectile.ai[1] = 1; + base.OnSpawn(source); + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + useAnim = Owner.itemAnimationMax; + + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + + FlipAsSword = Owner.direction == -1 ? true : false; + } + + public override void UseStyle() + { + DrawUnconditionally = false; + + if (CanHit || postSwing) + mousePos = Owner.Center - aimVel; + else + { + mousePos = Owner.Calamity().mouseWorld; + } + + if (CanHit) + fadeIn = MathHelper.Lerp(fadeIn, 1, 0.1f); + else + fadeIn = MathHelper.Lerp(fadeIn, 0, 0.15f); + + + if (!doSwing) + { + spawnBoom = true; + Projectile.numHits = 0; + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + FlipAsSword = Owner.direction == -1 ? true : false; + + doSwing = true; + swingCount++; + } + else + { + if (!CanHit && !postSwing) + { + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + } + else + { + if ((Owner.Center - aimVel).X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + } + + + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(65f), 0.1f); + + if (AnimationProgress < (useAnim / 3)) + { + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + postSwing = false; + if (AnimationProgress == 0) + { + doSwing = false; + Projectile.ai[1] = -Projectile.ai[1]; + } + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction), 0.2f); + } + else + { + float time = (AnimationProgress) - (useAnim / 3); + float timeMax = useAnim - (useAnim / 3); + + if (time == (int)(timeMax * 0.4f)) + { + SoundEngine.PlaySound(SoundID.DD2_MonkStaffSwing with { Volume = 1f, Pitch = -0.2f }, Projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_GhastlyGlaivePierce with { Volume = 1f, Pitch = -0.5f }, Projectile.Center); + } + if ( time > (int)(timeMax * 0.4f) && time < (int)(timeMax * 0.7f)) + { + CanHit = true; + + for (int i = 0; i < 4; i++) + { + Vector2 particleVel = new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(particlePos, -particleVel.RotatedByRandom(0.2f), false, 19, Main.rand.NextFloat(0.5f, 1f), Main.rand.NextBool(4) ? Color.DarkOrchid : Color.DodgerBlue)); + } + } + else + CanHit = false; + + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(MathHelper.Lerp(150f * Projectile.ai[1] * Owner.direction, 120f * -Projectile.ai[1] * Owner.direction, CalamityUtils.ExpInOutEasing(time / timeMax, 1))), + 0.2f); + + if (time >= timeMax) + doSwing = false; + if (time < (int)(timeMax * 0.7f)) + postSwing = true; + + if (CanHit) + { + for (int i = 0; i < 3; i++) + { + bool color = Main.rand.NextBool(); + GenericSparkle sparker = new GenericSparkle(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, color ? Color.Cyan : Color.DarkOrchid, color ? Color.DarkOrchid : Color.Cyan, Main.rand.NextFloat(0.4f, 0.6f), 10, Main.rand.NextFloat(-0.1f, 0.1f), 2.68f); + GeneralParticleHandler.SpawnParticle(sparker); + + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), 278, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 2)); + dust2.scale = Main.rand.NextFloat(0.55f, 0.85f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? Color.Cyan : Color.DarkOrchid; + } + } + } + } + + ArmRotationOffset = MathHelper.ToRadians(-140f); + ArmRotationOffsetBack = MathHelper.ToRadians(-140f); + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (damageDone <= 2 && Projectile.numHits > 0) + Projectile.numHits -= 1; + + if (spawnBoom) + { + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 3, Projectile.knockBack * 0.5f, Projectile.owner); + spawnBoom = false; + } + + SoundStyle fire = new("CalamityMod/Sounds/Item/WulfrumKnifeTileHit2"); + SoundEngine.PlaySound(fire with { Volume = 0.65f, Pitch = -0.6f }, Projectile.Center); + SoundStyle fire2 = new("CalamityMod/Sounds/Item/ExobladeBeamSlash"); + SoundEngine.PlaySound(fire2 with { Volume = 0.35f, Pitch = Main.rand.NextFloat(0.5f, 0.7f) }, Projectile.Center); + + int heal = (int)(MathHelper.Clamp(4 - Projectile.numHits * 2, 1, 4)); + if (Main.player[Main.myPlayer].lifeSteal > 0f) + { + Owner.lifeSteal -= heal; + Owner.statLife += heal; + Owner.HealEffect(heal); + if (Owner.statLife > Owner.statLifeMax2) + Owner.statLife = Owner.statLifeMax2; + } + + int points = 4; + float radians = MathHelper.TwoPi / points; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)).RotatedByRandom(100); + Color useColor = Main.rand.NextBool() ? Color.Cyan : Color.DarkOrchid; + for (int k = 0; k < points; k++) + { + Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f); + Particle spark = new GlowSparkParticle((target.Center + velocity * 7.5f), velocity * 0.5f, false, 11, 0.07f, useColor, new Vector2(1f, 0.4f), true, false); + GeneralParticleHandler.SpawnParticle(spark); + } + + for (int i = 0; i < MathHelper.Clamp(10 - Projectile.numHits * 2, 2, 10); i++) + { + //Particle spark2 = new LineParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), false, 45, Main.rand.NextFloat(0.3f, 1f), Main.rand.NextBool(4) ? Color.DarkOrchid : Color.DodgerBlue); + //GeneralParticleHandler.SpawnParticle(spark2); + if (Main.rand.NextBool(3)) + { + //Particle spark3 = new LineParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), false, 45, Main.rand.NextFloat(0.3f, 1f), Color.Lavender); + //GeneralParticleHandler.SpawnParticle(spark3); + } + + Dust dust2 = Dust.NewDustPerfect(target.Center, 278, new Vector2(12, 12).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.7f)); + dust2.scale = Main.rand.NextFloat(0.55f, 0.85f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? Color.Cyan : Color.DarkOrchid; + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.3f; + int hitsToMinMult = 5; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } + public override bool PreDraw(ref Color lightColor) + { + // Only draw the projectile if the projectile's owner is currently using the item this projectile is attached to. + if ((useAnim > 0 || DrawUnconditionally) && Owner.ItemAnimationActive) + { + Asset tex = ModContent.Request(Texture); + Asset glowTex = ModContent.Request("CalamityMod/Items/Weapons/Melee/GrandGuardianGlow"); + + float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f; + + for (int i = 0; i < 5; i++) + { + Color auraColor = Color.Lerp(Color.DodgerBlue, Color.Cyan, Utils.GetLerpValue(0, 5, i)) * 0.5f * fadeIn; + Texture2D centerTexture = ModContent.Request("CalamityMod/Projectiles/Melee/GrandGuardianGhost").Value; + Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 17f).ToRotationVector2(); + rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 4f) * 0.5f + 1.5f); + Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + rotationalDrawOffset + new Vector2(0, Owner.gfxOffY), centerTexture.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + } + + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + Main.EntitySpriteDraw(glowTex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), glowTex.Frame(1, FrameCount, 0, Frame), Color.White, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(glowTex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + + } + return false; + } + public override void ResetStyle() + { + } + } +} diff --git a/Projectiles/Melee/MajesticGuardGhost.png b/Projectiles/Melee/MajesticGuardGhost.png new file mode 100644 index 0000000000..741e7a88c0 Binary files /dev/null and b/Projectiles/Melee/MajesticGuardGhost.png differ diff --git a/Projectiles/Melee/MajesticGuardHoldout.cs b/Projectiles/Melee/MajesticGuardHoldout.cs new file mode 100644 index 0000000000..791edbb91f --- /dev/null +++ b/Projectiles/Melee/MajesticGuardHoldout.cs @@ -0,0 +1,234 @@ +using System; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs.PrimordialWyrm; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class MajesticGuardHoldout : BaseCustomUseStyleProjectile, ILocalizedModType + { + public override int AssignedItemID => ModContent.ItemType(); + + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override string Texture => "CalamityMod/Items/Weapons/Melee/MajesticGuard"; + public override float HitboxOutset => 105; + + public override Vector2 HitboxSize => new Vector2(140, 140); + public override float HitboxRotationOffset => MathHelper.ToRadians(-45); + + public override Vector2 SpriteOrigin => new(-5, 100); + public Vector2 mousePos; + public Vector2 aimVel; + public bool doSwing = true; + public bool postSwing = false; + public float fadeIn = 0; + public int useAnim; + public int swingCount; + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; + Projectile.DamageType = TrueMeleeDamageClass.Instance; + } + public override void OnSpawn(IEntitySource source) + { + Projectile.scale = 1; + Projectile.ai[1] = 1; + base.OnSpawn(source); + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + useAnim = Owner.itemAnimationMax; + + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + + FlipAsSword = Owner.direction == -1 ? true : false; + } + + public override void UseStyle() + { + DrawUnconditionally = false; + + if (CanHit || postSwing) + mousePos = Owner.Center - aimVel; + else + { + mousePos = Owner.Calamity().mouseWorld; + } + + if (CanHit) + fadeIn = MathHelper.Lerp(fadeIn, 1, 0.1f); + else + fadeIn = MathHelper.Lerp(fadeIn, 0, 0.15f); + + + if (!doSwing) + { + Projectile.numHits = 0; + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + FlipAsSword = Owner.direction == -1 ? true : false; + + doSwing = true; + swingCount++; + } + else + { + if (!CanHit && !postSwing) + { + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + } + else + { + if ((Owner.Center - aimVel).X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + } + + + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(65f), 0.1f); + + if (AnimationProgress < (useAnim / 3)) + { + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + postSwing = false; + if (AnimationProgress == 0) + { + doSwing = false; + Projectile.ai[1] = -Projectile.ai[1]; + } + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction), 0.2f); + } + else + { + float time = (AnimationProgress) - (useAnim / 3); + float timeMax = useAnim - (useAnim / 3); + + if (time == (int)(timeMax * 0.4f)) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/HeavySwing"); + SoundEngine.PlaySound(fire with { Volume = 0.8f, Pitch = 0.55f }, Projectile.Center); + } + if ( time > (int)(timeMax * 0.4f) && time < (int)(timeMax * 0.7f)) + { + CanHit = true; + + for (int i = 0; i < 2; i++) + { + Vector2 particleVel = new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + GeneralParticleHandler.SpawnParticle(new AltLineParticle(particlePos, -particleVel.RotatedByRandom(0.2f), false, 19, Main.rand.NextFloat(0.3f, 0.7f), Main.rand.NextBool(3) ? Color.Silver : Color.Goldenrod)); + } + } + else + CanHit = false; + + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(MathHelper.Lerp(150f * Projectile.ai[1] * Owner.direction, 120f * -Projectile.ai[1] * Owner.direction, CalamityUtils.ExpInOutEasing(time / timeMax, 1))), + 0.2f); + + if (time >= timeMax) + doSwing = false; + if (time < (int)(timeMax * 0.7f)) + postSwing = true; + + if (CanHit) + { + for (int i = 0; i < 2; i++) + { + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), 278, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 2)); + dust2.scale = Main.rand.NextFloat(0.55f, 0.85f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? Color.Silver : Color.Gold; + } + } + } + } + + ArmRotationOffset = MathHelper.ToRadians(-140f); + ArmRotationOffsetBack = MathHelper.ToRadians(-140f); + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (damageDone <= 2 && Projectile.numHits > 0) + Projectile.numHits -= 1; + + SoundStyle fire = new("CalamityMod/Sounds/Item/CursedDaggerThrow"); + SoundEngine.PlaySound(fire with { Volume = 0.65f, Pitch = 0.8f }, Projectile.Center); + SoundStyle fire2 = new("CalamityMod/Sounds/Custom/DefenseDamage"); + SoundEngine.PlaySound(fire2 with { Volume = 0.55f, Pitch = 0.4f }, Projectile.Center); + + int heal = (int)(MathHelper.Clamp(4 - Projectile.numHits * 2, 1, 4)); + if (Main.player[Main.myPlayer].lifeSteal > 0f) + { + Owner.lifeSteal -= heal; + Owner.statLife += heal; + Owner.HealEffect(heal); + if (Owner.statLife > Owner.statLifeMax2) + Owner.statLife = Owner.statLifeMax2; + } + + for (int i = 0; i < MathHelper.Clamp(8 - Projectile.numHits * 2, 2, 8); i++) + { + Particle spark2 = new AltLineParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), false, 40, Main.rand.NextFloat(0.3f, 1f), Main.rand.NextBool(3) ? Color.Gold : Color.DarkGoldenrod); + GeneralParticleHandler.SpawnParticle(spark2); + if (Main.rand.NextBool(3)) + { + Particle spark3 = new AltLineParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), false, 40, Main.rand.NextFloat(0.3f, 1f), Color.Silver); + GeneralParticleHandler.SpawnParticle(spark3); + } + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.3f; + int hitsToMinMult = 5; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } + public override bool PreDraw(ref Color lightColor) + { + // Only draw the projectile if the projectile's owner is currently using the item this projectile is attached to. + if ((useAnim > 0 || DrawUnconditionally) && Owner.ItemAnimationActive) + { + Asset tex = ModContent.Request(Texture); + Asset glowTex = ModContent.Request("CalamityMod/Items/Weapons/Melee/MajesticGuardGlow"); + + float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f; + + for (int i = 0; i < 5; i++) + { + Color auraColor = Color.Lerp(Color.Silver, Color.White, Utils.GetLerpValue(0, 5, i)) * 0.4f * fadeIn; + Texture2D centerTexture = ModContent.Request("CalamityMod/Projectiles/Melee/MajesticGuardGhost").Value; + Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 17f).ToRotationVector2(); + rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 4f) * 0.5f + 1.5f); + Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + rotationalDrawOffset + new Vector2(0, Owner.gfxOffY), centerTexture.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + } + + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + Main.EntitySpriteDraw(glowTex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), glowTex.Frame(1, FrameCount, 0, Frame), Color.White, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(glowTex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + + } + return false; + } + public override void ResetStyle() + { + } + } +} diff --git a/Projectiles/Melee/RainbowBoom.cs b/Projectiles/Melee/RainbowBoom.cs deleted file mode 100644 index 504a9b0f49..0000000000 --- a/Projectiles/Melee/RainbowBoom.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class RainbowBoom : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 100; - Projectile.height = 100; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.timeLeft = 20; - Projectile.DamageType = DamageClass.Melee; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 5; - } - - public override void AI() - { - float projTimer = 25f; - if (Projectile.ai[0] > 180f) - projTimer -= (Projectile.ai[0] - 180f) / 2f; - - if (projTimer <= 0f) - { - projTimer = 0f; - Projectile.Kill(); - } - - projTimer *= 0.7f; - Projectile.ai[0] += 4f; - int timerCounter = 0; - while ((float)timerCounter < projTimer) - { - float rando1 = (float)Main.rand.Next(-30, 31); - float rando2 = (float)Main.rand.Next(-30, 31); - float rando3 = (float)Main.rand.Next(9, 27); - float randoAdjuster = (float)Math.Sqrt((double)(rando1 * rando1 + rando2 * rando2)); - randoAdjuster = rando3 / randoAdjuster; - rando1 *= randoAdjuster; - rando2 *= randoAdjuster; - int rainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[rainbow].noGravity = true; - Main.dust[rainbow].position.X = Projectile.Center.X; - Main.dust[rainbow].position.Y = Projectile.Center.Y; - Main.dust[rainbow].position.X += (float)Main.rand.Next(-10, 11); - Main.dust[rainbow].position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[rainbow].velocity.X = rando1; - Main.dust[rainbow].velocity.Y = rando2; - timerCounter++; - } - } - } -} diff --git a/Projectiles/Rogue/SupernovaBoom.cs b/Projectiles/Rogue/SupernovaBoom.cs index 843a0c0e48..c23acdda89 100644 --- a/Projectiles/Rogue/SupernovaBoom.cs +++ b/Projectiles/Rogue/SupernovaBoom.cs @@ -181,7 +181,7 @@ namespace CalamityMod.Projectiles.Rogue { NPC target = Main.npc[i]; bool isAPillar = target.type == NPCID.LunarTowerSolar || target.type == NPCID.LunarTowerVortex || target.type == NPCID.LunarTowerNebula || target.type == NPCID.LunarTowerStardust; - if (!isAPillar && !target.boss && target.IsAnEnemy(true, true) && !CalamityPlayer.areThereAnyDamnBosses && target.CanBeChasedBy(Projectile, false)) + if (!isAPillar && !target.boss && target.IsAnEnemy(true, true, false) && !CalamityPlayer.areThereAnyDamnBosses && target.CanBeChasedBy(Projectile, false)) { if (Vector2.Distance(target.Center, Projectile.Center) > 40 && Vector2.Distance(target.Center, Projectile.Center) < 600) target.Center += target.Center.DirectionTo(Projectile.Center).SafeNormalize(Vector2.UnitX) * 22; diff --git a/Projectiles/Rogue/SupernovaStealthBoom.cs b/Projectiles/Rogue/SupernovaStealthBoom.cs index aaa399a2cc..c4f0dc32a3 100644 --- a/Projectiles/Rogue/SupernovaStealthBoom.cs +++ b/Projectiles/Rogue/SupernovaStealthBoom.cs @@ -306,7 +306,7 @@ namespace CalamityMod.Projectiles.Rogue { NPC target = Main.npc[i]; bool isAPillar = target.type == NPCID.LunarTowerSolar || target.type == NPCID.LunarTowerVortex || target.type == NPCID.LunarTowerNebula || target.type == NPCID.LunarTowerStardust; - if (!isAPillar && !target.boss && target.IsAnEnemy(true, true) && target.CanBeChasedBy(Projectile, false)) + if (!isAPillar && !target.boss && target.IsAnEnemy(true, true, false) && target.CanBeChasedBy(Projectile, false)) { if (target != null && !CalamityPlayer.areThereAnyDamnBosses) { diff --git a/Projectiles/Typeless/LeviAmberDash.cs b/Projectiles/Typeless/LeviAmberDash.cs index 627a1b1aad..c427146482 100644 --- a/Projectiles/Typeless/LeviAmberDash.cs +++ b/Projectiles/Typeless/LeviAmberDash.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { bool isAPillar = target.type == NPCID.LunarTowerSolar || target.type == NPCID.LunarTowerVortex || target.type == NPCID.LunarTowerNebula || target.type == NPCID.LunarTowerStardust; - if (!isAPillar && !target.boss && target.IsAnEnemy(true, true) && !CalamityPlayer.areThereAnyDamnBosses && target.CanBeChasedBy(Projectile, false)) + if (!isAPillar && !target.boss && target.IsAnEnemy(true, true, false) && !CalamityPlayer.areThereAnyDamnBosses && target.CanBeChasedBy(Projectile, false)) { target.velocity.Y += -1.8f; target.velocity.X += 4.2f * Owner.direction; diff --git a/Utilities/NPCUtils.cs b/Utilities/NPCUtils.cs index 3fe3699c27..85a2d5ca31 100644 --- a/Utilities/NPCUtils.cs +++ b/Utilities/NPCUtils.cs @@ -247,7 +247,7 @@ namespace CalamityMod // // TODO -- Use this function EVERYWHERE that target validity is checked, not just for Proximity Rage. // The easiest way to find locations this should be used is checks for whether something is statue spawned. - public static bool IsAnEnemy(this NPC npc, bool allowStatues = true, bool checkDead = true) + public static bool IsAnEnemy(this NPC npc, bool allowStatues = true, bool checkDead = true, bool checkDamage = true) { // Null, inactive, town NPCs, and friendlies are right out. if (npc is null || (!npc.active && (!checkDead || npc.life > 0)) || npc.townNPC || npc.friendly) @@ -260,7 +260,7 @@ namespace CalamityMod // "Non-enemies" (e.g. butterflies or projectile enemies) with near zero max health, // or anything but the strongest enemies with no contact damage (e.g. Celestial Pillars, Providence) // do not generate rage. - if (npc.lifeMax <= BalancingConstants.TinyHealthThreshold || (npc.defDamage <= BalancingConstants.TinyDamageThreshold && npc.lifeMax <= BalancingConstants.NoContactDamageHealthThreshold)) + if (npc.lifeMax <= BalancingConstants.TinyHealthThreshold || ((npc.defDamage <= BalancingConstants.TinyDamageThreshold && checkDamage) && npc.lifeMax <= BalancingConstants.NoContactDamageHealthThreshold)) return false; // Also explicitly exclude dummies and anything with a ridiculous health pool (dummies from Fargo's for example). if (npc.type == NPCID.TargetDummy || npc.type == NPCType() || npc.lifeMax > BalancingConstants.UnreasonableHealthThreshold)