From 22d97c1119d1e28617a88f1c0d4996edc778b1d8 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Sun, 5 May 2024 17:13:58 -0400 Subject: [PATCH 1/3] Start of Triploon revival * Launches three gravity-affected harpoons that stick into enemies and inflict Laceration * Releasing left click rips the harpoons out of struck enemies, which is a guaranteed crit and scales in damage based on player velocity * Triploon is used to craft Elemental Saw --- Items/Weapons/Ranged/ElementalSaw.cs | 1 + Items/Weapons/Ranged/Triploon.cs | 53 ++++++ Items/Weapons/Ranged/Triploon.png | Bin 0 -> 1717 bytes ...ods.CalamityMod.Items.Weapons.Ranged.hjson | 14 +- .../Mods.CalamityMod.Projectiles.Ranged.hjson | 1 + Projectiles/Ranged/TriploonHoldout.cs | 83 +++++++++ Projectiles/Ranged/TriploonSpear.cs | 160 ++++++++++++++++++ Projectiles/Ranged/TriploonSpear.png | Bin 0 -> 351 bytes Utilities/GenericAIUtils.cs | 2 +- 9 files changed, 311 insertions(+), 3 deletions(-) create mode 100644 Items/Weapons/Ranged/Triploon.cs create mode 100644 Items/Weapons/Ranged/Triploon.png create mode 100644 Projectiles/Ranged/TriploonHoldout.cs create mode 100644 Projectiles/Ranged/TriploonSpear.cs create mode 100644 Projectiles/Ranged/TriploonSpear.png diff --git a/Items/Weapons/Ranged/ElementalSaw.cs b/Items/Weapons/Ranged/ElementalSaw.cs index 8353010df1..8dfd794b01 100644 --- a/Items/Weapons/Ranged/ElementalSaw.cs +++ b/Items/Weapons/Ranged/ElementalSaw.cs @@ -131,6 +131,7 @@ namespace CalamityMod.Items.Weapons.Ranged CreateRecipe(). AddIngredient(). AddIngredient(). + AddIngredient(). AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). AddIngredient(5). diff --git a/Items/Weapons/Ranged/Triploon.cs b/Items/Weapons/Ranged/Triploon.cs new file mode 100644 index 0000000000..85e30fb096 --- /dev/null +++ b/Items/Weapons/Ranged/Triploon.cs @@ -0,0 +1,53 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class Triploon : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Ranged"; + + public override void SetStaticDefaults() + { + ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + } + + public override void SetDefaults() + { + Item.width = 88; + Item.height = 48; + Item.damage = 50; + Item.useTime = 30; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Shoot; + Item.DamageType = DamageClass.Ranged; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.channel = true; + Item.knockBack = 1f; + Item.rare = ItemRarityID.Lime; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; + } + + public override bool CanShoot(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Harpoon, 3). + AddIngredient(15). + AddIngredient(15). + AddIngredient(5). + AddTile(TileID.MythrilAnvil). + Register(); + } + } +} diff --git a/Items/Weapons/Ranged/Triploon.png b/Items/Weapons/Ranged/Triploon.png new file mode 100644 index 0000000000000000000000000000000000000000..c5e054a3985bc8091880c5b23091e4316adb5718 GIT binary patch literal 1717 zcmV;m21@yfP)Px*Z%IT!RCt{2n_FyDMHt6_hwgT}P}W{31zNdUxkyP!&}gXvFCo!rjK(x3K2+-i znrK4w#c1LK2EvQRL|=H2NP;mTycmrn#wdgq2`?njDCOE>3$(NadfQ&MtPiu_c4s=X z+d@x4bAB(UJ7;Fj*`EJ=^L^j>*26(jbP)iH7MBAsG&+=Y^)>J^KU`@)KgD4WCh~vC z#jW^tYx|s;yqSQ>gvz^OV+aS=GbZ=bwH)EPo~e5~Fv#%=t`Q zPy9h)X=RoABdIjl*L&Nwf;~q&5GdGp(*J#VVq+s?0K^A|vnu!d{RaW4d}O(G;`R%z z*7iuWzylbG4{Pl%MW>ZCZ-F}I90>!^+I3AEVA@{6RBRSyo3_kqt0PgR)Y!850Q9wW zt8ok0=%c&NYV(*%oF9&;W4=1ZQpdj05divA$D!mn0ON_oRJ|n)*IpAS*k{sS#Es5m z65y-t8vtl*Qa0_^juCA@+xdUA&!SvWtk@_~zDwB|?N-Hv=6W7LUt50?V14~s?fk8a z?P{K`bdz8lZ-EI#m|n`|Ql)6I zxvxF*p7YB9Tt0OMfSqr2ThDL#;1U3Dz5hYLdQ9!Q@*9jEtGv3n5swBXv1CIl+YmeGB#fFH2#XlBA z;bz1pPgW3bM37zBM3iCf&cdB1RiriNM4t1@*yc0uM-czsyxybXUSRTle|Av!CIoYS z*@MapLV+JV8>AI%MsOygXfqPq_sQlNxe-|rE^0n}0)XRRo}7{EnYi|vT!?ohR88jn&rven)f}5vvF8Hz|RFea2~nO%h`XYrC0yczyj6 zYd`U?KmAxmN@gyjagWMnG#bu?8T*S(6+c(9aKdawbWQ29uD+CJmnJMQYOk~&YEo%c{-D4^T(cY-Mk#W>JG}HD9V6(tzk!1PXE<%J>q*B@*`|5rDgtWW|F@>(45iK%S-p?@rCcFUu+L1}4;I_G6#dsc z;zeXI)d=jac+h_-Dg+AlnY)hUgy;fQFCh_}$$$OV_V-GlV4wLHX9t_gV-4KM00000 LNkvXXu0mjf99BW| literal 0 HcmV?d00001 diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index 88c9075d7c..293f9142e6 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -447,7 +447,7 @@ ElementalSaw: { Hold to rev up an elemental buzzsaw that deals close-range damage Release to fire the buzzsaw to pierce through and lacerate foes Fired buzzsaws bounce off tiles and return to the player after winding down - When returning, the saws release extra homing bolts depending on the number of enemy hits + When returning, the saws release extra homing bolts depending on the number of enemy and tile hits Revving up the saws increase their damage and allow them to pierce more enemies ''' AltInfo: @@ -455,7 +455,7 @@ ElementalSaw: { Press to eject a lingering buzzsaw towards the cursor that fires homing bolts Using this ability rapidly propels you in the direction you are moving This ability has a {0} second cooldown - During this cooldown, buzzsaws have homing and constantly release homing bolts while returning + During this cooldown, buzzsaws home to the cursor and constantly release homing bolts while returning ''' } @@ -1341,6 +1341,16 @@ Toxibow: { Tooltip: Converts wooden arrows into slow arrows that inflict irradiated } +Triploon: { + DisplayName: Triploon + Tooltip: + ''' + Launches three harpoons that impale struck enemies and lacerate them + Releasing will rip the harpoons out of the struck enemy + The faster you are moving, the higher the rip-out damage + ''' +} + TyrannysEnd: { DisplayName: Tyranny's End Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index 91e5580e0f..a03af7ba37 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -235,6 +235,7 @@ TorrentialArrow.DisplayName: Torrential Arrow ToxicannonDrop.DisplayName: Toxic Acid ToxicannonShot.DisplayName: Toxic Shot ToxicArrow.DisplayName: Toxic Arrow +TriploonSpear.DisplayName: Super Deadly Harpoon TyphoonArrow.DisplayName: Typhoon Arrow TyphoonBubble.DisplayName: Typhoon UltimaBolt.DisplayName: Ultima Bolt diff --git a/Projectiles/Ranged/TriploonHoldout.cs b/Projectiles/Ranged/TriploonHoldout.cs new file mode 100644 index 0000000000..82686d8ae1 --- /dev/null +++ b/Projectiles/Ranged/TriploonHoldout.cs @@ -0,0 +1,83 @@ +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class TriploonHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ModContent.ItemType(); + public override Vector2 GunTipPosition => Projectile.Center + Vector2.UnitX.RotatedBy(Projectile.rotation) * Projectile.width * 0.38f - Vector2.UnitY.RotatedBy(Projectile.rotation) * 3f; + public override float MaxOffsetLengthFromArm => 25f; + public override float OffsetXUpwards => -7f; + public override float OffsetXDownwards => 2f; + public override float BaseOffsetY => -8f; + public override float OffsetYUpwards => -3f; + public override float OffsetYDownwards => 7f; + + public ref float Time => ref Projectile.ai[0]; + + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.ignoreWater = true; + } + + public override void KillHoldoutLogic() + { + if (HeldItem.type != Owner.ActiveItem().type) + { + Projectile.Kill(); + Projectile.netUpdate = true; + } + } + + public override void HoldoutAI() + { + Time++; + + if (Owner.CantUseHoldout()) + { + // Set the spears to return if the weapon is not being used + for (int proj = 0; proj < Main.maxProjectiles; proj++) + { + var projectile = Main.projectile[proj]; + if (!projectile.active) + continue; + + // We don't wanna make ALL spears return, because multiplayer certainly does exist! + if (projectile.type == ModContent.ProjectileType() && projectile.owner == Main.myPlayer) + projectile.ai[2] = 1f; + } + + // The holdout is only killed once all the spears return + if (Owner.ownedProjectileCounts[ModContent.ProjectileType()] <= 0) + Projectile.Kill(); + } + + if (Time == 30f) + { + SoundEngine.PlaySound(SoundID.DD2_BallistaTowerShot, GunTipPosition); + + for (int i = 0; i < 3; i++) + { + // This offsets the side spears so that they're not just stacked on top of each other + float offsetMult = i * 1.5f - 1.5f; + Vector2 velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * Owner.ActiveItem().shootSpeed; + Vector2 offset = velocity.RotatedBy(MathHelper.Pi / 10 * offsetMult); + + // The initial ai0 value is used to offset when each spear hits + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition + offset, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Main.myPlayer, i * 5f - 5f); + } + } + } + } +} diff --git a/Projectiles/Ranged/TriploonSpear.cs b/Projectiles/Ranged/TriploonSpear.cs new file mode 100644 index 0000000000..99678f1e98 --- /dev/null +++ b/Projectiles/Ranged/TriploonSpear.cs @@ -0,0 +1,160 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class TriploonSpear : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + + public int TimeLeft = 1200; + public bool HasDealtRipOutDamage = false; + public ref float Returning => ref Projectile.ai[2]; // If this equals 1f, it's returning. This is a float referencing ai2 instead of a bool because I change it in the holdout + + public override void SetDefaults() + { + Projectile.width = 44; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.timeLeft = TimeLeft; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; + } + + public override void AI() + { + Vector2 ownerDist = Main.player[Projectile.owner].Center - Projectile.Center; + + // Set the initial hit delay offset + if (Projectile.ai[0] > 1f) + { + Projectile.localNPCHitCooldown += (int)Projectile.ai[0]; + Projectile.ai[0] = 0f; + } + + if (Returning == 1f) // Returning + { + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Pi; + Projectile.extraUpdates = 1; + Projectile.usesIDStaticNPCImmunity = true; // Abuse of iframe shenanigans to make sure it consistently hits when ripping out + Projectile.idStaticNPCHitCooldown = 1; + + float returnSpeed = 16f; + if (ownerDist.Length() > 3000f) + Projectile.Kill(); + + ownerDist.Normalize(); + ownerDist *= returnSpeed; + + // Home back in on owner + if (Projectile.velocity.X < ownerDist.X) + Projectile.velocity.X = ownerDist.X; + else if (Projectile.velocity.X > ownerDist.X) + Projectile.velocity.X = ownerDist.X; + + if (Projectile.velocity.Y < ownerDist.Y) + Projectile.velocity.Y = ownerDist.Y; + else if (Projectile.velocity.Y > ownerDist.Y) + Projectile.velocity.Y = ownerDist.Y; + + // Delete the harpoon if it touches its owner + if (Main.myPlayer == Projectile.owner) + { + if (Projectile.Hitbox.Intersects(Main.player[Projectile.owner].Hitbox)) + Projectile.Kill(); + } + } + else // Not returning + { + // Only rotates before hitting an enemy + if (Projectile.numHits < 1) + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.StickyProjAI(360); + + // Return if too far from owner + if (ownerDist.Length() > 1000f) + Returning = 1f; + + // Gravity + if (Projectile.numHits < 1) + { + if (Projectile.timeLeft < TimeLeft - 30) + { + Projectile.velocity.X *= 0.98f; + Projectile.velocity.Y += 0.15f; + if (Projectile.velocity.Y > 14f) + Projectile.velocity.Y = 14f; + } + } + } + } + + // The spear stops dealing damage after the rip-out damage + public override bool? CanDamage() => Returning != 1f || !HasDealtRipOutDamage; + + // Making sure it hits consistently when ripping out, part 2 + public override void ModifyDamageHitbox(ref Rectangle hitbox) + { + if (Returning == 1f) + hitbox.Inflate(20, 20); + } + + // Immediately start returning if it hits a tile + public override bool OnTileCollide(Vector2 oldVelocity) + { + Returning = 1f; + return false; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 120); + + if (Returning != 1f) + { + for (int blood = 0; blood < 6; blood++) + { + Vector2 bleedVelocity = Vector2.UnitX.RotatedBy(Projectile.rotation + MathHelper.Pi).RotatedByRandom(MathHelper.PiOver4); + bleedVelocity *= Main.rand.NextFloat(15f, 19f); + + Particle impaleBlood = new BloodParticle(Projectile.Center + Vector2.UnitX.RotatedBy(Projectile.rotation) * 22f, bleedVelocity, 15, 0.7f, Color.Maroon); + GeneralParticleHandler.SpawnParticle(impaleBlood); + } + } + else + { + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/NPCHit/PerfLargeHit", 3)); + HasDealtRipOutDamage = true; + } + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + Projectile.ModifyHitNPCSticky(3); + if (Returning == 1f) + { + modifiers.SetCrit(); + float damageMult = 1f + (Main.player[Projectile.owner].velocity.Length() / 4f); // Deals more damage on rip-out based on the player's velocity + Main.NewText(damageMult); + modifiers.SourceDamage *= damageMult; + + for (int bloody = 0; bloody < 2; bloody++) + { + Vector2 ripOutBleedVelocity = Vector2.UnitX.RotatedBy(Projectile.rotation).RotatedByRandom(MathHelper.PiOver4); + ripOutBleedVelocity *= Main.rand.NextFloat(1.25f, 2f); + float randomSize = Main.rand.NextFloat(0.5f, 0.7f); + Color ripOutBloodColor = Color.Lerp(Color.Maroon, Color.Red, damageMult / 4f); + + Particle ripOutBlood = new BloodParticle2(Projectile.Center + Vector2.UnitX.RotatedBy(Projectile.rotation) * 22f, ripOutBleedVelocity, 20, randomSize, ripOutBloodColor); + GeneralParticleHandler.SpawnParticle(ripOutBlood); + } + } + } + } +} diff --git a/Projectiles/Ranged/TriploonSpear.png b/Projectiles/Ranged/TriploonSpear.png new file mode 100644 index 0000000000000000000000000000000000000000..aa16dcc9b9c622ba22b9852ed0ae8dc2b9ab3dcc GIT binary patch literal 351 zcmeAS@N?(olHy`uVBq!ia0vp^IzY_F!3HEl9{jTbQjEnx?oJHr&dIz4a#+$GeH|GX zHuiJ>Nn{1`ISV`@i-8&rgD~Uq{1quc!7rXJjv*f2$teqrCrl3f%b(hGaIyM!&mv~w zDRM>)&lG#)78wXEQf6ItJ*JXvSz<##2mfAyW1>t)nCu)AHMp7V_SSQ!E^Oj_S(UIW z?`p6CFSBprr2sLOGZ9~9PBk^ePVZmX^5X(`qM)N^0Y|h%WCLr0LtLoXsYCoCyrm0u zICj+kGn&H6$lgD%X_EqjtxMv8d(&ir8k^hen_h0&mz*HQ)|SUHnR~~M$^|+cKfZnC zp3=(o=*-mvCRHmLv~?2_E}o1ATDPb2e@(~oL=9i#25q+96p@2pcB+3rXu`9gUBgO( oH_?f~_6TPykeQ@-<^Ti3g*&#vQ|7b!0{ze6>FVdQ&MBb@0A$sC8UO$Q literal 0 HcmV?d00001 diff --git a/Utilities/GenericAIUtils.cs b/Utilities/GenericAIUtils.cs index 265c83daf3..769978d9bb 100644 --- a/Utilities/GenericAIUtils.cs +++ b/Utilities/GenericAIUtils.cs @@ -505,7 +505,7 @@ namespace CalamityMod projectile.ai[1] = (float)npcIndex; //follow the NPC - projectile.velocity = (npc.Center - projectile.Center) * 0.75f; + projectile.velocity = (npc.Center - projectile.Center); projectile.netUpdate = true; From d6c43c6fe0d6dbdde6992df5f3dbe4f99d7434e3 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Sun, 5 May 2024 17:34:31 -0400 Subject: [PATCH 2/3] Deadshot Brooch killed my dog --- Projectiles/Ranged/TriploonSpear.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Projectiles/Ranged/TriploonSpear.cs b/Projectiles/Ranged/TriploonSpear.cs index 99678f1e98..bd81e031a3 100644 --- a/Projectiles/Ranged/TriploonSpear.cs +++ b/Projectiles/Ranged/TriploonSpear.cs @@ -41,11 +41,10 @@ namespace CalamityMod.Projectiles.Ranged if (Returning == 1f) // Returning { Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Pi; - Projectile.extraUpdates = 1; Projectile.usesIDStaticNPCImmunity = true; // Abuse of iframe shenanigans to make sure it consistently hits when ripping out Projectile.idStaticNPCHitCooldown = 1; - float returnSpeed = 16f; + float returnSpeed = 22f; if (ownerDist.Length() > 3000f) Projectile.Kill(); From 7f47db426e0b5fc216a77298c520af6c02332087 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Sun, 5 May 2024 17:49:57 -0400 Subject: [PATCH 3/3] Removed Triploon from Elemental Saw's recipe --- Items/Weapons/Ranged/ElementalSaw.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Items/Weapons/Ranged/ElementalSaw.cs b/Items/Weapons/Ranged/ElementalSaw.cs index 8dfd794b01..8353010df1 100644 --- a/Items/Weapons/Ranged/ElementalSaw.cs +++ b/Items/Weapons/Ranged/ElementalSaw.cs @@ -131,7 +131,6 @@ namespace CalamityMod.Items.Weapons.Ranged CreateRecipe(). AddIngredient(). AddIngredient(). - AddIngredient(). AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). AddIngredient(5).