diff --git a/Items/Weapons/Magic/SanguineFlare.cs b/Items/Weapons/Magic/SanguineFlare.cs index bc7827c338..8ec88cc393 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 = 1000; 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..36f630ecd4 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.damage = 1111; 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/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 9a37c667b7..79856f0ca1 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; @@ -13,14 +15,16 @@ 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; Item.height = 100; - Item.damage = 110; + Item.damage = 500; 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; @@ -34,52 +38,20 @@ 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) { - 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); + 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); shotArrow.noDropItem = true; shotArrow.tileCollide = false; - shotArrow.Calamity().conditionalHomingRange = 300f; + (shotArrow.ModProjectile as BloodfireArrowProj).DisableEffects = true; + shotArrow.Calamity().conditionalHomingRange = 175f; + 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.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index e3103c79a5..927906d00d 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: { @@ -994,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 fbba76be1c..4e7f11d90c 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..b758d92ecd 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] ''' } @@ -201,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 ''' } @@ -271,15 +273,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.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index 2d5549e4c7..cc686427ce 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..a3751a23b3 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.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.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..692b19f7df 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: The Mutilator 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/NPCs/ExoMechs/Thanatos/ThanatosHead.cs b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs index 3c7fa5266d..d4eb16b82b 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs @@ -33,6 +33,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public static readonly SoundStyle LaserSound = new("CalamityMod/Sounds/Custom/ExoMechs/THanosLaser"); + public static readonly SoundStyle GFBeam = new("CalamityMod/Sounds/Custom/ExoMechs/THanosGFBeam"); + + public static readonly SoundStyle ThanatosHitSoundOpen = new("CalamityMod/Sounds/NPCHit/ThanatosHitOpen", 2) { Volume = 0.5f }; public static readonly SoundStyle ThanatosHitSoundClosed = new("CalamityMod/Sounds/NPCHit/ThanatosHitClosed", 3) { Volume = 0.4f }; @@ -903,7 +906,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { //Commented out in case we decide its better for it to simply play from anywhere in range //if (Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < soundDistance) - LaserSoundSlot = SoundEngine.PlaySound(LaserSound, NPC.Center); + LaserSoundSlot = SoundEngine.PlaySound((Main.zenithWorld ? GFBeam : LaserSound), NPC.Center); // Create a bunch of lightning bolts in the sky ExoMechsSky.CreateLightningBolt(12); diff --git a/Projectiles/BaseProjectiles/BaseCustomMeleeSwingProjectile.cs b/Projectiles/BaseProjectiles/BaseCustomMeleeSwingProjectile.cs new file mode 100644 index 0000000000..73c7b4c53b --- /dev/null +++ b/Projectiles/BaseProjectiles/BaseCustomMeleeSwingProjectile.cs @@ -0,0 +1,497 @@ +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; + 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 + /// + /// 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 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 + /// + /// + /// + 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(); + + 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)); + oldScale.Insert(0, Projectile.scale); + } + 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((int)MathHelper.Min(trailLength,swingTimer)).ToArray(); + for (var i = 0; i < positionsToUse.Length; i++) + { + 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); + 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); + } + + public override bool? CanDamage() + { + return inSwing; + } + #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..9cbf6a12c9 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,10 @@ namespace CalamityMod.Projectiles #region On Hit NPC public override void OnHitNPC(Projectile projectile, NPC target, NPC.HitInfo hit, int damageDone) { + 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(), 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 new file mode 100644 index 0000000000..6edd4ff6f5 --- /dev/null +++ b/Projectiles/Healing/BloodstoneHealOrb.cs @@ -0,0 +1,131 @@ +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 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() + { + 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 (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) + { + 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) + { + 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 static void Heal(Player player, int PotionTime) + { + var cplayer = player.Calamity(); + if (player.potionDelay > 0) + { + player.potionDelay -= PotionTime; + 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 += 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) + { + return false; + } + } +} diff --git a/Projectiles/Magic/SanguineFlareProj.cs b/Projectiles/Magic/SanguineFlareProj.cs index 4926c62ddd..2f9ddfab3f 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,48 +27,74 @@ 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) + 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; + } + + } + + } else { - 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; + 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 Color? GetAlpha(Color lightColor) + public override bool? CanDamage() { - return new Color(200, 60, 60, Projectile.alpha); + 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; @@ -95,23 +123,63 @@ 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(), 20, 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 = 2; + Projectile.velocity *= 0; + Projectile.damage /= 2; + 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, 40); + 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 + 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; + 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 * 1.25f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(lightTexture, drawPosition, null, innerColor, 0f, lightTexture.Size() * 0.5f, innerScale * 1.25f, SpriteEffects.None, 0); + } + } return false; } } 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 new file mode 100644 index 0000000000..4a86c09dd1 --- /dev/null +++ b/Projectiles/Melee/TheMutilatorHoldoutProjectile.cs @@ -0,0 +1,114 @@ +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 => 20; + + 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() + { + 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() + { + 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) + { + 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 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(), 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); + GeneralParticleHandler.SpawnParticle(bloodsplosion2); + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/BloodPactCrit") { Volume = 0.5f }, player.Center); + } + } + modItem.DecayTimer = 180; + } + } + } +} 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/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/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 4884fc3f27..090ef8dd38 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(), 20, 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..89167493d4 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 = 20; //Bloodstone Orb lifesteal. May want to go back to regular lifesteal. } public override void AI() @@ -49,15 +50,6 @@ namespace CalamityMod.Projectiles.Summon blood.velocity = Main.rand.NextVector2Circular(1f, 2f); blood.noGravity = true; } - - 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..9866a37afc --- /dev/null +++ b/Projectiles/Typeless/ClaretCannonProj.cs @@ -0,0 +1,81 @@ +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); + } + } +} 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 diff --git a/Sounds/Custom/ExoMechs/THanosGFBeam.ogg b/Sounds/Custom/ExoMechs/THanosGFBeam.ogg new file mode 100644 index 0000000000..6bd2111021 Binary files /dev/null and b/Sounds/Custom/ExoMechs/THanosGFBeam.ogg differ