From 7647ee021cdf2d3e9ef6adb360a3790ac9df0aeb Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Fri, 25 Apr 2025 15:59:21 -0500 Subject: [PATCH 01/12] Bloodstone reworks pt1 (needs balancing) Reworks: The Mutilator Arterial Assault Sanguine Flare Changed lifesteal to use new Bloodstone lifesteal system: Dragonblood Disgorger Bloodsoaked Crasher --- Items/Weapons/Magic/SanguineFlare.cs | 9 +- Items/Weapons/Melee/TheMutilator.cs | 84 ++-- Items/Weapons/Ranged/ArterialAssault.cs | 55 +- ...Mods.CalamityMod.Items.Weapons.Magic.hjson | 7 +- ...Mods.CalamityMod.Items.Weapons.Melee.hjson | 5 +- ...ods.CalamityMod.Items.Weapons.Ranged.hjson | 5 +- ...Mods.CalamityMod.Items.Weapons.Rogue.hjson | 5 +- ...ods.CalamityMod.Items.Weapons.Summon.hjson | 3 +- ...Mods.CalamityMod.Projectiles.Healing.hjson | 1 + .../Mods.CalamityMod.Projectiles.Melee.hjson | 1 + .../BaseCustomMeleeSwingProjectile.cs | 476 ++++++++++++++++++ Projectiles/CalamityGlobalProjectile.cs | 8 + Projectiles/Healing/BloodstoneHealOrb.cs | 155 ++++++ Projectiles/Magic/SanguineFlareProj.cs | 152 ++++-- .../Melee/TheMutilatorHoldoutProjectile.cs | 104 ++++ Projectiles/Ranged/BloodfireArrowProj.cs | 25 +- Projectiles/Rogue/BloodsoakedCrashax.cs | 22 +- Projectiles/Summon/BloodSpit.cs | 6 +- 18 files changed, 973 insertions(+), 150 deletions(-) create mode 100644 Projectiles/BaseProjectiles/BaseCustomMeleeSwingProjectile.cs create mode 100644 Projectiles/Healing/BloodstoneHealOrb.cs create mode 100644 Projectiles/Melee/TheMutilatorHoldoutProjectile.cs diff --git a/Items/Weapons/Magic/SanguineFlare.cs b/Items/Weapons/Magic/SanguineFlare.cs index bc7827c338..28bd1045a8 100644 --- a/Items/Weapons/Magic/SanguineFlare.cs +++ b/Items/Weapons/Magic/SanguineFlare.cs @@ -21,12 +21,13 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 56; Item.height = 60; - Item.damage = 143; + Item.damage = 300; Item.DamageType = DamageClass.Magic; Item.mana = 22; Item.useTime = 25; Item.useAnimation = 25; Item.useStyle = ItemUseStyleID.Shoot; + Item.channel = true; Item.noMelee = true; Item.knockBack = 8f; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; @@ -39,11 +40,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - for (int i = 0; i < 7; i++) - { - Vector2 spreadVelocity = velocity.RotatedByRandom(MathHelper.ToRadians(5f)) * Main.rand.NextFloat(0.8f, 1.2f); - Projectile.NewProjectile(source, position, spreadVelocity, type, damage, knockback, Main.myPlayer); - } + velocity *= 0; return true; // Fires one directly with no randomness, totaling 8 projectiles } diff --git a/Items/Weapons/Melee/TheMutilator.cs b/Items/Weapons/Melee/TheMutilator.cs index 0c217455a0..6fc633fc4a 100644 --- a/Items/Weapons/Melee/TheMutilator.cs +++ b/Items/Weapons/Melee/TheMutilator.cs @@ -1,8 +1,11 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -10,68 +13,73 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class TheMutilator : ModItem, ILocalizedModType + public class TheMutilator : BaseSwordHoldoutItem, ILocalizedModType { + public static int MaximumCharge = 10; + public int Charge = 0; + + public int DecayTimer = 0; public new string LocalizationCategory => "Items.Weapons.Melee"; + public override int ProjectileType => ModContent.ProjectileType(); public override void SetDefaults() { Item.width = 90; Item.height = 90; Item.damage = 483; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 18; + Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 18; - Item.useTurn = true; + Item.useTime = 30; Item.knockBack = 8f; Item.UseSound = SoundID.Item1; - Item.autoReuse = true; Item.shootSpeed = 10f; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); + base.SetDefaults(); } - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 240); - if (target.life <= (target.lifeMax * 0.2f)) + public override void ModifyWeaponDamage(Player player, ref StatModifier damage) + { + damage *= 1 + Charge / 7f; + } + public override void UpdateInventory(Player player) + { + if (DecayTimer > 0) DecayTimer--; + else { - if (!CalamityPlayer.areThereAnyDamnBosses || Main.rand.NextBool()) + if (Charge > 0) { - int heartDrop = CalamityPlayer.areThereAnyDamnBosses ? 1 : Main.rand.Next(1, 3); - for (int i = 0; i < heartDrop; i++) - { - Item.NewItem(player.GetSource_OnHit(target), (int)target.position.X, (int)target.position.Y, target.width, target.height, 58, 1, false, 0, false, false); - } - } - SoundEngine.PlaySound(SoundID.Item14, target.Center); - target.position.X += target.width / 2; - target.position.Y += target.height / 2; - target.position.X -= target.width / 2; - target.position.Y -= target.height / 2; - for (int i = 0; i < 30; i++) - { - int bloodDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.Blood, 0f, 0f, 100, default, 2f); - Main.dust[bloodDust].velocity *= 3f; - if (Main.rand.NextBool()) - { - Main.dust[bloodDust].scale = 0.5f; - Main.dust[bloodDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - } - for (int j = 0; j < 50; j++) - { - int bloodDust2 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.Blood, 0f, 0f, 100, default, 3f); - Main.dust[bloodDust2].noGravity = true; - Main.dust[bloodDust2].velocity *= 5f; - bloodDust2 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.Blood, 0f, 0f, 100, default, 2f); - Main.dust[bloodDust2].velocity *= 2f; + Charge--; + DecayTimer = 60; } } } + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + float fill = Charge / (float)MaximumCharge; + if (fill <= 0) + return; + + float barScale = 3f; + + var barBG = ModContent.Request("CalamityMod/UI/MiscTextures/GenericBarBack").Value; + var barFG = ModContent.Request("CalamityMod/UI/MiscTextures/GenericBarFront").Value; + + Vector2 barOrigin = barBG.Size() * 0.5f; + float yOffset = 44f; + Vector2 drawPos = position + Vector2.UnitY * scale * (frame.Height - yOffset); + Rectangle frameCrop = new Rectangle(0, 0, (int)((fill) * barFG.Width), barFG.Height); + Color colorBG = Color.Crimson; + Color colorFG = Color.Lerp(Color.OrangeRed, Color.DarkOrange, fill); + + spriteBatch.Draw(barBG, drawPos, null, colorBG, 0f, barOrigin, scale * barScale, 0f, 0f); + spriteBatch.Draw(barFG, drawPos, frameCrop, colorFG, 0f, barOrigin, scale * barScale, 0f, 0f); + } + + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Ranged/ArterialAssault.cs b/Items/Weapons/Ranged/ArterialAssault.cs index 9a37c667b7..1a6651b629 100644 --- a/Items/Weapons/Ranged/ArterialAssault.cs +++ b/Items/Weapons/Ranged/ArterialAssault.cs @@ -1,6 +1,8 @@ using System; +using CalamityMod.Items.Ammo; using CalamityMod.Items.Materials; using CalamityMod.Projectiles; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; @@ -17,10 +19,10 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 44; Item.height = 100; - Item.damage = 110; + Item.damage = 200; Item.DamageType = DamageClass.Ranged; - Item.useTime = 3; - Item.useAnimation = 15; + Item.useTime = 6; + Item.useAnimation = 40; Item.reuseDelay = 10; Item.useLimitPerAnimation = 5; Item.useStyle = ItemUseStyleID.Shoot; @@ -37,49 +39,16 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - float arrowSpeed = Item.shootSpeed; - Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); - float mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; - float mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (player.gravDir == -1f) - { - mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y; - } - float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f)) - { - mouseXDist = (float)player.direction; - mouseYDist = 0f; - mouseDistance = arrowSpeed; - } - else - { - mouseDistance = arrowSpeed / mouseDistance; - } - realPlayerPos = new Vector2(player.position.X + (float)player.width * 0.5f + (-(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - realPlayerPos.X = (realPlayerPos.X + player.Center.X) / 2f; - realPlayerPos.Y -= 100f; - mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; - mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (mouseYDist < 0f) - { - mouseYDist *= -1f; - } - if (mouseYDist < 20f) - { - mouseYDist = 20f; - } - mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - mouseDistance = arrowSpeed / mouseDistance; - mouseXDist *= mouseDistance; - mouseYDist *= mouseDistance; - Vector2 arrowVel = new Vector2(mouseXDist, mouseYDist); - - Projectile shotArrow = Projectile.NewProjectileDirect(source, realPlayerPos, arrowVel, type, damage, knockback, player.whoAmI); + position += velocity.SafeNormalize(Vector2.Zero).RotatedByRandom(1.8f) * 64; + velocity = position.DirectionTo(Main.MouseWorld) * velocity.Length()*2; + type = ModContent.ProjectileType(); + Projectile shotArrow = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback, player.whoAmI); shotArrow.noDropItem = true; shotArrow.tileCollide = false; - shotArrow.Calamity().conditionalHomingRange = 300f; + (shotArrow.ModProjectile as BloodfireArrowProj).DisableEffects = true; + shotArrow.Calamity().conditionalHomingRange = 175f; + shotArrow.Calamity().BloodstoneOrbValue = 1; return false; } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index b6a8a7aef9..66a90cae37 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson @@ -749,7 +749,12 @@ SandstreamScepter: { SanguineFlare: { DisplayName: Sanguine Flare - Tooltip: Fires a blast of sanguine flares that drain enemy life + Tooltip: + ''' + Charges up a sanguine flare that gains power over time + When striking an enemy, this flare causes a bloodsplosion and splits into blood orbs + Picking up these blood orbs reduces the duration of Potion Sickness + ''' } SeethingDischarge: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index fbba76be1c..51182e117f 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -1359,8 +1359,9 @@ TheMutilator: { DisplayName: The Mutilator Tooltip: ''' - Striking an enemy below 20% life will trigger a bloodsplosion - Bloodsplosions cause hearts to drop that can be picked up to heal you + Striking enemies empowers The Mutilator, increasing its damage + At full charge, striking enemies causes a blood orb explosion + Picking up these blood orbs reduces the duration of Potion Sickness ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index d4036cd346..5040e2be9c 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -113,8 +113,9 @@ ArterialAssault: { DisplayName: Arterial Assault Tooltip: ''' - Fires a chain of 5 arrows from the sky - All arrows will rapidly home in on nearby enemies + Fires a group of 5 homing blood arrows + These blood arrows burst into blood orbs upon striking an enemy + Picking up these blood orbs reduces the duration of Potion Sickness ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index 2d5549e4c7..0f45c1dca0 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -85,8 +85,9 @@ BloodsoakedCrasher: { ''' Throws a bloody axe that is affected by gravity and can bounce twice The axe speeds up over time, but will slow down upon hitting an enemy - Heals on enemy hits - Stealth strikes spawn homing blood on enemy hits + Spews blood orbs upon enemy hits + Picking up these blood orbs reduces the duration of Potion Sickness + Stealth strikes spawn homing blood bolts on hit ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson index dff9c92674..b9d505cc19 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -292,7 +292,8 @@ DragonbloodDisgorger: { Tooltip: ''' Summons a skeletal dragon and her two children - Baby spits passively heal the player + Baby spits burst into blood orbs upon hitting an enemy + Picking up these blood orbs reduces the duration of Potion Sickness Requires 6 minion slots to be summoned There can only be one family at a time ''' diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Healing.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Healing.hjson index 6f207a3da2..211c3eb65d 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Healing.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Healing.hjson @@ -19,3 +19,4 @@ RoyalHeal.DisplayName: Heal ShinobiHealOrb.DisplayName: Blue Healing Orb SilvaOrb.DisplayName: Silva Orb TransfusionTrail.DisplayName: Heal +BloodstoneHealOrb.DisplayName: Bloodstone Heal Orb diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index 72ae489a01..c1cd99f172 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -306,3 +306,4 @@ WulfrumScrew.DisplayName: Wulfrum Screw WulfrumScrewdriverProj.DisplayName: Wulfrum Screwdriver YinYoDark.DisplayName: Dark Shard YinYoLight.DisplayName: Light Shard +MutilatorSwordProj.DisplayName: Mutilator Sword Proj diff --git a/Projectiles/BaseProjectiles/BaseCustomMeleeSwingProjectile.cs b/Projectiles/BaseProjectiles/BaseCustomMeleeSwingProjectile.cs new file mode 100644 index 0000000000..7a4991b567 --- /dev/null +++ b/Projectiles/BaseProjectiles/BaseCustomMeleeSwingProjectile.cs @@ -0,0 +1,476 @@ +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Graphics.Primitives; +using CalamityMod.NPCs; +using CalamityMod.Systems.Collections; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent.Prefixes; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.BaseProjectiles +{ + + public class BaseSwordHoldoutPlayer : ModPlayer + { + /// + /// Used to detect what swing a weapon is doing. + /// + public int swingNum = 0; + + } + /// + /// Manages all the required settings for custom sword holdouts done using BaseSwordHoldoutProjectile + /// + public abstract class BaseSwordHoldoutItem : ModItem + { + public virtual int ProjectileType { get; set; } + public virtual bool SizeModifiers { get; set; } = true; + + public virtual bool RClickAutoswing { get; set; } = false; + + public override void SetStaticDefaults() + { + if (RClickAutoswing) ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + } + + public override bool MeleePrefix() + { + return SizeModifiers; + } + public override void SetDefaults() + { + Item.noMelee = true; + Item.noUseGraphic = true; + Item.shoot = ProjectileType; + Item.autoReuse = true; + Item.useTurn = false; + Item.useStyle = ItemUseStyleID.Shoot; + if (SizeModifiers) PrefixLegacy.ItemSets.SwordsHammersAxesPicks[Item.type] = true; + } + public override bool CanUseItem(Player player) + { + if (player.itemTime > 0) + { + return false; + } + for (int i = 0; i < 1000; i++) + { + var proj = Main.projectile[i]; + if (proj.type == ProjectileType && proj.owner == player.whoAmI && proj.active) + { + return false; + } + + } + return base.CanUseItem(player); + } + } + + [PierceResistException] + //Doze 24apr2025 - Not a child of BaseCustomUseStyleProjectile because this doesn't use any of it's functionality. Comes from my melee rework mod. + public abstract class BaseSwordHoldoutProjectile : ModProjectile + { + #region Overrideable Fields + /// + /// The width, in degrees, of the sword swing. + /// Defaults to 180 + /// + public virtual int swingWidth { get; set; } = 180; + /// + /// How many frames the sword swing should take. + /// Defaults to 20 + /// + public virtual int swingTime { get; set; } = 20; + /// + /// If the swing should alternate directions each use. + /// Defaults to true + /// + public virtual bool AlternateSwings { get; set; } = true; + /// + /// How far the held sword should be offset from the player + /// Defaults to 0 + /// + public virtual int OffsetDistance { get; set; } = 0; + /// + /// What item this projectile uses as a base. + /// + public virtual Item BaseItem { get; set; } + /// + /// Whether or not this projectile uses a base item at all. + /// Defaults to true. + /// + public virtual bool UsesBaseItem { get; set; } = true; + + /// + /// Length of after-image trail left by the projectile. + /// Defaults to 0 + /// + public virtual int AfterImageLength { get; set; } = 0; + + /// + /// Whether or not this should get melee speed bonuses + /// Defaults to TRUE + /// + public virtual bool useMeleeSpeed { get; set; } = true; + + /// + /// Whether or not this should get melee size bonuses (Titan Glove) + /// Defaults to TRUE + /// + public virtual bool useMeleeSize { get; set; } = true; + /// + /// Array of three colors used for the built-in trail drawing code. + /// Defaults to White, Black, Green. + /// + public virtual Color[] trailColors { get; set; } = [Color.White, Color.Black, Color.Green]; + + /// + /// Whether or not to draw a trail when swung. + /// + public virtual bool drawSwordTrail { get; set; } = false; + /// + /// How far the trail should be offset from the center of the projectile. Use to draw trail at sword tip + /// Defaults to 25 + /// + public virtual float trailOffset { get; set; } = 25; + /// + /// Length of the trail in frames + /// Defaults to 25 + /// + public virtual int trailLength { get; set; } = 25; + + /// + /// How long before the weapon should begin it's actual swing once used + /// + public virtual int StartupTime { get; set; } = 0; + /// + /// How long the weapon should "cool down" after swinging before ending the item use + /// + public virtual int CooldownTime { get; set; } = 0; + /// + /// Speed at which the projectile should rotate to match the mouse angle during StartupTime. + /// Set to 0 to disable. + /// Defaults to 0.5f + /// + public virtual float RotateInStartup { get; set; } = 0.5f; + + #endregion + + #region Fields + + /// + /// Angle of the swing. By default, gets set to mouse angle. Can be set in Spawn(IEntitySource) for fixed angles. + /// + public Vector2 angle { get; set; } = Vector2.Zero; + /// + /// Internal timer for the projectile's entire lifespan + /// + public int timer { get; set; } = 0; + + /// + /// Internal timer for the projectile's swing animation + /// + internal int swingTimer = 0; + + public static Asset TrailTexture; + + public float baseScale; + /// + /// Old weapon scales used to track for trail drawing + /// + public List oldScale = new List(); + List oldProjectileRot = new List { }; + List oldProjectilePos = new List { }; + + internal int ExistsTime = 20; + #endregion + + #region Overridable Methods + /// + /// Happens after movement but before timer increases. Use as to not cancel the default AI behavior. + /// + public virtual void AdditionalAI() { } + /// + /// happens after OnSpawn. Use as not to cancel the default OnSpawn behavior. + /// + /// + public virtual void Spawn(IEntitySource source) { } + /// + /// happens after SetDefaults. Use as not to cancel default SetDefaults behavior. + /// + public virtual void Defaults() { } + /// + /// Returns the offset from the centerpoint in radians. Automatically will be inverted if AlternateSwings is enabled. + /// + /// + public virtual float SwingFunction() + { + return MathHelper.ToRadians(MathHelper.SmoothStep(-swingWidth / 2, swingWidth / 2, swingTimer / (float)swingTime)); + } + /// + /// The function for the width of the trail + /// + /// + /// + public virtual float trailWidth(float completion) + { + return MathHelper.Lerp(30, 0, completion); + } + + /// + /// The function for the color of the trail + /// + /// + /// + public virtual Color trailColor(float completion) + { + return Color.Black; + } + #endregion + + #region Overrides + public override void SetStaticDefaults() + { + ProjectileDestroyExceptionsList.List.Add(Projectile.type); + } + /// + /// DO NOT OVERRIDE IN MOST SITUATIONS + /// use Defaults() instead. + /// That will set defaults after everything is set in the base projectile. + /// + public override void SetDefaults() + { + Projectile.timeLeft = swingTime * 2; + if (UsesBaseItem) + { + Projectile.width = BaseItem.width; + Projectile.height = BaseItem.height; + } + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.localNPCHitCooldown = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.extraUpdates = 0; + Projectile.aiStyle = -2; + Projectile.DamageType = ModLoader.GetMod("CalamityMod").Find("TrueMeleeDamageClass"); + Projectile.tileCollide = false; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 100; + Defaults(); + + + } + /// + /// DO NOT OVERRIDE IN MOST SITUATIONS + /// use Spawn(IEntitySource) instead + /// That will run spawn code in the proper timing. + /// + public override void OnSpawn(IEntitySource source) + { + var player = Main.player[Projectile.owner]; + angle = (player.Center - Main.MouseWorld).SafeNormalize(Vector2.One); + Projectile.velocity = Vector2.Zero; + if (angle.X < 0) + { + player.direction = 1; + Projectile.spriteDirection = 1 * (int)player.gravDir; + } + else + { + player.direction = -1; + Projectile.spriteDirection = -1 * (int)player.gravDir; + } + swingTime = Main.player[Projectile.owner].HeldItem.useTime; + Spawn(source); + if (useMeleeSpeed) + { + var speed = Main.player[Projectile.owner].GetAttackSpeed(); + if (speed > 3f) + speed = 3f; + + if (speed != 0f) + speed = 1f / speed; + + swingTime = (int)(swingTime * speed); + if (swingTime < 1) + { + swingTime = 1; + } + StartupTime = (int)(StartupTime * speed); + CooldownTime = (int)(CooldownTime * speed); + } + if (useMeleeSize) + { + if (player.meleeScaleGlove) Projectile.scale *= 1.1f; + Projectile.scale *= player.HeldItem.scale; + } + baseScale = Projectile.scale; + ExistsTime = swingTime + StartupTime + CooldownTime; + Projectile.timeLeft = ExistsTime * 2; + } + + /// + /// DO NOT OVERRIDE IN MOST SITUATIONS + /// use AdditionalAI() instead + /// That will run AI code at the right time. + /// + public override void AI() + { + var player = Main.player[Projectile.owner]; + var modplayer = player.GetModPlayer(); + float adust = MathHelper.ToRadians(45 + 180); + if (timer < StartupTime || timer > StartupTime + swingTime) + { + angle = Vector2.Lerp(angle, (player.Center - Main.MouseWorld).SafeNormalize(Vector2.One), RotateInStartup); + if (angle.X < 0) + { + player.direction = 1; + Projectile.spriteDirection = 1 * (int)player.gravDir; + } + else + { + player.direction = -1; + Projectile.spriteDirection = -1 * (int)player.gravDir; + } + } + if (Projectile.spriteDirection == -1) + { + adust = MathHelper.ToRadians(-45); + } + var armCenter = player.Center - new Vector2(5 * player.direction, 2); + if (AfterImageLength > 0) + { + oldProjectileRot.Add(Projectile.rotation); + oldProjectilePos.Add(Projectile.Center); + if (oldProjectileRot.Count > AfterImageLength) + { + oldProjectileRot.RemoveAt(0); + oldProjectilePos.RemoveAt(0); + } + } + var angle2 = (AlternateSwings && (modplayer.swingNum % 2 == 1 ? false : true) ? SwingFunction() : -SwingFunction()); + Projectile.Center = armCenter - (angle * OffsetDistance * (1 + (Projectile.scale - 1) * 0.75f)).RotatedBy(Projectile.spriteDirection * angle2); + Projectile.rotation = angle.RotatedBy(Projectile.spriteDirection * angle2).ToRotation() + adust; + AdditionalAI(); + oldScale.Insert(0, Projectile.scale); + + player.itemTime = ExistsTime + 1 - timer; + if (timer > ExistsTime) + { + Projectile.Kill(); + player.itemTime = 0; + } + timer++; + if (timer >= StartupTime && timer < StartupTime + swingTime) + { + swingTimer++; + } + var armDir = armCenter - Projectile.Center; + armDir.Y *= player.gravDir; + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, armDir.ToRotation() + MathHelper.ToRadians(90)); + } + public override bool PreDraw(ref Color lightColor) + { + + var player = Main.player[Projectile.owner]; + var modplayer = player.GetModPlayer(); + if (AfterImageLength > 0) + { + Texture2D texture = ModContent.Request(Texture).Value; + for (int i = 0; i < oldProjectileRot.Count; i++) + { + var col = Projectile.Opacity * (i / (float)AfterImageLength) * 0.1f; + if (Projectile.spriteDirection == 1) + { + Main.EntitySpriteDraw(texture, oldProjectilePos[i] - Main.screenPosition, null, Color.White * col, oldProjectileRot[i], texture.Size() / 2, 1, SpriteEffects.None, 0); + } + else + { + Main.EntitySpriteDraw(texture, oldProjectilePos[i] - Main.screenPosition, null, Color.White * col, oldProjectileRot[i], texture.Size() / 2, 1, SpriteEffects.FlipHorizontally, 0); + } + } + } + if (drawSwordTrail && timer >= StartupTime && timer <= StartupTime + swingTime) + { + Main.spriteBatch.EnterShaderRegion(); + if (TrailTexture == null) + { + TrailTexture = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/VoronoiShapes", (AssetRequestMode)2); + } + Vector2 trailOffset = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() + Projectile.Size * 0.5f; + GameShaders.Misc["CalamityMod:ExobladeSlash"].SetShaderTexture(TrailTexture); + + GameShaders.Misc["CalamityMod:ExobladeSlash"].UseColor(trailColors[0]); + + GameShaders.Misc["CalamityMod:ExobladeSlash"].UseSecondaryColor(trailColors[1]); + + GameShaders.Misc["CalamityMod:ExobladeSlash"].Shader.Parameters["fireColor"].SetValue(trailColors[2].ToVector3()); + + GameShaders.Misc["CalamityMod:ExobladeSlash"].Shader.Parameters["flipped"].SetValue((AlternateSwings && modplayer.swingNum % 2 == 1) ^ Projectile.spriteDirection == -1 ? false : true); + GameShaders.Misc["CalamityMod:ExobladeSlash"].Apply(); + + var positionsToUse = Projectile.oldPos.Take(trailLength).ToArray(); + for (var i = 0; i < positionsToUse.Length; i++) + { + if (i >= timer) continue; + positionsToUse[i] += (Projectile.oldRot[i] - MathHelper.PiOver4 * (Projectile.spriteDirection == -1 ? 3 : 1)).ToRotationVector2() * this.trailOffset * oldScale[i]; + } + PrimitiveRenderer.RenderTrail(positionsToUse, new(trailWidth, trailColor, (_) => trailOffset, shader: GameShaders.Misc["CalamityMod:ExobladeSlash"]), 25); + Main.spriteBatch.ExitShaderRegion(); + + Main.player[Projectile.owner].heldProj = Projectile.whoAmI; + } + Main.player[Projectile.owner].heldProj = Projectile.whoAmI; + return true; + } + public override void ModifyDamageHitbox(ref Rectangle hitbox) + { + var center = hitbox.Center.ToVector2(); + hitbox.Height = (int)(Projectile.height * Projectile.scale); + hitbox.Width = (int)(Projectile.width * Projectile.scale); + hitbox.Location = (center - new Vector2(hitbox.Width / 2, hitbox.Height / 2)).ToPoint(); + + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.HitDirectionOverride = ((Main.player[Projectile.owner].DirectionTo(target.Center)).X >= 0 ? 1 : -1); + } + #endregion + + #region Helper Methods + /// + /// Spawns projectiles from the sword swing, automatically spacing them out on the if an amount is set. + /// + /// + /// Velocity of the projectile. Automatically converted into a Vector2 in the direction of swing. + /// The modifier from the source projectile's damage for this projectile + /// The amount of projectiles for the sword to shoot. If set, it will space out those projectiles evenly. If unset, will force a shot. + /// + /// + public void shootCheck(int type = 0, float velocity = 1, float damagemod = 1, int amount = 0, int negate = 0, int ai0 = 0) + { + if (negate == 0) + { + negate = Projectile.spriteDirection; + } + if (amount == 0) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.rotation + negate * MathHelper.ToRadians(45 - negate * 90)).ToRotationVector2() * velocity, type, (int)(Projectile.damage * damagemod), Projectile.knockBack, Projectile.owner, ai0); + return; + } + amount += 1; + if (timer % (swingTime / amount) == 0 && timer > 0 && timer < swingTime - swingTime / amount / 2) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.rotation + negate * MathHelper.ToRadians(45 - negate * 90)).ToRotationVector2() * velocity, type, (int)(Projectile.damage * damagemod), Projectile.knockBack, Projectile.owner, ai0); + } + } + #endregion + } + +} diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 4d91d08a39..cf00086d09 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -19,6 +19,7 @@ using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.PlagueEnemies; using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.Healing; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; @@ -282,6 +283,8 @@ namespace CalamityMod.Projectiles /// public float UpdatePriority = 0f; + public int BloodstoneOrbValue = 0; + #region On Spawn public override void OnSpawn(Projectile projectile, IEntitySource source) @@ -4222,6 +4225,11 @@ namespace CalamityMod.Projectiles #region On Hit NPC public override void OnHitNPC(Projectile projectile, NPC target, NPC.HitInfo hit, int damageDone) { + for (var i = 0; i < BloodstoneOrbValue; i++) + { + Projectile.NewProjectile(projectile.GetSource_OnHit(target), projectile.Center, projectile.velocity.SafeNormalize(Vector2.Zero) * Math.Min(((projectile.velocity.Length() * projectile.MaxUpdates) / 4f), 4f) * Main.rand.NextFloat(0.75f, 1.25f), ModContent.ProjectileType(), 1, 0f, Main.player[projectile.owner].whoAmI); + + } // Hyperius Overflow if (projectile.type != ProjectileType() && projectile.type != ProjectileType() && projectile.type != ProjectileType() && projectile.type != ProjectileType() && target.Calamity().hyperiusMarked) { diff --git a/Projectiles/Healing/BloodstoneHealOrb.cs b/Projectiles/Healing/BloodstoneHealOrb.cs new file mode 100644 index 0000000000..f87cc69824 --- /dev/null +++ b/Projectiles/Healing/BloodstoneHealOrb.cs @@ -0,0 +1,155 @@ +using System; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Healing +{ + public class BloodstoneHealOrb : ModProjectile, ILocalizedModType //Modified copy from SanguineHealOrb + { + public new string LocalizationCategory => "Projectiles.Healing"; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public int target = -1; + public ref int heal => ref Projectile.damage; + + public int spawnCooldown = 60; //how many frames must pass before it can be picked up + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 20; + } + + public override void SetDefaults() + { + Projectile.width = 8; + Projectile.height = 8; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 60 * 5 * Projectile.MaxUpdates; + spawnCooldown *= Projectile.MaxUpdates; + } + + public override void AI() + { + if ((true)) + { + float particleSize = 0.9f + 0.15f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 60f * MathHelper.TwoPi); + if (Projectile.timeLeft <= 60) //Shrinks to nothing when projectile is nearing death + { + particleSize *= Projectile.timeLeft / 60f; + } + particleSize *= 8f; + Particle beam3 = new CustomSpark(Projectile.Center + Projectile.Size / 2f, -Projectile.velocity * 0.1f, "CalamityMod/Particles/PearlParticleGlow", false, 10, 0.05f * particleSize, Color.DarkRed, new Vector2(0.5f, 1), false, false, 0, false, false, 0f); + GeneralParticleHandler.SpawnParticle(beam3); + + if (Main.rand.NextBool(8)) + { + Particle beam4 = new CustomSpark(Projectile.Center + Projectile.Size / 2f, Projectile.velocity * 0.1f, "CalamityMod/Particles/WaterFoam", false, 5, 0.01f * particleSize, Color.Red, new Vector2(1f, 1), true, false, Main.rand.NextFloat(-10, 10), false, false, 0f); + GeneralParticleHandler.SpawnParticle(beam4); + } + + } + Projectile.scale = MathHelper.Lerp(1, 1, 0.65f); + float maxDistance = 200f; + if (spawnCooldown > 0) + { + PassiveBehavior(); + spawnCooldown--; + return; + } + if (target < 0) + { + PassiveBehavior(); + if (Projectile.FinalExtraUpdate()) for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + Player player = Main.player[playerIndex]; + if (player.lifeMagnet) + maxDistance *= 1.5f; //Heartreach gives 50% more range + float targetDist = Vector2.Distance(player.Center, Projectile.Center); + if (targetDist < maxDistance) + { + maxDistance = targetDist; + target = playerIndex; + } + } + } + else HealHome(); + } + + public void PassiveBehavior() + { + Projectile.velocity *= 0.99f; + } + + public void HealHome() + { + Player player = Main.player[target]; + Vector2 playerVector = player.Center - Projectile.Center; + float playerDist = playerVector.Length(); + if (playerDist < 50f && Projectile.position.X < player.position.X + player.width && Projectile.position.X + Projectile.width > player.position.X && Projectile.position.Y < player.position.Y + player.height && Projectile.position.Y + Projectile.height > player.position.Y) + { + AdjustedHeal(player, heal); + Projectile.Kill(); + } + + Projectile.velocity = (Projectile.velocity * 5 + (playerVector.SafeNormalize(Vector2.Zero) * 5)) / 6f; //Move towards player. Range is determined in the AI(); + } + + public void AdjustedHeal(Player player, int heal) + { + var cplayer = player.Calamity(); + if (player.potionDelay > 0) + { + player.potionDelay -= 20; + if (player.potionDelay < 0) + player.potionDelay = 0; + if (player.HasBuff(BuffID.PotionSickness)) + { + for (var i = 0; i < player.buffType.Length; i++) + { + if (player.buffType[i] == BuffID.PotionSickness) + { + player.buffTime[i] = player.potionDelay; + } + } + } + } + else + { + player.lifeRegenTime += 60; //if Potion Sickness is full, each orb speeds up natural regen by 1 second + } + } + + public override bool PreDraw(ref Color lightColor) + { + for (int i = 0; i < Projectile.oldPos.Length; i++) + { + float particleSize = 0.9f + 0.15f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 60f * MathHelper.TwoPi); + particleSize *= MathHelper.Lerp(0.15f, 1f, 1f - i / (float)Projectile.oldPos.Length); + if (Projectile.timeLeft <= 60) //Shrinks to nothing when projectile is nearing death + { + particleSize *= Projectile.timeLeft / 60f; + } + Particle beam3 = new CustomSpark(Projectile.oldPos[i] + Projectile.Size / 2f, -Projectile.velocity * 0.1f, "CalamityMod/Particles/PearlParticleGlow", false, 10, 0.05f * particleSize, Color.DarkRed, new Vector2(0.5f, 1), false, false, 0, false, false, 0f); + GeneralParticleHandler.SpawnParticle(beam3); + + if (Main.rand.NextBool(8)) + { + Particle beam4 = new CustomSpark(Projectile.oldPos[i] + Projectile.Size / 2f, Projectile.velocity * 0.1f, "CalamityMod/Particles/WaterFoam", false, 5, 0.01f * particleSize, Color.Red, new Vector2(1f, 1), true, false, Main.rand.NextFloat(-10, 10), false, false, 0f); + GeneralParticleHandler.SpawnParticle(beam4); + } + } + return false; + } + } +} diff --git a/Projectiles/Magic/SanguineFlareProj.cs b/Projectiles/Magic/SanguineFlareProj.cs index 4926c62ddd..898ff2d51d 100644 --- a/Projectiles/Magic/SanguineFlareProj.cs +++ b/Projectiles/Magic/SanguineFlareProj.cs @@ -2,7 +2,11 @@ using CalamityMod.Balancing; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -13,10 +17,8 @@ namespace CalamityMod.Projectiles.Magic public class SanguineFlareProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; - private int x; - private double speed = 10; - private float startSpeedY = 0f; - + public bool beingChanneled = true; + public float dmgMult = 1; public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Type] = 4; @@ -25,43 +27,64 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - Projectile.width = 10; - Projectile.height = 10; + Projectile.width = 30; + Projectile.height = 30; Projectile.friendly = true; Projectile.penetrate = 1; Projectile.tileCollide = false; Projectile.timeLeft = 600; Projectile.alpha = 255; Projectile.DamageType = DamageClass.Magic; + Projectile.extraUpdates = 19; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - Lighting.AddLight(Projectile.Center, 1f, 0f, 0f); - if (Projectile.localAI[0] == 0f) + var player = Main.player[Projectile.owner]; + if (beingChanneled && player.channel) { - Projectile.velocity.X = Projectile.velocity.X + (Main.player[Projectile.owner].velocity.X * 0.5f); - startSpeedY = Projectile.velocity.Y + (Main.player[Projectile.owner].velocity.Y * 0.5f); - Projectile.velocity.Y = startSpeedY; - } - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] >= 180f) - { - x++; - speed += 0.1; - Projectile.velocity.Y = startSpeedY + (float)(speed * Math.Sin(x / 4)); - } - Projectile.rotation += Projectile.velocity.Y * 0.02f; - Projectile.alpha -= 5; - if (Projectile.alpha < 30) - { - Projectile.alpha = 30; - } - } + Projectile.velocity = Vector2.Zero; + Projectile.timeLeft = 300 * Projectile.MaxUpdates; + if (Projectile.FinalExtraUpdate()) + { + player.itemTime = 15; + player.SetItemAnimation(15); + var dir = player.Center.DirectionTo(player.ClampedMouseWorld()) * 64; + player.direction = dir.X >= 0 ? 1 : -1; + Projectile.direction = player.direction; + player.itemRotation = (dir * player.direction).ToRotation(); + Projectile.Center = player.Center + player.Center.DirectionTo(player.ClampedMouseWorld()) * 64; + dmgMult *= 1.009f; + if (dmgMult >= 5f) + { + dmgMult = 5f; + player.channel = false; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 60, 60, Projectile.alpha); + } + + } else + { + if (beingChanneled) + { + Projectile.damage = (int)(Projectile.damage * dmgMult); + Projectile.velocity = player.MountedCenter.DirectionTo(player.ClampedMouseWorld())*4; + Projectile.extraUpdates = 19; + beingChanneled = false; + } + + float particleSize = (dmgMult * 5 + 5)/2f; + Particle beam3 = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.1f, "CalamityMod/Particles/PearlParticleGlow", false, 10, 0.05f * particleSize, Color.DarkRed, new Vector2(0.5f, 1), false, false, 0, false, false, 0f); + GeneralParticleHandler.SpawnParticle(beam3); + + if (Main.rand.NextBool(8)) + { + Particle beam4 = new CustomSpark(Projectile.Center, Projectile.velocity * 0.1f, "CalamityMod/Particles/WaterFoam", false, 5, 0.01f * particleSize, Color.Red, new Vector2(1f, 1), true, false, Main.rand.NextFloat(-10, 10), false, false, 0f); + GeneralParticleHandler.SpawnParticle(beam4); + } + } } public override void OnKill(int timeLeft) @@ -95,23 +118,74 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 60); - - int heal = (int)Math.Round(hit.Damage * 0.025); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + //target.AddBuff(ModContent.BuffType(), 360); + if (beingChanneled || Projectile.penetrate == -1) return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); + var player = Main.player[Projectile.owner]; + float orbCount = MathHelper.Lerp(0, 20, (dmgMult-1) / 4f); + for (var i = 0; i < orbCount; i++) + { + Projectile.NewProjectile(Projectile.GetSource_OnHit(target), Projectile.Center, Projectile.velocity.RotatedByRandom(1) * Main.rand.NextFloat(0.75f, 1.25f), ModContent.ProjectileType(), 1, 0f, player.whoAmI); + } + if (dmgMult > 1) + { + Projectile.position = Projectile.Center; + Projectile.Size *= dmgMult * 1.5f; + Projectile.Center = Projectile.position; + Projectile.penetrate = -1; + Projectile.extraUpdates = 0; + Projectile.timeLeft = 20; + Projectile.velocity *= 0; + Particle bloodsplosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkRed*0.5f, "CalamityMod/Particles/DetailedExplosion", Vector2.One, Main.rand.NextFloat(-15f, 15f), 0.16f*dmgMult/5f, 0.87f * dmgMult / 5f, (int)(Viscera.BoomLifetime * 0.38f), false); + GeneralParticleHandler.SpawnParticle(bloodsplosion); + Particle bloodsplosion2 = new CustomPulse(Projectile.Center, Vector2.Zero, new Color(255, 32, 32)*0.5f, "CalamityMod/Particles/DustyCircleHardEdge", Vector2.One, Main.rand.NextFloat(-15f, 15f), 0.03f * dmgMult / 5f, 0.155f * dmgMult / 5f, Viscera.BoomLifetime); + GeneralParticleHandler.SpawnParticle(bloodsplosion2); + } } public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 60); public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + if (beingChanneled) + { + + Texture2D lightTexture = ModContent.Request("CalamityMod/ExtraTextures/SmallGreyscaleCircle").Value; + for (int i = 0; i < 1; i++) + { + //Photoviscerator drawcode, edited slightly + float colorInterpolation = (float)Math.Cos(Projectile.timeLeft / 32f + dmgMult / 20f + i / (float)Projectile.oldPos.Length * MathHelper.Pi) * 0.5f + 0.5f; + Color color = Color.Lerp(Color.Red, Color.DarkRed, colorInterpolation) * 0.8f; + color.A = 0; + Vector2 drawPosition = Projectile.oldPos[i]+Projectile.Size /2f + lightTexture.Size() * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY) + new Vector2(-32.5f, -32.5f); //Last vector is to offset the circle so that it is displayed where the hitbox actually is, instead of a bit down and to the right. + Color outerColor = color; + Color innerColor = color * 0.5f; + float intensity = 0.9f + 0.15f * (float)Math.Cos(dmgMult * MathHelper.TwoPi); + intensity *= MathHelper.Lerp(0.15f, 1f, 1f - i / (float)Projectile.oldPos.Length); + if (Projectile.timeLeft <= 60) //Shrinks to nothing when projectile is nearing death + { + intensity *= Projectile.timeLeft / 60f; + } + // Become smaller the futher along the old positions we are. + Vector2 outerScale = new Vector2(1f) * Projectile.scale * intensity; + Vector2 innerScale = new Vector2(1f) * Projectile.scale * intensity * 0.7f; + outerColor *= intensity; + innerColor *= intensity; + Main.EntitySpriteDraw(lightTexture, drawPosition, null, outerColor, 0f, lightTexture.Size() * 0.5f, outerScale * dmgMult * 0.25f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(lightTexture, drawPosition, null, innerColor, 0f, lightTexture.Size() * 0.5f, innerScale * dmgMult * 0.25f, SpriteEffects.None, 0); + } + } + + + /*if (Main.rand.NextBool(6) && Projectile.ai[1] == 0f) + { + Color smokeColor = Main.rand.NextBool() ? Color.Red : Color.Firebrick; + Vector2 smokePosition = Projectile.Center + Main.rand.NextVector2Circular(5 + Time * 0.3f, 5 + Time * 0.3f); + float smokeScale = Main.rand.NextFloat(0.5f, 1.6f); + float smokeOpacity = 170 + -Time * 0.6f; + Particle smoke = new MediumMistParticle(smokePosition, Vector2.Zero, smokeColor, Color.Black, smokeScale, smokeOpacity, Main.rand.NextFloat(0.2f, -0.2f)); + GeneralParticleHandler.SpawnParticle(smoke); + }*/ return false; } } diff --git a/Projectiles/Melee/TheMutilatorHoldoutProjectile.cs b/Projectiles/Melee/TheMutilatorHoldoutProjectile.cs new file mode 100644 index 0000000000..3117c4212a --- /dev/null +++ b/Projectiles/Melee/TheMutilatorHoldoutProjectile.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Items.Weapons.Melee; +using Microsoft.Xna.Framework; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria; +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Healing; +using Terraria.Audio; +using Terraria.IO; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; + +namespace CalamityMod.Projectiles.Melee +{ + public class MutilatorSwordProj : BaseSwordHoldoutProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override int swingWidth => 180; + public override string Texture => ModContent.GetModItem(BaseItem.type).Texture; + public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType()).Item; + public override int AfterImageLength => 5; + public override int OffsetDistance => 60; + public override bool drawSwordTrail => true; + public override Color[] trailColors => [Color.Red, Color.DarkRed, Color.Gold]; + + public override float trailOffset => 30; + + public override float trailWidth(float completion) + { + return base.trailWidth(completion); + } + + public override int trailLength => 5; + + public override int StartupTime { get; set; } + public override int CooldownTime { get; set; } + + public bool hasGivenBlood = false; + + public override void Spawn(IEntitySource source) + { + var player = Main.player[Projectile.owner]; + var modplayer = player.GetModPlayer(); + StartupTime = 15; + CooldownTime = 5; + swingTime -= StartupTime + CooldownTime; + modplayer.swingNum = 0; + } + + public override void AdditionalAI() + { + Projectile.scale = baseScale * Math.Min(MathHelper.SmoothStep(1, 2, swingTimer / (float)swingTime), MathHelper.SmoothStep(2, 1, swingTimer / (float)swingTime)); + } + + public override float SwingFunction() + { + return MathHelper.ToRadians(MathHelper.SmoothStep(-swingWidth / 4 * 3, swingWidth / 4, swingTimer / (float)swingTime)); + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 60); + var player = Main.player[Projectile.owner]; + var item = player.HeldItem; + if (item.type != ModContent.ItemType()) + { + Projectile.Kill(); + return; + } + var modItem = item.ModItem as TheMutilator; + if (!hasGivenBlood) + { + modItem.Charge++; + hasGivenBlood = true; + if (modItem.Charge > TheMutilator.MaximumCharge) + { + modItem.Charge = 0; + int healAmount = 1; + int orbAmount = 30; + if (orbAmount > 0) + { + float spreadAmount = MathHelper.ToRadians(360); + for (var i = 0; i < orbAmount; i++) + { + Projectile.NewProjectile(Projectile.GetSource_OnHit(target), target.Center, -angle.RotatedByRandom(spreadAmount) * 3.5f * Main.rand.NextFloat(0.75f, 1.25f), ModContent.ProjectileType(), healAmount, 0f, player.whoAmI); + + } + Particle bloodsplosion2 = new CustomPulse(target.Center, Vector2.Zero, new Color(255, 32, 32) * 0.75f, "CalamityMod/Particles/DustyCircleHardEdge", Vector2.One, Main.rand.NextFloat(-15f, 15f), 0.03f, 0.155f, 40); + GeneralParticleHandler.SpawnParticle(bloodsplosion2); + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/BloodPactCrit") { Volume = 0.5f }, player.Center); + } + } + modItem.DecayTimer = 180; + } + } + } +} diff --git a/Projectiles/Ranged/BloodfireArrowProj.cs b/Projectiles/Ranged/BloodfireArrowProj.cs index 5c271827d0..4ccc6336d3 100644 --- a/Projectiles/Ranged/BloodfireArrowProj.cs +++ b/Projectiles/Ranged/BloodfireArrowProj.cs @@ -18,6 +18,9 @@ namespace CalamityMod.Projectiles.Ranged { public new string LocalizationCategory => "Projectiles.Ranged"; + //Used by Arterial Assault + public bool DisableEffects = false; + public override string Texture => "CalamityMod/Items/Ammo/BloodfireArrow"; public override void SetStaticDefaults() @@ -47,14 +50,22 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.localAI[0] == 0) { - Projectile.damage = (int)(Projectile.damage * 1.3f); // damage boost - player.statLife -= 1; - if (player.statLife <= 0) + if (DisableEffects) { - PlayerDeathReason pdr = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.BloodFireArrow" + Main.rand.Next(1, 2 + 1)).ToNetworkText(player.name)); - player.KillMe(pdr, 1000.0, 0, false); + + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 9; + } else + { + Projectile.damage = (int)(Projectile.damage * 1.3f); // damage boost + player.statLife -= 1; + if (player.statLife <= 0) + { + PlayerDeathReason pdr = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.BloodFireArrow" + Main.rand.Next(1, 2 + 1)).ToNetworkText(player.name)); + player.KillMe(pdr, 1000.0, 0, false); + } + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 9; } - Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 9; + } Player Owner = Main.player[Projectile.owner]; @@ -101,6 +112,8 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + if (DisableEffects) + return; Player player = Main.player[Projectile.owner]; player.lifeRegenTime += 2; diff --git a/Projectiles/Rogue/BloodsoakedCrashax.cs b/Projectiles/Rogue/BloodsoakedCrashax.cs index 4884fc3f27..b894edd6e7 100644 --- a/Projectiles/Rogue/BloodsoakedCrashax.cs +++ b/Projectiles/Rogue/BloodsoakedCrashax.cs @@ -6,6 +6,10 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Healing; +using System.Reflection.Metadata; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class BloodsoakedCrashax : ModProjectile, ILocalizedModType @@ -109,7 +113,7 @@ namespace CalamityMod.Projectiles.Rogue int projID = ModContent.ProjectileType(); int bloodDamage = Projectile.damage; float bloodKB = 1f; - int stealth = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, projID, bloodDamage, bloodKB, Projectile.owner, 1f, 0.85f + Main.rand.NextFloat() * 1.15f); + int stealth = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.UnitX.RotatedByRandom(MathHelper.TwoPi)*4f, projID, bloodDamage, bloodKB, Projectile.owner, 1f, 0.85f + Main.rand.NextFloat() * 1.15f); if (stealth.WithinBounds(Main.maxProjectiles)) { Main.projectile[stealth].DamageType = RogueDamageClass.Instance; @@ -117,14 +121,16 @@ namespace CalamityMod.Projectiles.Rogue } } - int heal = (int)Math.Round(damage * 0.01); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; + float orbAmount = Projectile.Calamity().stealthStrike ? 3 : Projectile.penetrate % 2; + if (orbAmount > 0) + { + float spreadAmount = MathHelper.ToRadians(360); + for (var i = 0; i < orbAmount; i++) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.One.RotatedByRandom(spreadAmount) * 2f * Main.rand.NextFloat(0.75f, 1.25f), ModContent.ProjectileType(), 1, 0f, Projectile.owner); - if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); + } + } } public override bool PreDraw(ref Color lightColor) //afterimages diff --git a/Projectiles/Summon/BloodSpit.cs b/Projectiles/Summon/BloodSpit.cs index 1a0908f86e..057b6387c2 100644 --- a/Projectiles/Summon/BloodSpit.cs +++ b/Projectiles/Summon/BloodSpit.cs @@ -28,6 +28,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 6; Projectile.DamageType = DamageClass.Summon; + Projectile.Calamity().BloodstoneOrbValue = 1; //Bloodstone Orb lifesteal. May want to go back to regular lifesteal. } public override void AI() @@ -49,8 +50,8 @@ namespace CalamityMod.Projectiles.Summon blood.velocity = Main.rand.NextVector2Circular(1f, 2f); blood.noGravity = true; } - - int heal = (int)Math.Round(hit.Damage * 0.01); + //regular lifesteal code. Not sure if we wanna go back to it so I left it here. + /*int heal = (int)Math.Round(hit.Damage * 0.01); if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; @@ -58,6 +59,7 @@ namespace CalamityMod.Projectiles.Summon return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); + */ } } } From 6ec5ea14fda0c23ac18bfe3e44bba7a56bc0cf17 Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Fri, 25 Apr 2025 16:21:18 -0500 Subject: [PATCH 02/12] gave sang. flare laceration and prelim dmg changes --- Items/Weapons/Magic/SanguineFlare.cs | 2 +- Items/Weapons/Melee/TheMutilator.cs | 2 +- Items/Weapons/Ranged/ArterialAssault.cs | 2 +- Projectiles/Magic/SanguineFlareProj.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Items/Weapons/Magic/SanguineFlare.cs b/Items/Weapons/Magic/SanguineFlare.cs index 28bd1045a8..8ec88cc393 100644 --- a/Items/Weapons/Magic/SanguineFlare.cs +++ b/Items/Weapons/Magic/SanguineFlare.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 56; Item.height = 60; - Item.damage = 300; + Item.damage = 1000; Item.DamageType = DamageClass.Magic; Item.mana = 22; Item.useTime = 25; diff --git a/Items/Weapons/Melee/TheMutilator.cs b/Items/Weapons/Melee/TheMutilator.cs index 6fc633fc4a..36f630ecd4 100644 --- a/Items/Weapons/Melee/TheMutilator.cs +++ b/Items/Weapons/Melee/TheMutilator.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 90; Item.height = 90; - Item.damage = 483; + Item.damage = 1111; Item.DamageType = DamageClass.Melee; Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Swing; diff --git a/Items/Weapons/Ranged/ArterialAssault.cs b/Items/Weapons/Ranged/ArterialAssault.cs index 1a6651b629..ee5fe7dc75 100644 --- a/Items/Weapons/Ranged/ArterialAssault.cs +++ b/Items/Weapons/Ranged/ArterialAssault.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 44; Item.height = 100; - Item.damage = 200; + Item.damage = 500; Item.DamageType = DamageClass.Ranged; Item.useTime = 6; Item.useAnimation = 40; diff --git a/Projectiles/Magic/SanguineFlareProj.cs b/Projectiles/Magic/SanguineFlareProj.cs index 898ff2d51d..4fe2d272c0 100644 --- a/Projectiles/Magic/SanguineFlareProj.cs +++ b/Projectiles/Magic/SanguineFlareProj.cs @@ -118,7 +118,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - //target.AddBuff(ModContent.BuffType(), 360); + target.AddBuff(ModContent.BuffType(), 360); if (beingChanneled || Projectile.penetrate == -1) return; var player = Main.player[Projectile.owner]; From 8f6c03e5d5dc01c78cea6888e47528a49ca75322 Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Fri, 25 Apr 2025 18:42:44 -0500 Subject: [PATCH 03/12] mutilator / sang.flare anim changes --- .../BaseCustomMeleeSwingProjectile.cs | 23 ++++++++++++++++++- Projectiles/Magic/SanguineFlareProj.cs | 6 ++--- .../Melee/TheMutilatorHoldoutProjectile.cs | 15 ++++++++++-- 3 files changed, 38 insertions(+), 6 deletions(-) diff --git a/Projectiles/BaseProjectiles/BaseCustomMeleeSwingProjectile.cs b/Projectiles/BaseProjectiles/BaseCustomMeleeSwingProjectile.cs index 7a4991b567..c3a430b548 100644 --- a/Projectiles/BaseProjectiles/BaseCustomMeleeSwingProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseCustomMeleeSwingProjectile.cs @@ -189,6 +189,20 @@ namespace CalamityMod.Projectiles.BaseProjectiles List oldProjectilePos = new List { }; internal int ExistsTime = 20; + public bool inStartup => timer < StartupTime; + + public bool inCooldown => timer > CooldownStartFrame; + + public bool inSwing => !(inStartup || inCooldown); + + public int CooldownStartFrame => swingTime + StartupTime; + + public int CooldownTimer => timer - CooldownStartFrame; + + public float StartupCompletion => timer / (float)StartupTime; + public float SwingCompletion => swingTimer / (float)swingTime; + public float CooldownCompletion => CooldownTimer / (float)CooldownTime; + #endregion #region Overridable Methods @@ -206,13 +220,14 @@ namespace CalamityMod.Projectiles.BaseProjectiles /// public virtual void Defaults() { } /// - /// Returns the offset from the centerpoint in radians. Automatically will be inverted if AlternateSwings is enabled. + /// Returns the swing offset from the center angle in radians. Automatically will be inverted if AlternateSwings is enabled. /// /// public virtual float SwingFunction() { return MathHelper.ToRadians(MathHelper.SmoothStep(-swingWidth / 2, swingWidth / 2, swingTimer / (float)swingTime)); } + /// /// The function for the width of the trail /// @@ -441,6 +456,11 @@ namespace CalamityMod.Projectiles.BaseProjectiles { modifiers.HitDirectionOverride = ((Main.player[Projectile.owner].DirectionTo(target.Center)).X >= 0 ? 1 : -1); } + + public override bool? CanDamage() + { + return inSwing; + } #endregion #region Helper Methods @@ -470,6 +490,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.rotation + negate * MathHelper.ToRadians(45 - negate * 90)).ToRotationVector2() * velocity, type, (int)(Projectile.damage * damagemod), Projectile.knockBack, Projectile.owner, ai0); } } + #endregion } diff --git a/Projectiles/Magic/SanguineFlareProj.cs b/Projectiles/Magic/SanguineFlareProj.cs index 4fe2d272c0..10b527637a 100644 --- a/Projectiles/Magic/SanguineFlareProj.cs +++ b/Projectiles/Magic/SanguineFlareProj.cs @@ -155,7 +155,7 @@ namespace CalamityMod.Projectiles.Magic { //Photoviscerator drawcode, edited slightly float colorInterpolation = (float)Math.Cos(Projectile.timeLeft / 32f + dmgMult / 20f + i / (float)Projectile.oldPos.Length * MathHelper.Pi) * 0.5f + 0.5f; - Color color = Color.Lerp(Color.Red, Color.DarkRed, colorInterpolation) * 0.8f; + Color color = Color.Lerp(Color.Red, Color.DarkRed, colorInterpolation) * 0.8f * ((dmgMult-1)/4f); color.A = 0; Vector2 drawPosition = Projectile.oldPos[i]+Projectile.Size /2f + lightTexture.Size() * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY) + new Vector2(-32.5f, -32.5f); //Last vector is to offset the circle so that it is displayed where the hitbox actually is, instead of a bit down and to the right. Color outerColor = color; @@ -171,8 +171,8 @@ namespace CalamityMod.Projectiles.Magic Vector2 innerScale = new Vector2(1f) * Projectile.scale * intensity * 0.7f; outerColor *= intensity; innerColor *= intensity; - Main.EntitySpriteDraw(lightTexture, drawPosition, null, outerColor, 0f, lightTexture.Size() * 0.5f, outerScale * dmgMult * 0.25f, SpriteEffects.None, 0); - Main.EntitySpriteDraw(lightTexture, drawPosition, null, innerColor, 0f, lightTexture.Size() * 0.5f, innerScale * dmgMult * 0.25f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(lightTexture, drawPosition, null, outerColor, 0f, lightTexture.Size() * 0.5f, outerScale * 1.25f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(lightTexture, drawPosition, null, innerColor, 0f, lightTexture.Size() * 0.5f, innerScale * 1.25f, SpriteEffects.None, 0); } } diff --git a/Projectiles/Melee/TheMutilatorHoldoutProjectile.cs b/Projectiles/Melee/TheMutilatorHoldoutProjectile.cs index 3117c4212a..75553ac8b6 100644 --- a/Projectiles/Melee/TheMutilatorHoldoutProjectile.cs +++ b/Projectiles/Melee/TheMutilatorHoldoutProjectile.cs @@ -56,12 +56,23 @@ namespace CalamityMod.Projectiles.Melee public override void AdditionalAI() { - Projectile.scale = baseScale * Math.Min(MathHelper.SmoothStep(1, 2, swingTimer / (float)swingTime), MathHelper.SmoothStep(2, 1, swingTimer / (float)swingTime)); + if (inStartup) + { + Projectile.scale = baseScale * MathHelper.Lerp(0.5f, 1, 1 - MathF.Pow(1 - StartupCompletion, 2f)); + } else if (inCooldown) + { + Projectile.scale = baseScale * MathHelper.Lerp(1,0.5f,MathF.Pow(CooldownCompletion,2)); + } else + Projectile.scale = baseScale * Math.Min(MathHelper.SmoothStep(1, 2, SwingCompletion), MathHelper.SmoothStep(2, 1, SwingCompletion)); } public override float SwingFunction() { - return MathHelper.ToRadians(MathHelper.SmoothStep(-swingWidth / 4 * 3, swingWidth / 4, swingTimer / (float)swingTime)); + if (inStartup) + return MathHelper.ToRadians(MathHelper.SmoothStep(-swingWidth * 0.5f, -swingWidth * 0.75f, 1-MathF.Pow(1-StartupCompletion,2f))); + if (inCooldown) + return MathHelper.ToRadians(MathHelper.SmoothStep(swingWidth * 0.25f, swingWidth * 0.33f, CooldownCompletion)); + return MathHelper.ToRadians(MathHelper.SmoothStep(-swingWidth *0.75f, swingWidth *0.25f, SwingCompletion)); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) From e9b13b7bed47dd824b60723867ff4ee4bff54f09 Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Fri, 25 Apr 2025 19:42:43 -0500 Subject: [PATCH 04/12] arterial assault firing pattern & sang flare fixes --- Items/Weapons/Ranged/ArterialAssault.cs | 9 ++++++--- Projectiles/Magic/SanguineFlareProj.cs | 13 +++++++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Items/Weapons/Ranged/ArterialAssault.cs b/Items/Weapons/Ranged/ArterialAssault.cs index ee5fe7dc75..20766ae2a9 100644 --- a/Items/Weapons/Ranged/ArterialAssault.cs +++ b/Items/Weapons/Ranged/ArterialAssault.cs @@ -15,6 +15,8 @@ namespace CalamityMod.Items.Weapons.Ranged public class ArterialAssault : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + + int shotNum = 0; public override void SetDefaults() { Item.width = 44; @@ -36,11 +38,10 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 30f; Item.useAmmo = AmmoID.Arrow; } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - - position += velocity.SafeNormalize(Vector2.Zero).RotatedByRandom(1.8f) * 64; + float rotateBy = 0.75f * ((shotNum*3) % 5 - 2); + position += velocity.SafeNormalize(Vector2.Zero).RotatedBy(rotateBy) * 64; velocity = position.DirectionTo(Main.MouseWorld) * velocity.Length()*2; type = ModContent.ProjectileType(); Projectile shotArrow = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback, player.whoAmI); @@ -49,6 +50,8 @@ namespace CalamityMod.Items.Weapons.Ranged (shotArrow.ModProjectile as BloodfireArrowProj).DisableEffects = true; shotArrow.Calamity().conditionalHomingRange = 175f; shotArrow.Calamity().BloodstoneOrbValue = 1; + shotNum++; + if (shotNum > 4) shotNum = 0; return false; } diff --git a/Projectiles/Magic/SanguineFlareProj.cs b/Projectiles/Magic/SanguineFlareProj.cs index 10b527637a..4fa444106e 100644 --- a/Projectiles/Magic/SanguineFlareProj.cs +++ b/Projectiles/Magic/SanguineFlareProj.cs @@ -87,9 +87,14 @@ namespace CalamityMod.Projectiles.Magic } } + public override bool? CanDamage() + { + return !beingChanneled; + } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + SoundStyle hitSound = new("CalamityMod/Sounds/NPCKilled/PerfLargeDeath"); + SoundEngine.PlaySound(hitSound with { Volume = 0.5f }, Projectile.Center); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); Projectile.width = 10; @@ -134,8 +139,9 @@ namespace CalamityMod.Projectiles.Magic Projectile.Center = Projectile.position; Projectile.penetrate = -1; Projectile.extraUpdates = 0; - Projectile.timeLeft = 20; + Projectile.timeLeft = 2; Projectile.velocity *= 0; + Projectile.damage /= 2; Particle bloodsplosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkRed*0.5f, "CalamityMod/Particles/DetailedExplosion", Vector2.One, Main.rand.NextFloat(-15f, 15f), 0.16f*dmgMult/5f, 0.87f * dmgMult / 5f, (int)(Viscera.BoomLifetime * 0.38f), false); GeneralParticleHandler.SpawnParticle(bloodsplosion); Particle bloodsplosion2 = new CustomPulse(Projectile.Center, Vector2.Zero, new Color(255, 32, 32)*0.5f, "CalamityMod/Particles/DustyCircleHardEdge", Vector2.One, Main.rand.NextFloat(-15f, 15f), 0.03f * dmgMult / 5f, 0.155f * dmgMult / 5f, Viscera.BoomLifetime); @@ -154,8 +160,7 @@ namespace CalamityMod.Projectiles.Magic for (int i = 0; i < 1; i++) { //Photoviscerator drawcode, edited slightly - float colorInterpolation = (float)Math.Cos(Projectile.timeLeft / 32f + dmgMult / 20f + i / (float)Projectile.oldPos.Length * MathHelper.Pi) * 0.5f + 0.5f; - Color color = Color.Lerp(Color.Red, Color.DarkRed, colorInterpolation) * 0.8f * ((dmgMult-1)/4f); + Color color = Color.DarkRed * (dmgMult/5f); color.A = 0; Vector2 drawPosition = Projectile.oldPos[i]+Projectile.Size /2f + lightTexture.Size() * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY) + new Vector2(-32.5f, -32.5f); //Last vector is to offset the circle so that it is displayed where the hitbox actually is, instead of a bit down and to the right. Color outerColor = color; From be97be8fc98bcdf06f67647f9d4a901a853e5303 Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Sat, 26 Apr 2025 09:13:18 -0500 Subject: [PATCH 05/12] vfx updates --- .../BaseCustomMeleeSwingProjectile.cs | 6 ++-- Projectiles/Healing/BloodstoneHealOrb.cs | 29 +------------------ Projectiles/Magic/SanguineFlareProj.cs | 4 +-- .../Melee/TheMutilatorHoldoutProjectile.cs | 2 +- 4 files changed, 7 insertions(+), 34 deletions(-) diff --git a/Projectiles/BaseProjectiles/BaseCustomMeleeSwingProjectile.cs b/Projectiles/BaseProjectiles/BaseCustomMeleeSwingProjectile.cs index c3a430b548..73c7b4c53b 100644 --- a/Projectiles/BaseProjectiles/BaseCustomMeleeSwingProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseCustomMeleeSwingProjectile.cs @@ -373,7 +373,6 @@ namespace CalamityMod.Projectiles.BaseProjectiles Projectile.Center = armCenter - (angle * OffsetDistance * (1 + (Projectile.scale - 1) * 0.75f)).RotatedBy(Projectile.spriteDirection * angle2); Projectile.rotation = angle.RotatedBy(Projectile.spriteDirection * angle2).ToRotation() + adust; AdditionalAI(); - oldScale.Insert(0, Projectile.scale); player.itemTime = ExistsTime + 1 - timer; if (timer > ExistsTime) @@ -389,6 +388,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles var armDir = armCenter - Projectile.Center; armDir.Y *= player.gravDir; player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, armDir.ToRotation() + MathHelper.ToRadians(90)); + oldScale.Insert(0, Projectile.scale); } public override bool PreDraw(ref Color lightColor) { @@ -430,10 +430,10 @@ namespace CalamityMod.Projectiles.BaseProjectiles GameShaders.Misc["CalamityMod:ExobladeSlash"].Shader.Parameters["flipped"].SetValue((AlternateSwings && modplayer.swingNum % 2 == 1) ^ Projectile.spriteDirection == -1 ? false : true); GameShaders.Misc["CalamityMod:ExobladeSlash"].Apply(); - var positionsToUse = Projectile.oldPos.Take(trailLength).ToArray(); + var positionsToUse = Projectile.oldPos.Take((int)MathHelper.Min(trailLength,swingTimer)).ToArray(); for (var i = 0; i < positionsToUse.Length; i++) { - if (i >= timer) continue; + if (i >= timer) break; positionsToUse[i] += (Projectile.oldRot[i] - MathHelper.PiOver4 * (Projectile.spriteDirection == -1 ? 3 : 1)).ToRotationVector2() * this.trailOffset * oldScale[i]; } PrimitiveRenderer.RenderTrail(positionsToUse, new(trailWidth, trailColor, (_) => trailOffset, shader: GameShaders.Misc["CalamityMod:ExobladeSlash"]), 25); diff --git a/Projectiles/Healing/BloodstoneHealOrb.cs b/Projectiles/Healing/BloodstoneHealOrb.cs index f87cc69824..d448b5cc4a 100644 --- a/Projectiles/Healing/BloodstoneHealOrb.cs +++ b/Projectiles/Healing/BloodstoneHealOrb.cs @@ -20,12 +20,6 @@ namespace CalamityMod.Projectiles.Healing public int spawnCooldown = 60; //how many frames must pass before it can be picked up - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailingMode[Type] = 0; - ProjectileID.Sets.TrailCacheLength[Type] = 20; - } - public override void SetDefaults() { Projectile.width = 8; @@ -41,8 +35,6 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { - if ((true)) - { float particleSize = 0.9f + 0.15f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 60f * MathHelper.TwoPi); if (Projectile.timeLeft <= 60) //Shrinks to nothing when projectile is nearing death { @@ -52,13 +44,11 @@ namespace CalamityMod.Projectiles.Healing Particle beam3 = new CustomSpark(Projectile.Center + Projectile.Size / 2f, -Projectile.velocity * 0.1f, "CalamityMod/Particles/PearlParticleGlow", false, 10, 0.05f * particleSize, Color.DarkRed, new Vector2(0.5f, 1), false, false, 0, false, false, 0f); GeneralParticleHandler.SpawnParticle(beam3); - if (Main.rand.NextBool(8)) + if (false && Main.rand.NextBool(8)) { Particle beam4 = new CustomSpark(Projectile.Center + Projectile.Size / 2f, Projectile.velocity * 0.1f, "CalamityMod/Particles/WaterFoam", false, 5, 0.01f * particleSize, Color.Red, new Vector2(1f, 1), true, false, Main.rand.NextFloat(-10, 10), false, false, 0f); GeneralParticleHandler.SpawnParticle(beam4); } - - } Projectile.scale = MathHelper.Lerp(1, 1, 0.65f); float maxDistance = 200f; if (spawnCooldown > 0) @@ -132,23 +122,6 @@ namespace CalamityMod.Projectiles.Healing public override bool PreDraw(ref Color lightColor) { - for (int i = 0; i < Projectile.oldPos.Length; i++) - { - float particleSize = 0.9f + 0.15f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 60f * MathHelper.TwoPi); - particleSize *= MathHelper.Lerp(0.15f, 1f, 1f - i / (float)Projectile.oldPos.Length); - if (Projectile.timeLeft <= 60) //Shrinks to nothing when projectile is nearing death - { - particleSize *= Projectile.timeLeft / 60f; - } - Particle beam3 = new CustomSpark(Projectile.oldPos[i] + Projectile.Size / 2f, -Projectile.velocity * 0.1f, "CalamityMod/Particles/PearlParticleGlow", false, 10, 0.05f * particleSize, Color.DarkRed, new Vector2(0.5f, 1), false, false, 0, false, false, 0f); - GeneralParticleHandler.SpawnParticle(beam3); - - if (Main.rand.NextBool(8)) - { - Particle beam4 = new CustomSpark(Projectile.oldPos[i] + Projectile.Size / 2f, Projectile.velocity * 0.1f, "CalamityMod/Particles/WaterFoam", false, 5, 0.01f * particleSize, Color.Red, new Vector2(1f, 1), true, false, Main.rand.NextFloat(-10, 10), false, false, 0f); - GeneralParticleHandler.SpawnParticle(beam4); - } - } return false; } } diff --git a/Projectiles/Magic/SanguineFlareProj.cs b/Projectiles/Magic/SanguineFlareProj.cs index 4fa444106e..68cf88d7a9 100644 --- a/Projectiles/Magic/SanguineFlareProj.cs +++ b/Projectiles/Magic/SanguineFlareProj.cs @@ -142,9 +142,9 @@ namespace CalamityMod.Projectiles.Magic Projectile.timeLeft = 2; Projectile.velocity *= 0; Projectile.damage /= 2; - Particle bloodsplosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkRed*0.5f, "CalamityMod/Particles/DetailedExplosion", Vector2.One, Main.rand.NextFloat(-15f, 15f), 0.16f*dmgMult/5f, 0.87f * dmgMult / 5f, (int)(Viscera.BoomLifetime * 0.38f), false); + Particle bloodsplosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkRed*0.75f, "CalamityMod/Particles/DetailedExplosion", Vector2.One, Main.rand.NextFloat(-15f, 15f), 0.16f*dmgMult/5f, 0.87f * dmgMult / 5f, (int)(40 * 0.38f), false); GeneralParticleHandler.SpawnParticle(bloodsplosion); - Particle bloodsplosion2 = new CustomPulse(Projectile.Center, Vector2.Zero, new Color(255, 32, 32)*0.5f, "CalamityMod/Particles/DustyCircleHardEdge", Vector2.One, Main.rand.NextFloat(-15f, 15f), 0.03f * dmgMult / 5f, 0.155f * dmgMult / 5f, Viscera.BoomLifetime); + Particle bloodsplosion2 = new CustomPulse(Projectile.Center, Vector2.Zero, new Color(255, 32, 32)*0.5f, "CalamityMod/Particles/DustyCircleHardEdge", Vector2.One, Main.rand.NextFloat(-15f, 15f), 0.03f * dmgMult / 5f, 0.155f * dmgMult / 5f, 40); GeneralParticleHandler.SpawnParticle(bloodsplosion2); } } diff --git a/Projectiles/Melee/TheMutilatorHoldoutProjectile.cs b/Projectiles/Melee/TheMutilatorHoldoutProjectile.cs index 75553ac8b6..40e88e0f1d 100644 --- a/Projectiles/Melee/TheMutilatorHoldoutProjectile.cs +++ b/Projectiles/Melee/TheMutilatorHoldoutProjectile.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Melee public override bool drawSwordTrail => true; public override Color[] trailColors => [Color.Red, Color.DarkRed, Color.Gold]; - public override float trailOffset => 30; + public override float trailOffset => 20; public override float trailWidth(float completion) { From 87697132edaa400f18072d88f299701a69aa2f7a Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Fri, 2 May 2025 15:01:14 -0500 Subject: [PATCH 06/12] Claret Cannon rework, set consistency, Blood Boiler balancing --- Items/Weapons/Ranged/AcesHigh.cs | 1 + Items/Weapons/Ranged/ArterialAssault.cs | 2 +- Items/Weapons/Ranged/BloodBoiler.cs | 4 +- Items/Weapons/Ranged/ClaretCannon.cs | 58 ---------- Items/Weapons/Typeless/ClaretCannon.cs | 109 ++++++++++++++++++ .../{Ranged => Typeless}/ClaretCannon.png | Bin ...ods.CalamityMod.Items.Weapons.Ranged.hjson | 9 -- ...s.CalamityMod.Items.Weapons.Typeless.hjson | 13 +++ .../Mods.CalamityMod.Projectiles.Ranged.hjson | 1 - ...ods.CalamityMod.Projectiles.Typeless.hjson | 1 + Projectiles/CalamityGlobalProjectile.cs | 5 +- Projectiles/Healing/BloodstoneHealOrb.cs | 11 +- Projectiles/Magic/SanguineFlareProj.cs | 2 +- Projectiles/Magic/VisceraBeam.cs | 15 ++- .../Melee/TheMutilatorHoldoutProjectile.cs | 3 +- Projectiles/Ranged/BloodBoilerFire.cs | 15 +-- Projectiles/Ranged/ClaretCannonProj.cs | 77 ------------- Projectiles/Rogue/BloodsoakedCrashax.cs | 2 +- Projectiles/Summon/BloodSpit.cs | 12 +- Projectiles/Typeless/ClaretCannonProj.cs | 92 +++++++++++++++ .../{Ranged => Typeless}/ClaretCannonProj.png | Bin 21 files changed, 242 insertions(+), 190 deletions(-) delete mode 100644 Items/Weapons/Ranged/ClaretCannon.cs create mode 100644 Items/Weapons/Typeless/ClaretCannon.cs rename Items/Weapons/{Ranged => Typeless}/ClaretCannon.png (100%) delete mode 100644 Projectiles/Ranged/ClaretCannonProj.cs create mode 100644 Projectiles/Typeless/ClaretCannonProj.cs rename Projectiles/{Ranged => Typeless}/ClaretCannonProj.png (100%) diff --git a/Items/Weapons/Ranged/AcesHigh.cs b/Items/Weapons/Ranged/AcesHigh.cs index f6152e10a7..02b9c4d72b 100644 --- a/Items/Weapons/Ranged/AcesHigh.cs +++ b/Items/Weapons/Ranged/AcesHigh.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Typeless; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; diff --git a/Items/Weapons/Ranged/ArterialAssault.cs b/Items/Weapons/Ranged/ArterialAssault.cs index 20766ae2a9..79856f0ca1 100644 --- a/Items/Weapons/Ranged/ArterialAssault.cs +++ b/Items/Weapons/Ranged/ArterialAssault.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Ranged shotArrow.tileCollide = false; (shotArrow.ModProjectile as BloodfireArrowProj).DisableEffects = true; shotArrow.Calamity().conditionalHomingRange = 175f; - shotArrow.Calamity().BloodstoneOrbValue = 1; + shotArrow.Calamity().BloodstoneOrbValue = 20; shotNum++; if (shotNum > 4) shotNum = 0; return false; diff --git a/Items/Weapons/Ranged/BloodBoiler.cs b/Items/Weapons/Ranged/BloodBoiler.cs index 2a6a2f5255..894f37aa5e 100644 --- a/Items/Weapons/Ranged/BloodBoiler.cs +++ b/Items/Weapons/Ranged/BloodBoiler.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 60; Item.height = 30; - Item.damage = 115; + Item.damage = 135; Item.DamageType = DamageClass.Ranged; Item.useTime = 5; Item.useAnimation = 25; @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { shotReturn = !shotReturn; - if (Main.rand.NextFloat() > 0.60f) + if (Main.rand.NextFloat() > 0.20f) player.statLife -= 1; if (player.statLife <= 0) { diff --git a/Items/Weapons/Ranged/ClaretCannon.cs b/Items/Weapons/Ranged/ClaretCannon.cs deleted file mode 100644 index 2fa1f265cf..0000000000 --- a/Items/Weapons/Ranged/ClaretCannon.cs +++ /dev/null @@ -1,58 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Ranged; -using CalamityMod.Rarities; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Ranged -{ - public class ClaretCannon : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Ranged"; - public override void SetDefaults() - { - Item.width = 48; - Item.height = 30; - Item.damage = 148; - Item.DamageType = DamageClass.Ranged; - Item.useTime = 3; - Item.useAnimation = 9; - Item.reuseDelay = 10; - Item.useLimitPerAnimation = 3; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 5.5f; - Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.rare = ModContent.RarityType(); - Item.UseSound = SoundID.Item40; - Item.autoReuse = true; - Item.shootSpeed = 24f; - Item.shoot = ModContent.ProjectileType(); - Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; - } - - public override Vector2? HoldoutOffset() => new Vector2(-5, 0); - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(4). - AddTile(TileID.LunarCraftingStation). - Register(); - } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - if (type == ProjectileID.Bullet) - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); - else - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - - return false; - } - } -} diff --git a/Items/Weapons/Typeless/ClaretCannon.cs b/Items/Weapons/Typeless/ClaretCannon.cs new file mode 100644 index 0000000000..3903e15e5c --- /dev/null +++ b/Items/Weapons/Typeless/ClaretCannon.cs @@ -0,0 +1,109 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Microsoft.Xna.Framework.Graphics; +using Terraria.ModLoader; +using System; + +namespace CalamityMod.Items.Weapons.Typeless +{ + public class ClaretCannon : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Typeless"; + + public int ClaretCooldown = 0; + + public static int ClaretCooldownMax = 300; + + public float baseUseDir = 0; + public override void SetDefaults() + { + Item.width = 48; + Item.height = 30; + Item.damage = 500; + Item.DamageType = AverageDamageClass.Instance; + Item.useTime = 10; + Item.useAnimation = 10; + Item.useLimitPerAnimation = 1; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5.5f; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; + Item.rare = ModContent.RarityType(); + Item.UseSound = SoundID.Item40; + Item.autoReuse = true; + Item.shootSpeed = 12f; + Item.shoot = ModContent.ProjectileType(); + } + + public override Vector2? HoldoutOffset() => new Vector2(-5, 0); + + public override void UpdateInventory(Player player) + { + ClaretCooldown--; + if (ClaretCooldown < 0) + ClaretCooldown = 0; + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.LunarCraftingStation). + Register(); + } + + public override bool CanUseItem(Player player) + { + if (ClaretCooldown > 0) + return false; + return true; + } + + public override void UseAnimation(Player player) + { + } + + public override void UseItemFrame(Player player) + { + float comp = 1 - player.itemTime / (float)player.itemTimeMax; + float lerpValue1 = MathHelper.Lerp(0, 90, MathF.Pow(comp, 0.3f)); + float lerpValue2 = MathHelper.Lerp(90, 0, MathF.Pow(comp, 2)); + player.itemRotation = baseUseDir - MathHelper.ToRadians(Math.Min(lerpValue1, lerpValue2)) * player.direction; + } + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + baseUseDir = player.itemRotation; + ClaretCooldown = ClaretCooldownMax; + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); + return false; + } + + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + float fill = ClaretCooldown / (float)ClaretCooldownMax; + if (fill <= 0) + return; + + float barScale = 1.5f; + + var barBG = ModContent.Request("CalamityMod/UI/MiscTextures/GenericBarBack").Value; + var barFG = ModContent.Request("CalamityMod/UI/MiscTextures/GenericBarFront").Value; + + Vector2 barOrigin = barBG.Size() * 0.5f; + float yOffset = 5f; + Vector2 drawPos = position + Vector2.UnitY * scale * (frame.Height - yOffset); + Rectangle frameCrop = new Rectangle(0, 0, (int)((fill) * barFG.Width), barFG.Height); + Color colorBG = Color.Crimson; + Color colorFG = Color.Lerp(Color.OrangeRed, Color.DarkOrange, fill); + + spriteBatch.Draw(barBG, drawPos, null, colorBG, 0f, barOrigin, scale * barScale, 0f, 0f); + spriteBatch.Draw(barFG, drawPos, frameCrop, colorFG, 0f, barOrigin, scale * barScale, 0f, 0f); + } + + } +} diff --git a/Items/Weapons/Ranged/ClaretCannon.png b/Items/Weapons/Typeless/ClaretCannon.png similarity index 100% rename from Items/Weapons/Ranged/ClaretCannon.png rename to Items/Weapons/Typeless/ClaretCannon.png diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index 5040e2be9c..d1821b8880 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -272,15 +272,6 @@ ClamorRifle: { Tooltip: Converts musket balls into homing energy bolts } -ClaretCannon: { - DisplayName: Claret Cannon - Tooltip: - ''' - Fires strings of 3 bullets - Converts musket balls into bloody tears that drain enemy health - ''' -} - CleansingBlaze: { DisplayName: Cleansing Blaze Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson index cad73bc9d5..0de017e498 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson @@ -7,6 +7,19 @@ Aestheticus: { ''' } +ClaretCannon: { + DisplayName: Claret Cannon + Tooltip: + ''' + Fires a hypercondensed claret round + The round explodes upon striking an enemy and releases blood orbs + The explosion shreds enemies, inflicting [Laceration] and dramatically reducing their defense + Picking up the blood orbs will reduce [Potion Sickness] when possible + If you do not have [Potion Sickness], your natural regeneration will be enhanced + Can only fire once every 5 seconds + ''' +} + EyeofMagnus: { DisplayName: Eye of Magnus Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index 07a9b5dd8a..97efe5b804 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -46,7 +46,6 @@ ChromaticFlare.DisplayName: Chromatic Flare CinderArrowProj.DisplayName: Cinder Arrow ClamorRifleProj.DisplayName: Clamor Bolt ClamorRifleProjSplit.DisplayName: Clamor Bolt -ClaretCannonProj.DisplayName: Claret Cannon CondemnationArrow.DisplayName: Condemning Arrow CondemnationArrowHoming.DisplayName: Condemning Echo ContagionArrow.DisplayName: Contagion Arrow diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson index 078e9577d4..06fbcda6ad 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson @@ -32,6 +32,7 @@ BossRushTierAnimation.DisplayName: Boss Rush Tier Animation ChaoticGeyser.DisplayName: Chaotic Geyser ChlorophyteLifePulse.DisplayName: Life Pulse ChronoClock.DisplayName: Chrono Clock +ClaretCannonProj.DisplayName: Claret Round CoralBubble.DisplayName: Bubble CoralBubbleSmall.DisplayName: Bubble CosmicDashExplosion.DisplayName: Cosmic Dash Explosion diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index cf00086d09..9cbf6a12c9 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -4225,10 +4225,9 @@ namespace CalamityMod.Projectiles #region On Hit NPC public override void OnHitNPC(Projectile projectile, NPC target, NPC.HitInfo hit, int damageDone) { - for (var i = 0; i < BloodstoneOrbValue; i++) + if (BloodstoneOrbValue > 0) { - Projectile.NewProjectile(projectile.GetSource_OnHit(target), projectile.Center, projectile.velocity.SafeNormalize(Vector2.Zero) * Math.Min(((projectile.velocity.Length() * projectile.MaxUpdates) / 4f), 4f) * Main.rand.NextFloat(0.75f, 1.25f), ModContent.ProjectileType(), 1, 0f, Main.player[projectile.owner].whoAmI); - + Projectile.NewProjectile(projectile.GetSource_OnHit(target), projectile.Center, projectile.velocity.SafeNormalize(Vector2.Zero) * Math.Min(((projectile.velocity.Length() * projectile.MaxUpdates) / 4f), 4f) * Main.rand.NextFloat(0.75f, 1.25f), ModContent.ProjectileType(), BloodstoneOrbValue, 0f, Main.player[projectile.owner].whoAmI); } // Hyperius Overflow if (projectile.type != ProjectileType() && projectile.type != ProjectileType() && projectile.type != ProjectileType() && projectile.type != ProjectileType() && target.Calamity().hyperiusMarked) diff --git a/Projectiles/Healing/BloodstoneHealOrb.cs b/Projectiles/Healing/BloodstoneHealOrb.cs index d448b5cc4a..6edd4ff6f5 100644 --- a/Projectiles/Healing/BloodstoneHealOrb.cs +++ b/Projectiles/Healing/BloodstoneHealOrb.cs @@ -88,19 +88,19 @@ namespace CalamityMod.Projectiles.Healing float playerDist = playerVector.Length(); if (playerDist < 50f && Projectile.position.X < player.position.X + player.width && Projectile.position.X + Projectile.width > player.position.X && Projectile.position.Y < player.position.Y + player.height && Projectile.position.Y + Projectile.height > player.position.Y) { - AdjustedHeal(player, heal); + Heal(player, heal); Projectile.Kill(); } Projectile.velocity = (Projectile.velocity * 5 + (playerVector.SafeNormalize(Vector2.Zero) * 5)) / 6f; //Move towards player. Range is determined in the AI(); } - public void AdjustedHeal(Player player, int heal) + public static void Heal(Player player, int PotionTime) { var cplayer = player.Calamity(); if (player.potionDelay > 0) { - player.potionDelay -= 20; + player.potionDelay -= PotionTime; if (player.potionDelay < 0) player.potionDelay = 0; if (player.HasBuff(BuffID.PotionSickness)) @@ -116,8 +116,11 @@ namespace CalamityMod.Projectiles.Healing } else { - player.lifeRegenTime += 60; //if Potion Sickness is full, each orb speeds up natural regen by 1 second + player.lifeRegenTime += 3*PotionTime; //if Potion Sickness is full, each orb speeds up natural regen } + + Particle ring = new CustomPulse(player.Center, Vector2.Zero, new Color(255, 32, 32)*0.75f, "CalamityMod/Particles/DustyCircleHardEdge", Vector2.One, 0, 0.01f, 0.05f, 20); + GeneralParticleHandler.SpawnParticle(ring); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Magic/SanguineFlareProj.cs b/Projectiles/Magic/SanguineFlareProj.cs index 68cf88d7a9..589fb92147 100644 --- a/Projectiles/Magic/SanguineFlareProj.cs +++ b/Projectiles/Magic/SanguineFlareProj.cs @@ -130,7 +130,7 @@ namespace CalamityMod.Projectiles.Magic float orbCount = MathHelper.Lerp(0, 20, (dmgMult-1) / 4f); for (var i = 0; i < orbCount; i++) { - Projectile.NewProjectile(Projectile.GetSource_OnHit(target), Projectile.Center, Projectile.velocity.RotatedByRandom(1) * Main.rand.NextFloat(0.75f, 1.25f), ModContent.ProjectileType(), 1, 0f, player.whoAmI); + Projectile.NewProjectile(Projectile.GetSource_OnHit(target), Projectile.Center, Projectile.velocity.RotatedByRandom(1) * Main.rand.NextFloat(0.75f, 1.25f), ModContent.ProjectileType(), 20, 0f, player.whoAmI); } if (dmgMult > 1) { diff --git a/Projectiles/Magic/VisceraBeam.cs b/Projectiles/Magic/VisceraBeam.cs index b0194dba22..636c4f426f 100644 --- a/Projectiles/Magic/VisceraBeam.cs +++ b/Projectiles/Magic/VisceraBeam.cs @@ -10,6 +10,7 @@ using Terraria.Audio; using CalamityMod.Balancing; using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Healing; namespace CalamityMod.Projectiles.Magic { @@ -93,15 +94,13 @@ namespace CalamityMod.Projectiles.Magic dust.noGravity = true; } } + if (Projectile.ai[2] < 1){ + for (int i = 0; i < 2; i++) { + Projectile.NewProjectile(Projectile.GetSource_OnHit(target), Projectile.Center, -Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedByRandom(0.5f) * Main.rand.NextFloat(3, 5), ModContent.ProjectileType(), 5, 0f, Projectile.owner); + } + Projectile.ai[2]++; + } - int heal = (int)Math.Round(hit.Damage * 0.05); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } public override void AI() diff --git a/Projectiles/Melee/TheMutilatorHoldoutProjectile.cs b/Projectiles/Melee/TheMutilatorHoldoutProjectile.cs index 40e88e0f1d..4a86c09dd1 100644 --- a/Projectiles/Melee/TheMutilatorHoldoutProjectile.cs +++ b/Projectiles/Melee/TheMutilatorHoldoutProjectile.cs @@ -93,14 +93,13 @@ namespace CalamityMod.Projectiles.Melee if (modItem.Charge > TheMutilator.MaximumCharge) { modItem.Charge = 0; - int healAmount = 1; int orbAmount = 30; if (orbAmount > 0) { float spreadAmount = MathHelper.ToRadians(360); for (var i = 0; i < orbAmount; i++) { - Projectile.NewProjectile(Projectile.GetSource_OnHit(target), target.Center, -angle.RotatedByRandom(spreadAmount) * 3.5f * Main.rand.NextFloat(0.75f, 1.25f), ModContent.ProjectileType(), healAmount, 0f, player.whoAmI); + Projectile.NewProjectile(Projectile.GetSource_OnHit(target), target.Center, -angle.RotatedByRandom(spreadAmount) * 3.5f * Main.rand.NextFloat(0.75f, 1.25f), ModContent.ProjectileType(), 22, 0f, player.whoAmI); } Particle bloodsplosion2 = new CustomPulse(target.Center, Vector2.Zero, new Color(255, 32, 32) * 0.75f, "CalamityMod/Particles/DustyCircleHardEdge", Vector2.One, Main.rand.NextFloat(-15f, 15f), 0.03f, 0.155f, 40); diff --git a/Projectiles/Ranged/BloodBoilerFire.cs b/Projectiles/Ranged/BloodBoilerFire.cs index af3ed087d8..5a1869b20e 100644 --- a/Projectiles/Ranged/BloodBoilerFire.cs +++ b/Projectiles/Ranged/BloodBoilerFire.cs @@ -7,6 +7,7 @@ using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Projectiles.Healing; namespace CalamityMod.Projectiles.Ranged { @@ -195,19 +196,9 @@ namespace CalamityMod.Projectiles.Ranged { if (Projectile.Hitbox.Intersects(player.Hitbox)) { - if (!Main.player[Projectile.owner].moonLeech) + if (improvedHeal) { - int bonusHeal = Main.rand.NextBool(3) ? 5 : 3; - int heal = improvedHeal ? bonusHeal : 2; - - if (Main.LocalPlayer.lifeSteal <= 0f) - { - Projectile.Kill(); - return; - } - - Main.LocalPlayer.lifeSteal -= heal; - player.HealPlayer(heal); + BloodstoneHealOrb.Heal(player, 8); } Projectile.Kill(); diff --git a/Projectiles/Ranged/ClaretCannonProj.cs b/Projectiles/Ranged/ClaretCannonProj.cs deleted file mode 100644 index d37c4265a0..0000000000 --- a/Projectiles/Ranged/ClaretCannonProj.cs +++ /dev/null @@ -1,77 +0,0 @@ -using CalamityMod.Balancing; -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class ClaretCannonProj : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 10; - ProjectileID.Sets.TrailingMode[Type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 14; - Projectile.height = 14; - Projectile.friendly = true; - Projectile.alpha = 255; - Projectile.penetrate = 1; - Projectile.timeLeft = 600; - Projectile.DamageType = DamageClass.Ranged; - Projectile.extraUpdates = 1; - Projectile.aiStyle = ProjAIStyleID.Arrow; - AIType = ProjectileID.Bullet; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0f / 255f); - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Dig, Projectile.position); - return true; - } - - public override void OnKill(int timeLeft) - { - for (int k = 0; k < 2; k++) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, Projectile.oldVelocity.X * 0.15f, Projectile.oldVelocity.Y * 0.15f); - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 120); - - int heal = (int)Math.Round(hit.Damage * 0.02); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); - return false; - } - } -} diff --git a/Projectiles/Rogue/BloodsoakedCrashax.cs b/Projectiles/Rogue/BloodsoakedCrashax.cs index b894edd6e7..090ef8dd38 100644 --- a/Projectiles/Rogue/BloodsoakedCrashax.cs +++ b/Projectiles/Rogue/BloodsoakedCrashax.cs @@ -127,7 +127,7 @@ namespace CalamityMod.Projectiles.Rogue float spreadAmount = MathHelper.ToRadians(360); for (var i = 0; i < orbAmount; i++) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.One.RotatedByRandom(spreadAmount) * 2f * Main.rand.NextFloat(0.75f, 1.25f), ModContent.ProjectileType(), 1, 0f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.One.RotatedByRandom(spreadAmount) * 2f * Main.rand.NextFloat(0.75f, 1.25f), ModContent.ProjectileType(), 20, 0f, Projectile.owner); } } diff --git a/Projectiles/Summon/BloodSpit.cs b/Projectiles/Summon/BloodSpit.cs index 057b6387c2..89167493d4 100644 --- a/Projectiles/Summon/BloodSpit.cs +++ b/Projectiles/Summon/BloodSpit.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 6; Projectile.DamageType = DamageClass.Summon; - Projectile.Calamity().BloodstoneOrbValue = 1; //Bloodstone Orb lifesteal. May want to go back to regular lifesteal. + Projectile.Calamity().BloodstoneOrbValue = 20; //Bloodstone Orb lifesteal. May want to go back to regular lifesteal. } public override void AI() @@ -50,16 +50,6 @@ namespace CalamityMod.Projectiles.Summon blood.velocity = Main.rand.NextVector2Circular(1f, 2f); blood.noGravity = true; } - //regular lifesteal code. Not sure if we wanna go back to it so I left it here. - /*int heal = (int)Math.Round(hit.Damage * 0.01); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); - */ } } } diff --git a/Projectiles/Typeless/ClaretCannonProj.cs b/Projectiles/Typeless/ClaretCannonProj.cs new file mode 100644 index 0000000000..06276d5180 --- /dev/null +++ b/Projectiles/Typeless/ClaretCannonProj.cs @@ -0,0 +1,92 @@ +using CalamityMod.Balancing; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Weapons.Typeless; +using CalamityMod.Projectiles.Healing; +using CalamityMod.Particles; + +namespace CalamityMod.Projectiles.Typeless +{ + public class ClaretCannonProj : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.alpha = 0; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.DamageType = AverageDamageClass.Instance; + Projectile.extraUpdates = 1; + Projectile.aiStyle = 0; + } + + public override void AI() + { + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0f / 255f); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + return true; + } + + public override void OnKill(int timeLeft) + { + if (Projectile.penetrate != -1) + return; + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/NPCKilled/PerfLargeDeath") { Volume = 0.5f }, Projectile.Center); + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/BloodPactCrit") { Volume = 0.5f }, Projectile.Center); + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), ClaretCannon.ClaretCooldownMax); + target.AddBuff(BuffID.BetsysCurse, ClaretCannon.ClaretCooldownMax*2); + if (Projectile.penetrate == -1) + return; + var player = Main.player[Projectile.owner]; + float orbCount = 20; + for (var i = 0; i < orbCount; i++) + { + Projectile.NewProjectile(Projectile.GetSource_OnHit(target), Projectile.Center, -Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedByRandom(1) * Main.rand.NextFloat(2.75f, 5.25f), ModContent.ProjectileType(), 20, 0f, player.whoAmI); + } + Projectile.position = Projectile.Center; + Projectile.Size = new Vector2(352); + Projectile.Center = Projectile.position; + Projectile.penetrate = -1; + Projectile.extraUpdates = 0; + Projectile.timeLeft = 2; + Projectile.velocity *= 0; + Projectile.damage /= 2; + float particleScale = 8f; + Particle bloodsplosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkRed, "CalamityMod/Particles/DetailedExplosion", Vector2.One, Main.rand.NextFloat(-15f, 15f), 0.16f*particleScale/5f, 0.87f * particleScale / 5f, (int)(40 * 0.38f), false); + GeneralParticleHandler.SpawnParticle(bloodsplosion); + Particle bloodsplosion2 = new CustomPulse(Projectile.Center, Vector2.Zero, new Color(255, 32, 32), "CalamityMod/Particles/DustyCircleHardEdge", Vector2.One, Main.rand.NextFloat(-15f, 15f), 0.03f * particleScale / 5f, 0.155f * particleScale / 5f, 40); + GeneralParticleHandler.SpawnParticle(bloodsplosion2); + } + + public override bool PreDraw(ref Color lightColor) + { + //CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + return true; + } + } +} diff --git a/Projectiles/Ranged/ClaretCannonProj.png b/Projectiles/Typeless/ClaretCannonProj.png similarity index 100% rename from Projectiles/Ranged/ClaretCannonProj.png rename to Projectiles/Typeless/ClaretCannonProj.png From 4d0bbd553a5338e70baf9cc4aff6a17ac2ea69bf Mon Sep 17 00:00:00 2001 From: Cameron Ewell Date: Sat, 3 May 2025 15:08:39 -0400 Subject: [PATCH 07/12] Fix Mutilator projectile name --- Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index c1cd99f172..692b19f7df 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -306,4 +306,4 @@ WulfrumScrew.DisplayName: Wulfrum Screw WulfrumScrewdriverProj.DisplayName: Wulfrum Screwdriver YinYoDark.DisplayName: Dark Shard YinYoLight.DisplayName: Light Shard -MutilatorSwordProj.DisplayName: Mutilator Sword Proj +MutilatorSwordProj.DisplayName: The Mutilator From fbbcaaee1a5d9d192dbfcd8d0e2a5ba5c701b261 Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Sat, 3 May 2025 15:28:12 -0500 Subject: [PATCH 08/12] fixed issues --- .../en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson | 6 ++++-- .../en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson | 2 +- .../en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson | 7 ++++--- .../en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson | 2 +- .../en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson | 2 +- Projectiles/Magic/SanguineFlareProj.cs | 11 ----------- Projectiles/Typeless/ClaretCannonProj.cs | 11 ----------- 7 files changed, 11 insertions(+), 30 deletions(-) diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index c3281c7438..927906d00d 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson @@ -753,7 +753,7 @@ SanguineFlare: { ''' Charges up a sanguine flare that gains power over time When striking an enemy, this flare causes a bloodsplosion and splits into blood orbs - Picking up these blood orbs reduces the duration of Potion Sickness + Picking up these blood orbs reduces the duration of [Potion Sickness] ''' } @@ -999,7 +999,9 @@ Viscera: { DisplayName: Viscera Tooltip: ''' - Fires a rapid barrage of piercing blood beams that heal you on enemy hit + Fires a rapid barrage of piercing blood beams + The first enemy struck by each beam will burst into blood orbs + Picking up these blood orbs reduces the duration of [Potion Sickness] Each successive beam in the barrage deals more damage The last beam of the barrage instead explodes upon hitting an enemy ''' diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 51182e117f..4e7f11d90c 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -1361,7 +1361,7 @@ TheMutilator: { ''' Striking enemies empowers The Mutilator, increasing its damage At full charge, striking enemies causes a blood orb explosion - Picking up these blood orbs reduces the duration of Potion Sickness + Picking up these blood orbs reduces the duration of [Potion Sickness] ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index d1821b8880..b758d92ecd 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -115,7 +115,7 @@ ArterialAssault: { ''' Fires a group of 5 homing blood arrows These blood arrows burst into blood orbs upon striking an enemy - Picking up these blood orbs reduces the duration of Potion Sickness + Picking up these blood orbs reduces the duration of [Potion Sickness] ''' } @@ -202,9 +202,10 @@ BloodBoiler: { DisplayName: Blood Boiler Tooltip: ''' - Fires twin streams of life stealing bloodfire that returns to you + Fires twin streams of bloodfire that returns to you + Retuning bloodfire reduces [Potion Sickness] if it struck an enemy Uses your health as ammo - 40% chance to save health + 20% chance to save health ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index 0f45c1dca0..cc686427ce 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -86,7 +86,7 @@ BloodsoakedCrasher: { Throws a bloody axe that is affected by gravity and can bounce twice The axe speeds up over time, but will slow down upon hitting an enemy Spews blood orbs upon enemy hits - Picking up these blood orbs reduces the duration of Potion Sickness + Picking up these blood orbs reduces the duration of [Potion Sickness] Stealth strikes spawn homing blood bolts on hit ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson index b9d505cc19..a3751a23b3 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -293,7 +293,7 @@ DragonbloodDisgorger: { ''' Summons a skeletal dragon and her two children Baby spits burst into blood orbs upon hitting an enemy - Picking up these blood orbs reduces the duration of Potion Sickness + Picking up these blood orbs reduces the duration of [Potion Sickness] Requires 6 minion slots to be summoned There can only be one family at a time ''' diff --git a/Projectiles/Magic/SanguineFlareProj.cs b/Projectiles/Magic/SanguineFlareProj.cs index 589fb92147..2f9ddfab3f 100644 --- a/Projectiles/Magic/SanguineFlareProj.cs +++ b/Projectiles/Magic/SanguineFlareProj.cs @@ -180,17 +180,6 @@ namespace CalamityMod.Projectiles.Magic Main.EntitySpriteDraw(lightTexture, drawPosition, null, innerColor, 0f, lightTexture.Size() * 0.5f, innerScale * 1.25f, SpriteEffects.None, 0); } } - - - /*if (Main.rand.NextBool(6) && Projectile.ai[1] == 0f) - { - Color smokeColor = Main.rand.NextBool() ? Color.Red : Color.Firebrick; - Vector2 smokePosition = Projectile.Center + Main.rand.NextVector2Circular(5 + Time * 0.3f, 5 + Time * 0.3f); - float smokeScale = Main.rand.NextFloat(0.5f, 1.6f); - float smokeOpacity = 170 + -Time * 0.6f; - Particle smoke = new MediumMistParticle(smokePosition, Vector2.Zero, smokeColor, Color.Black, smokeScale, smokeOpacity, Main.rand.NextFloat(0.2f, -0.2f)); - GeneralParticleHandler.SpawnParticle(smoke); - }*/ return false; } } diff --git a/Projectiles/Typeless/ClaretCannonProj.cs b/Projectiles/Typeless/ClaretCannonProj.cs index 06276d5180..9866a37afc 100644 --- a/Projectiles/Typeless/ClaretCannonProj.cs +++ b/Projectiles/Typeless/ClaretCannonProj.cs @@ -16,11 +16,6 @@ namespace CalamityMod.Projectiles.Typeless public class ClaretCannonProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 10; - ProjectileID.Sets.TrailingMode[Type] = 0; - } public override void SetDefaults() { @@ -82,11 +77,5 @@ namespace CalamityMod.Projectiles.Typeless Particle bloodsplosion2 = new CustomPulse(Projectile.Center, Vector2.Zero, new Color(255, 32, 32), "CalamityMod/Particles/DustyCircleHardEdge", Vector2.One, Main.rand.NextFloat(-15f, 15f), 0.03f * particleScale / 5f, 0.155f * particleScale / 5f, 40); GeneralParticleHandler.SpawnParticle(bloodsplosion2); } - - public override bool PreDraw(ref Color lightColor) - { - //CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); - return true; - } } } From 15bcd3077276e77aaf174908b416f238f6e95ecc Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Mon, 12 May 2025 17:32:09 -0500 Subject: [PATCH 09/12] lacerator work --- Projectiles/Melee/Yoyos/LaceratorYoyo.cs | 117 ++++++++++++++++++++++- 1 file changed, 116 insertions(+), 1 deletion(-) diff --git a/Projectiles/Melee/Yoyos/LaceratorYoyo.cs b/Projectiles/Melee/Yoyos/LaceratorYoyo.cs index 43b61fd17b..ef0c67e3a1 100644 --- a/Projectiles/Melee/Yoyos/LaceratorYoyo.cs +++ b/Projectiles/Melee/Yoyos/LaceratorYoyo.cs @@ -1,6 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.Linq; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -13,6 +17,20 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public const int MaxUpdates = 3; + private static int CircleRes = 60; + private static int VertRes = 4; + private static int SpikeCount = 8; + + private float circleProgress = 0; + private float verticalProgress = 1; + private bool goingUp = false; + public float chargeProgress = 0; + + private bool sawHit = false; + private bool spawnedBlood = false; + + private int sawDir = 0; + public override void SetStaticDefaults() { ProjectileID.Sets.YoyosLifeTimeMultiplier[Type] = -1f; @@ -33,16 +51,64 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Projectile.MaxUpdates = MaxUpdates; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 6 * MaxUpdates; + } public override void AI() { + if (sawDir == 0) + sawDir = Projectile.velocity.X < 0 ? -1 : 1; + if (chargeProgress > 1) + chargeProgress = 1; + if (chargeProgress > 0) + { + Main.NewText(sawDir); + if (Main.player[Projectile.owner].miscCounter % 5 == 0 && Projectile.FinalExtraUpdate() && chargeProgress > 0.15f) + { + spawnedBlood = false; + Projectile.position = Projectile.Center; + Projectile.width = 196; + Projectile.height = 196; + Projectile.Center = Projectile.position; + Projectile.originalDamage = Projectile.damage; + Projectile.damage = (int)(Projectile.damage * MathHelper.Lerp(0, 1f, chargeProgress)); + sawHit = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.aiStyle = -1; + Projectile.Damage(); + Projectile.aiStyle = ProjAIStyleID.Yoyo; + Projectile.usesIDStaticNPCImmunity = false; + sawHit = false; + Projectile.damage = Projectile.originalDamage; + Projectile.position = Projectile.Center; + Projectile.width = 16; + Projectile.height = 16; + Projectile.Center = Projectile.position; + } + chargeProgress -= 0.003f/Projectile.extraUpdates; + if (chargeProgress < 0) + chargeProgress = 0; + } + if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks Projectile.Kill(); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + if (sawHit) + { + target.AddBuff(ModContent.BuffType(), 60); + Vector2 bloodpos = Projectile.Center + Projectile.DirectionTo(target.Center) * 80; + if (!spawnedBlood && Main.rand.NextBool() && chargeProgress > 0.25f && target.Hitbox.Contains(bloodpos.ToPoint())) + { + Projectile.NewProjectile(Projectile.GetSource_OnHit(target), bloodpos, Projectile.DirectionTo(target.Center).RotatedBy(sawDir * - MathHelper.PiOver2 * 0.9f).RotatedByRandom(0.1f) * Main.rand.NextFloat(3f, 5f), ModContent.ProjectileType(), 1, 0f, Projectile.owner); + spawnedBlood = true; + } + return; + } + var baseYoyo = Main.projectile.First(x => x.active && x.type == ModContent.ProjectileType() && x.owner == Projectile.owner); + baseYoyo.ModProjectile().chargeProgress += (Main.player[Projectile.owner].yoyoGlove ? 0.05f : 0.1f); target.AddBuff(ModContent.BuffType(), 180); if (Main.player[Projectile.owner].moonLeech) @@ -56,6 +122,55 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(ref Color lightColor) { + if (chargeProgress > 0) + { + circleProgress = 0; + verticalProgress = 1; + goingUp = false; + Texture2D lightTexture = ModContent.Request("CalamityMod/ExtraTextures/SmallGreyscaleCircle").Value; + for (int i = 0; i < (CircleRes + VertRes * (SpikeCount+2))*Projectile.MaxUpdates; i++) + { + if (!goingUp) + { + circleProgress += 1f / (CircleRes * Projectile.MaxUpdates); + verticalProgress -= 1f / (CircleRes * Projectile.MaxUpdates) * SpikeCount; + if (verticalProgress <= 0) + { + goingUp = true; + //verticalProgress = 0; + circleProgress = MathF.Floor(circleProgress * SpikeCount) / SpikeCount; + } + } + else + { + verticalProgress += 1f / (VertRes * Projectile.MaxUpdates); + if (verticalProgress >= 1) + { + goingUp = false; + //verticalProgress = 1; + } + } + + Color color = new Color(131,0,0); + color.A = 255; + color *= 0.75f; + var center = Projectile.Center; + var owner = Main.player[Projectile.owner]; + Vector2 position = center + new Vector2(0, 64 + 32 * verticalProgress).RotatedBy((MathHelper.TwoPi * sawDir * circleProgress - (MathHelper.TwoPi * 3) * sawDir * (owner.miscCounter / 300f))); + Vector2 drawPosition = position + lightTexture.Size() * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY) + new Vector2(-32.5f, -32.5f); //Last vector is to offset the circle so that it is displayed where the hitbox actually is, instead of a bit down and to the right. + Color outerColor = color; + Color innerColor = color * 0.5f; + innerColor.A = 0; + float intensity = 0.9f + 0.15f * (float)Math.Cos(Main.GlobalTimeWrappedHourly * MathHelper.TwoPi); + intensity *= MathHelper.Lerp(0.15f, 1f, chargeProgress); + Vector2 outerScale = new Vector2(1f) * Projectile.scale * intensity; + Vector2 innerScale = new Vector2(1f) * Projectile.scale * intensity * 0.7f; + outerColor *= intensity; + innerColor *= intensity; + Main.EntitySpriteDraw(lightTexture, drawPosition, null, outerColor, 0f, lightTexture.Size() * 0.5f, outerScale * 0.25f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(lightTexture, drawPosition, null, innerColor, 0f, lightTexture.Size() * 0.5f, innerScale * 0.25f, SpriteEffects.None, 0); + } + } CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } From 195fe51285004b7cd0b0bb2093a1061ebb82125b Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Mon, 12 May 2025 18:24:33 -0500 Subject: [PATCH 10/12] pil saw --- Projectiles/Melee/LaceratorSaw.png | Bin 0 -> 2492 bytes Projectiles/Melee/Yoyos/LaceratorYoyo.cs | 17 +++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 Projectiles/Melee/LaceratorSaw.png diff --git a/Projectiles/Melee/LaceratorSaw.png b/Projectiles/Melee/LaceratorSaw.png new file mode 100644 index 0000000000000000000000000000000000000000..980815db3ee8c44c5c7851a8cd2da656dcd7548a GIT binary patch literal 2492 zcmZ8jdpMMN8~)7!vyL+w)TpbS=i-|zju&%ZXXMvF=;eY zfRH6}KnEfRATs4H!}fpm)@e*2urGC}Oj|*q04d`j8KQIGU+TwYdMoHMY|a0V|L>(h z_C1Of09@v<+-q$K;r+99YeJ6q&!!TY-U_H}5A=)E$H88v{++V2wA|_%QGY6^wrTAJ z0AWTW5f7(^F8??YKj(;a%a}W7{qD2NX(fszR5Tjlaec40(@qQ-f0A+Y;>Cfk?-SEZ zE<5;L%g#(-54`ANWt>ihgCh<5U*1@kTX+@!vE9r7xpc}|bygEFucXe$e@yVF0JMI@ zn@HPzg1`EiuD!TJz+MjmlF+|RfhT4aIlB!Sw@1RE3~udLv5%)fU3(5M>z4dVbUShg zUpoP68-gg-oCE%*j(Es$uCm{E#KK>1mIL~cu-1ksZOJ=psHMN0fZ3`Ut_v#4Xklrw z=9!=33}J4UQ-0s;-l+7heOdIiRIY}DX2EQDL5K(5ABxMj+p)@p@W%b?{UHJ7it>CiaMZC>k$L;!c409N*rU z0GqNgDuK4$HKT zxI&YiuaJG;KYCk{Pm3_rk%35hcTVNOowYiUw#wA_5Z=%_>5+3=e?dKPy#ti6NFS7Q zsTnE9Dw7=DzfEsB%Oi3sGzcSQXGlc>rev7>Kcjr~<9tvSJKlln_+NrgW zU^ON`K0SNtG~2%BuTi%LYgNt&U0$e22v(FiFNW5t>Je!tofUwwW$d_^KX!4@iJ!D zKR3Usu|}>u#p}>ilJvv0}(|HZbEnIM@Gq(l>Nv!R+ zxPH=n;2Zt_W==KfW$`c6sypc_5h~LjMi#hI2a{Wxv;9$%OtjtmY7nJe#qM9~t%}pG zI&)=Hhr^>DbG@?|lVd6Wlg<%JYNY{>L; zTU{TPD%+(zqg^$~m0oCwdb?QB7L3nKsoXZL#onQHq+OwrtDhc>f)7&(=&(*Xfy7!7 zoE_;4jbCjFRfCLK^fvJi!JEh6~yG^ zT-d&a7ey$*n1Pyv9N5G0?ZY}obSUERKV$A0%=-Qt5TN}%wT^E{hhJYo ziw(*5;?M{8bThI6J-QXoe7T4oobj0xYGz*!LMEl+4@IGKL<$U@EPKEa)k(bNsRuQdP1l zdDuR2Tl_R_Nq}{yLfIMIC?)p+gk`H-)>=BkueN}c!j_!iHG!DG6a86*1WTzcr?e?P zuZOa$K+b!jjnjuCNi{g7D=&(@#E#?Yi96ZU^E_;n3bFe-3!hgkJmgSV>g`}Usi#f2 zMCx-G#=sv0KfGEUk2Ry>gxD(S(rvh<%xm zi>kZdxheb6Bp3gvtPCZ1tm4DSx%}O33&itqdhN1Xq(M)!`ti9D3i6X{(O1K5YL~K+ z18E=YcV2C>5v4B9(Ed;n2#rc$v`GD)y$6|>FGm7ztIa`23~v6>+qE<&JiF^xj;q$4 zN90_G>h`pdW|zHePwZd$jeYt(AqOX?*6`nt)_}E_Wm6&ZlHnVO)zf|(FmFWg!P2Xb)8u*bS|!zje(`)Et{hG_SqHus0|CwT6z0Wl1D4;JS>@QjavyvD_7UTa9= z8gz?cfY@~+XigH8HHv7U+14ADT$|A)jEn@~tS#N!(7 zyQwB1_AUsmcu) z{V?eBpr1NAm~sz1_3>t(jzT7k(9b_VB`n?4J#}IgX=?}y<_kT!q9*4O{y1WxJ?PGf zHWxhtE6dm;%G}+MP22+`Naekc?*|4S3YoWqZlHK%5zGEt3VXwMTaCOvhh?fAK2#hS z?Zr07{i)-zRA=wjdr#u93H2uBf+$@Lb_G2qcj&byful`eaGi>E>${;{&Y&lAnchd@ sJ#w|TSrWr;%~Ezn?6~n5dgvu=L#^e_PQ_35a$jyMG_n`zrYoKEH;UaJ4FCWD literal 0 HcmV?d00001 diff --git a/Projectiles/Melee/Yoyos/LaceratorYoyo.cs b/Projectiles/Melee/Yoyos/LaceratorYoyo.cs index ef0c67e3a1..3ecd1e37c1 100644 --- a/Projectiles/Melee/Yoyos/LaceratorYoyo.cs +++ b/Projectiles/Melee/Yoyos/LaceratorYoyo.cs @@ -62,8 +62,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos chargeProgress = 1; if (chargeProgress > 0) { - Main.NewText(sawDir); - if (Main.player[Projectile.owner].miscCounter % 5 == 0 && Projectile.FinalExtraUpdate() && chargeProgress > 0.15f) + if (Main.player[Projectile.owner].miscCounter % 5 == 0 && Projectile.FinalExtraUpdate() && chargeProgress > 0.05f) { spawnedBlood = false; Projectile.position = Projectile.Center; @@ -99,10 +98,10 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if (sawHit) { target.AddBuff(ModContent.BuffType(), 60); - Vector2 bloodpos = Projectile.Center + Projectile.DirectionTo(target.Center) * 80; + Vector2 bloodpos = Projectile.Center + Projectile.DirectionTo(target.Center) * 84; if (!spawnedBlood && Main.rand.NextBool() && chargeProgress > 0.25f && target.Hitbox.Contains(bloodpos.ToPoint())) { - Projectile.NewProjectile(Projectile.GetSource_OnHit(target), bloodpos, Projectile.DirectionTo(target.Center).RotatedBy(sawDir * - MathHelper.PiOver2 * 0.9f).RotatedByRandom(0.1f) * Main.rand.NextFloat(3f, 5f), ModContent.ProjectileType(), 1, 0f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_OnHit(target), bloodpos, Projectile.DirectionTo(target.Center).RotatedBy(sawDir * MathHelper.PiOver2 * 0.9f).RotatedByRandom(0.1f) * Main.rand.NextFloat(3f, 5f), ModContent.ProjectileType(), 1, 0f, Projectile.owner); spawnedBlood = true; } return; @@ -124,7 +123,13 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { if (chargeProgress > 0) { - circleProgress = 0; + + var owner = Main.player[Projectile.owner]; + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Melee/LaceratorSaw").Value; + float rot = MathHelper.TwoPi * 30 * sawDir * (owner.miscCounter / 300f); + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, Color.Red * MathF.Pow(chargeProgress,0.5f)*0.5f, rot, texture.Size() * 0.5f, 1, sawDir == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0); + + /*circleProgress = 0; verticalProgress = 1; goingUp = false; Texture2D lightTexture = ModContent.Request("CalamityMod/ExtraTextures/SmallGreyscaleCircle").Value; @@ -169,7 +174,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos innerColor *= intensity; Main.EntitySpriteDraw(lightTexture, drawPosition, null, outerColor, 0f, lightTexture.Size() * 0.5f, outerScale * 0.25f, SpriteEffects.None, 0); Main.EntitySpriteDraw(lightTexture, drawPosition, null, innerColor, 0f, lightTexture.Size() * 0.5f, innerScale * 0.25f, SpriteEffects.None, 0); - } + }*/ } CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; From 4329e05a3eda640a7575e72c791a3839b76c2141 Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Mon, 19 May 2025 08:50:40 -0500 Subject: [PATCH 11/12] lacerator fin --- ...Mods.CalamityMod.Items.Weapons.Melee.hjson | 6 +- Projectiles/Melee/LaceratorSaw.png | Bin 2492 -> 3050 bytes Projectiles/Melee/Yoyos/LaceratorYoyo.cs | 79 +++++------------- 3 files changed, 26 insertions(+), 59 deletions(-) diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 4e7f11d90c..8090397bd9 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -803,7 +803,11 @@ Lacerator: { Tooltip: ''' {$Common.YoyoStatsInfinite} - Accelerates natural life regeneration on hits with the yoyo + Striking enemies conjures a bloody saw to shred them + The saw does more damage the more often the yoyo hits, and fades away when not striking enemies + Enemies touching the edge of the sawblade get blood orbs torn out of them + Picking up these blood orbs reduces the duration of [Potion Sickness] + The direction of the saw's spin depends on which direction you originally threw the yoyo [GFB] ''' TooltipNormal: Someone thought this was a viable weapon against DoG at one point lol diff --git a/Projectiles/Melee/LaceratorSaw.png b/Projectiles/Melee/LaceratorSaw.png index 980815db3ee8c44c5c7851a8cd2da656dcd7548a..4963c7e8f21507e22f293a3f9e8bfa1ec23cb1be 100644 GIT binary patch delta 2814 zcmV1 zj~)B{{TE;+-LhCs9t3{{@XscqD3ljg2B3fN@wOLNrgwHr}}% zJGPqDI`5-IrT`i+GgwFBeUnI}tz#UNp@n*Xsl1 zL2cA%ehxqc8l3?EK@BY~TW6E&BLM6n$XGN#w-0#`?GU)gApjPgd2)RW0N%j3SRbcW zSb_w96b zfVha^?F$ey`%tuPy}w8MF^VQ((*V&tUIoBL#2YDVTOFX8gVY>=2;C4GZ(k81 zPVGkfD*_<&k!?yAqdjS6KTakfb>E24Ney~^0Nlc6_EEj}WU;p?gzk(1)TPyhbMwiH z6T7ID0DymRJ5-j{6f4(Wv_CUShUf!<@FxnSDv^)dAwgH^S zU#MvC#Fs28H3A^d2!JRdtOO93l71|MvaxJgd;NbvO8XhWU#rB4vr1@R_958y;+BKU ziU4&n`R9+*&jGm4cg0u&pqMFl+?rqe5de1e5EV+|h`aGB0JN`L7sI*=Y`lsfo7>WG zbOcMuc--e=xj1R0*u6cySq*^pV=&&kieyr;mKqi#hTJh2$3;c6-qlNw_=9J z0C{o03V@~&8nF5%l$F!keg~kb8@7qS9L%foj}cHlFK*TV2p`COB3HcMRQzuMGQd(c zHrgjbmnqwy0dR_w7xyawj5?jN@%UaVhnRo9I}40xUyFE`f~x%rz*tS`ir2hLy*L2= z%WSkC?dZ`C8t|6w=ZZ0T7y*dDm};G>Sr8q6^b2n5ffoi~2Syj30Yo`9Q50FL9y_rC zs%_jTy`@~rI|5+vSp@(?>9&^q<0-E!O1as@t*!wf0}W^U%ul0?zn098G} zBLr6R8~|c#dCK+~&4$C*`jyt*Z9VYf031d;`+ER5s}FjH5Y5Lf+$)w)hR*(K0Qv)i zspd_!5(;N*u2w2JLiT6*s945XatG#6x)K2FcT+hjSK;*hCxhDRB>O0lvsJN1l!*@L z4iNkrXe|IwtLJhB*%n{%@X~)Af#!X?i*~DOy^^MKn$WET@Qi&`iY?pX1NGSEtE?)* z*5lEy0MNGfGzDD=AcybE)?nX{kd2n3Y#*w&rCOJi?XL`=PO_B@8i!3k!Y2U5M(Zq_ z0cHp~n`KAnzFvf_27oZ$u*apn4RG;+P8%PjXJ^i3tXMimJ!gOW?d5+iFT&OVfL)ru zpSV5Z=<4tu2TlK{Hg{p1uT@i>^{jmWP2@CjW+*H^X#7#ohI%4g;wo=M&U00#m? zIYO6D5b;8<31Isy4k1C;d97LJwV7z&TeeRGBPk;OP>$PJ8Em5U`=Qqc;NlWeaR?8} zRLfTVsxVrUm3XGc$i8le8Nl|reFOj%~`Mt490WUmGBPy@Em* zx_Sg|>m#=*sSbwqJhW#Y;^J}7{>lKpaqvOp2*9O0r*&*3vSh;s$fm8w_PKzWEhec| z0Z@1gNq^RtwzY@jG(uAqpqjP_UQI`NaZ6z-S?#X}AOr{EBZM8K6oRZ%Je#KqqdNOi zaJ?yB!aWT^ivfScpPi64A`qgpnU7I3^HjBu63-zFAukU=gb1K%g(r3qp&F%Nw3^aw z4TfXv%sy|V)m>E+@bUma(7SJI99&s}0iuzt(bf#M#^Q)B*<*zE^veTCnp!I*ZYQc{ zuK_{Pl2l`)7{d#t$s4wL0~>E))R6!*wNpc)HWx`T!m58!l!sAXB2VZk;EaW{CU;bCtD78jaar*qv={t*Dsh4SP&cCk3% zWyyA$vz18%rwei47fOTYd;q1^1`xsw02SiZ7TA2Ct>tX02r{qoyjAABK->q*;{PF-0|Fnbmi9r1n!ndY-h) Q000UA07*qoM6N<$f~jvMN&o-= delta 2251 zcmV;+2sHQV7rYaYK~f%2OjJcKE-wH7|JBviN=izosHpJp@XE@{o12@3g@phB0F84u z$p8QV3UpFVQ~&?}|NsC0|Nj88%q-6U000SaNLh0L01m?d01m?e$8V@)k(YK3U;qFB z0RR91U;qFB0RWR50a|}0N1lzNG_}P500=8dL_t(|UhSOOa^pG>Lw)0kGxPsHd<#b4 zUf9%POQ|v$JR}xHHgROGl9J26lXQ6~pE*{ig@1E^%jLgseSCNX09~&>=d1b!=;?C# zxGN$M?0P*8;uipBq+yJb&hoFJ92JmUP5YINM*#N4qT1GR1Pgg2BHUZFx3|50dj=ip# z0AO8TwXbLy;PW#AFjob@X0;b#9srt`Nnd$xEPwuRBLhR9chNFRunY6J?bt~B1*oMd zi`7)igI2d2?F)YaOFDI79OcIL3$QE>ph9R3FiqAaL%%>aM!41(p)_Mxo^d2u}l04FeR*4w4klFU4%bZ=eSf{-81BBezb4Ipk}xOm%U zAIig~(qk&Mj$q4on@&du@S7M`1Bhk&UteEeb`(v%ijbFfqXT67RmiNre*thN0*;m1 z+8+_X7g*NcZ=H+a%gz9RDXb2WCHp^z;1?FAkpO>ya8F9x>Pp`JPayQ{j|N~`TR>!h za}lzA-<3xNfcgm8JarZVenAxf zup&{@aV*PBAeMjJ zu^)k@k*X3r9t%L5dC6yuLPyMYv$BO(5!z-HH}|6eXc?h^%Iw9Va2cU~r2QI#Z$|hT zH#cJdxG!X3At!)7f`7nq90G@6HXSH#?ni$BXjN}!44_8H51EceKyF;#$4Qa@Ce%4<6nO} z=;ep;HI%2#EAvU5G!6N2YW|eys0NVG36>3Qt!B@u|I%3QgAp=AN z9}mh1%r^?aw&vq++49&U(2~R)I%3?6aJzB)>802$Kty0J_#P3!2l9f^HpK(%MZf~k z>ZBCgBAL8>4m-dER_gW5R^;yM**-+{XOa8 zCwxg}>(q8RosU_uAsDoCf0xoNl4ParM#TFAa9hv_Om76{T3E@z@a1g?o=fpY zZOVa;Krs6?f|apyio`}HjRjEIw}QtZMEezjmGI?|PTM-x5_BYhM~t8xXbnNbsc$xl zkj+y$j+Ib3D%u|zK%GR#InaL=1jt*-rlWEkD@P&C9HIN#CTuhSWaEU5&pF_uhE)V8 z+gwtP69KT4jOp0DGPHej?rA z`WXZt!voZt8E6y$cHluWY*4H+K zCd=Cc5Wxd*O3UG;76IxZY!|1mb%Y|r+XDbWzinFM;97yy2(L*sts|7D-yT5H(pn)g zot%rHY1C@r3yIYfM$H7ErQLZ5yhOI3S8BV6Hq8RymsYs~>UDnvyF^$v`$p8aKMQ~# z%=(MFR}uV0irbjJ{TTqzh2rAcH=sDR?M1k+7D6<;P#Qe@11L2%fDn2Bs1QHR!X5;f zS9wmAvHo?f6nJ|8B4hwnjOy6o%oYJ+)2M{=+^qZM!+wO->~9ai?xfE&8!L;=D!!T* zO?&x4(=H0q*E@f%*9-t&Hnr6T*f22pcnq%=AYTIHTAsYTW(CMiAT}%hV*%ME6y*Qi zK%2fI%$-K>G$zYCZrW z_>N|_TB{MDMc8jRYes 0.05f) + { + float particleSize = 0.9f + 0.15f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 60f * MathHelper.TwoPi); + particleSize *= 0.5f; + var particlePos = Projectile.Center + new Vector2(0, 84).RotatedByRandom(MathHelper.TwoPi); + var particleVel = particlePos.DirectionTo(Projectile.Center).RotatedBy(-sawDir * MathHelper.PiOver2 * 0.9f).RotatedByRandom(0.1f) * Main.rand.NextFloat(15f, 25f); + Particle blood = new CustomSpark(particlePos, particleVel, "CalamityMod/Particles/PearlParticleGlow", false, (int)MathHelper.Lerp(7, 17, chargeProgress), particleSize, Color.DarkRed, new Vector2(0.5f, 1), false, false, 0, false, false, 0f); + GeneralParticleHandler.SpawnParticle(blood); + } + chargeProgress -= 0.003f / Projectile.extraUpdates; if (chargeProgress < 0) chargeProgress = 0; } @@ -99,7 +110,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { target.AddBuff(ModContent.BuffType(), 60); Vector2 bloodpos = Projectile.Center + Projectile.DirectionTo(target.Center) * 84; - if (!spawnedBlood && Main.rand.NextBool() && chargeProgress > 0.25f && target.Hitbox.Contains(bloodpos.ToPoint())) + if (!spawnedBlood && Main.rand.NextBool() && chargeProgress > 0.2f && target.Hitbox.Contains(bloodpos.ToPoint())) { Projectile.NewProjectile(Projectile.GetSource_OnHit(target), bloodpos, Projectile.DirectionTo(target.Center).RotatedBy(sawDir * MathHelper.PiOver2 * 0.9f).RotatedByRandom(0.1f) * Main.rand.NextFloat(3f, 5f), ModContent.ProjectileType(), 1, 0f, Projectile.owner); spawnedBlood = true; @@ -109,12 +120,6 @@ namespace CalamityMod.Projectiles.Melee.Yoyos var baseYoyo = Main.projectile.First(x => x.active && x.type == ModContent.ProjectileType() && x.owner == Projectile.owner); baseYoyo.ModProjectile().chargeProgress += (Main.player[Projectile.owner].yoyoGlove ? 0.05f : 0.1f); target.AddBuff(ModContent.BuffType(), 180); - - if (Main.player[Projectile.owner].moonLeech) - return; - - Player player = Main.player[Projectile.owner]; - player.lifeRegenTime += 2; } public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); @@ -123,58 +128,16 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { if (chargeProgress > 0) { - var owner = Main.player[Projectile.owner]; Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Melee/LaceratorSaw").Value; + Texture2D WindTexture = ModContent.Request("CalamityMod/Projectiles/Melee/BlazingPhantomBlade").Value; float rot = MathHelper.TwoPi * 30 * sawDir * (owner.miscCounter / 300f); - Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, Color.Red * MathF.Pow(chargeProgress,0.5f)*0.5f, rot, texture.Size() * 0.5f, 1, sawDir == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0); - - /*circleProgress = 0; - verticalProgress = 1; - goingUp = false; - Texture2D lightTexture = ModContent.Request("CalamityMod/ExtraTextures/SmallGreyscaleCircle").Value; - for (int i = 0; i < (CircleRes + VertRes * (SpikeCount+2))*Projectile.MaxUpdates; i++) - { - if (!goingUp) - { - circleProgress += 1f / (CircleRes * Projectile.MaxUpdates); - verticalProgress -= 1f / (CircleRes * Projectile.MaxUpdates) * SpikeCount; - if (verticalProgress <= 0) - { - goingUp = true; - //verticalProgress = 0; - circleProgress = MathF.Floor(circleProgress * SpikeCount) / SpikeCount; - } - } - else - { - verticalProgress += 1f / (VertRes * Projectile.MaxUpdates); - if (verticalProgress >= 1) - { - goingUp = false; - //verticalProgress = 1; - } - } - - Color color = new Color(131,0,0); - color.A = 255; - color *= 0.75f; - var center = Projectile.Center; - var owner = Main.player[Projectile.owner]; - Vector2 position = center + new Vector2(0, 64 + 32 * verticalProgress).RotatedBy((MathHelper.TwoPi * sawDir * circleProgress - (MathHelper.TwoPi * 3) * sawDir * (owner.miscCounter / 300f))); - Vector2 drawPosition = position + lightTexture.Size() * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY) + new Vector2(-32.5f, -32.5f); //Last vector is to offset the circle so that it is displayed where the hitbox actually is, instead of a bit down and to the right. - Color outerColor = color; - Color innerColor = color * 0.5f; - innerColor.A = 0; - float intensity = 0.9f + 0.15f * (float)Math.Cos(Main.GlobalTimeWrappedHourly * MathHelper.TwoPi); - intensity *= MathHelper.Lerp(0.15f, 1f, chargeProgress); - Vector2 outerScale = new Vector2(1f) * Projectile.scale * intensity; - Vector2 innerScale = new Vector2(1f) * Projectile.scale * intensity * 0.7f; - outerColor *= intensity; - innerColor *= intensity; - Main.EntitySpriteDraw(lightTexture, drawPosition, null, outerColor, 0f, lightTexture.Size() * 0.5f, outerScale * 0.25f, SpriteEffects.None, 0); - Main.EntitySpriteDraw(lightTexture, drawPosition, null, innerColor, 0f, lightTexture.Size() * 0.5f, innerScale * 0.25f, SpriteEffects.None, 0); - }*/ + var color = new Color(200, 200, 200); + var frame = WindTexture.Frame(1, 4, 0, 0); + Main.EntitySpriteDraw(WindTexture, Projectile.Center - Main.screenPosition + rot.ToRotationVector2() * 30, frame, color * MathF.Pow(chargeProgress, 0.5f) * 0.33f, rot - 0.2f * sawDir, new Vector2(frame.Width, frame.Height) * 0.5f, 1, sawDir == -1 ? SpriteEffects.FlipVertically : SpriteEffects.None, 0); + Main.EntitySpriteDraw(WindTexture, Projectile.Center - Main.screenPosition + (rot + MathHelper.Pi).ToRotationVector2() * 30, frame, color * MathF.Pow(chargeProgress, 0.5f) * 0.33f, (rot + MathHelper.Pi) - 0.2f * sawDir, new Vector2(frame.Width, frame.Height) * 0.5f, 1, sawDir == -1 ? SpriteEffects.FlipVertically : SpriteEffects.None, 0); + color = new Color(255, 10, 10); + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, color * MathF.Pow(chargeProgress, 0.5f) * 1f, rot, texture.Size() * 0.5f, 1, sawDir == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0); } CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; From ea78114d31bedf4ab5d5919a5cc1e138de2ca346 Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Mon, 19 May 2025 09:59:48 -0500 Subject: [PATCH 12/12] merge cleanup --- Projectiles/Typeless/ClaretCannonProj.cs | 83 +----------------------- 1 file changed, 1 insertion(+), 82 deletions(-) diff --git a/Projectiles/Typeless/ClaretCannonProj.cs b/Projectiles/Typeless/ClaretCannonProj.cs index 790a67128b..0d9c72c6a4 100644 --- a/Projectiles/Typeless/ClaretCannonProj.cs +++ b/Projectiles/Typeless/ClaretCannonProj.cs @@ -78,85 +78,4 @@ namespace CalamityMod.Projectiles.Typeless GeneralParticleHandler.SpawnParticle(bloodsplosion2); } } -} -using CalamityMod.Balancing; -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Weapons.Typeless; -using CalamityMod.Projectiles.Healing; -using CalamityMod.Particles; - -namespace CalamityMod.Projectiles.Typeless -{ - public class ClaretCannonProj : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - - public override void SetDefaults() - { - Projectile.width = 14; - Projectile.height = 14; - Projectile.friendly = true; - Projectile.alpha = 0; - Projectile.penetrate = 1; - Projectile.timeLeft = 600; - Projectile.DamageType = AverageDamageClass.Instance; - Projectile.extraUpdates = 1; - Projectile.aiStyle = 0; - } - - public override void AI() - { - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0f / 255f); - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Dig, Projectile.position); - return true; - } - - public override void OnKill(int timeLeft) - { - if (Projectile.penetrate != -1) - return; - SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/NPCKilled/PerfLargeDeath") { Volume = 0.5f }, Projectile.Center); - SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/BloodPactCrit") { Volume = 0.5f }, Projectile.Center); - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), ClaretCannon.ClaretCooldownMax); - target.AddBuff(BuffID.BetsysCurse, ClaretCannon.ClaretCooldownMax*2); - if (Projectile.penetrate == -1) - return; - var player = Main.player[Projectile.owner]; - float orbCount = 20; - for (var i = 0; i < orbCount; i++) - { - Projectile.NewProjectile(Projectile.GetSource_OnHit(target), Projectile.Center, -Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedByRandom(1) * Main.rand.NextFloat(2.75f, 5.25f), ModContent.ProjectileType(), 20, 0f, player.whoAmI); - } - Projectile.position = Projectile.Center; - Projectile.Size = new Vector2(352); - Projectile.Center = Projectile.position; - Projectile.penetrate = -1; - Projectile.extraUpdates = 0; - Projectile.timeLeft = 2; - Projectile.velocity *= 0; - Projectile.damage /= 2; - float particleScale = 8f; - Particle bloodsplosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkRed, "CalamityMod/Particles/DetailedExplosion", Vector2.One, Main.rand.NextFloat(-15f, 15f), 0.16f*particleScale/5f, 0.87f * particleScale / 5f, (int)(40 * 0.38f), false); - GeneralParticleHandler.SpawnParticle(bloodsplosion); - Particle bloodsplosion2 = new CustomPulse(Projectile.Center, Vector2.Zero, new Color(255, 32, 32), "CalamityMod/Particles/DustyCircleHardEdge", Vector2.One, Main.rand.NextFloat(-15f, 15f), 0.03f * particleScale / 5f, 0.155f * particleScale / 5f, 40); - GeneralParticleHandler.SpawnParticle(bloodsplosion2); - } - } -} +} \ No newline at end of file