From c66794df4412fadea9eaf462515bba5b778ff227 Mon Sep 17 00:00:00 2001 From: GinYuH <72181395+GinYuH@users.noreply.github.com> Date: Thu, 22 Feb 2024 01:04:23 -0800 Subject: [PATCH] more chum chain stuff --- Gores/HauntedChum/ChumBone1.png | Bin 0 -> 383 bytes Gores/HauntedChum/ChumBone2.png | Bin 0 -> 387 bytes Gores/HauntedChum/HauntedChum.png | Bin 0 -> 790 bytes Gores/HauntedChum/HauntedChumMouth.png | Bin 0 -> 768 bytes NPCs/SunkenSea/FesteringRemains.cs | 4 ++ NPCs/SunkenSea/HauntedChum.cs | 73 +++++++++++++++++++++++-- Particles/ChumBone.cs | 9 +++ 7 files changed, 80 insertions(+), 6 deletions(-) create mode 100644 Gores/HauntedChum/ChumBone1.png create mode 100644 Gores/HauntedChum/ChumBone2.png create mode 100644 Gores/HauntedChum/HauntedChum.png create mode 100644 Gores/HauntedChum/HauntedChumMouth.png diff --git a/Gores/HauntedChum/ChumBone1.png b/Gores/HauntedChum/ChumBone1.png new file mode 100644 index 0000000000000000000000000000000000000000..86bff0e329327e933584eb072e86319a67ce2abe GIT binary patch literal 383 zcmeAS@N?(olHy`uVBq!ia0vp^Ahs9>8<6~|#v2Qy7>k44ofy`glX(f`u%tWsIx;Y9 z?C1WI$O@F>_jGX#vG7k$X=wVwVQp~s;7Q(P^)>&0$-Bhw{3mlJooTWQgIjiOsDZPu ztCY{?jsKWutEevKc=rBQEsxLSJSBk!-=gBJOvUqTck(auEK~MtRhaBBV|I71U`wa@ z#Qy2cj4g=_Pt0cgc6ji5dwhb=mQI~dr;HMg{huFyaLdHi(lhoI)hf8%tdd&Ls6(SyeUe2HJ z>(bigJn{SftK4&OV;3$pc>MA7_k`^p93Pv1>fftnx!hC}^T5P=Pv@_!O$luL>g+dM zX5@dD*~_@BvB5<+@ui^H{rPtP8D{eoD+^3WQetLicx)8CXL45AZeURHrABzB`T8`hV*YRv}b;?l|- z!S~rDe*AhXE-^WuSze!A;xL0oNrGYvkH@w~!D(f6{~KSVrZyhgFmbi?jQtsxoD6tb z9#|;fZTsWmZ@@fF>*8fToCUQ!r!~kPY9SK@QD3${GQ(&%UXZzJgBz+_YcuC>UY^{O(PAO+b1*UH1{o2 znZbWL(O`B%!=C^q;{?sGm!HdPm<7st1xUqZEx7HnP+mfUVS#1Z4)eg(Il$oJOO5bM b^YvxW0|00001b5ch_0Itp) z=>Px#1ZP1_K>z@;j|==^1poj7rb$FWR9HvVm&aNFSc#{~9yt&zm-c7ujt)G*j4yPZz_X4Nz?PiBiC(`Zqf z?AQ>^)K>`BS7#EH8j+F7=yJ+#nu%XVc3By z-a{aBb0KPtB)l)uBx`+@N`b%9X^?-{W5}*jyQF1@V1`fL6+Q_@j?4VhM_HMfl-)r? zG{coMYS(Be)GwdMXXSpHeEQ-g$mnZ`?H?Q+1l7dGVqiM64AKmD2|IAW*8*~P9y>b< z?lKb~^WpUrI2qskT+>}P(%*+c$yl-NGSwKn#7vEkfq$&^CenwFCw%`ohY&*OrbJh(;u2s6fd6?66fF-AW_79E$*$eWbO7YY_-C557JuUF38Sz`r^EiS<5sX#a8 z(d0Lf^ZNbx4SxUK4>?J070nDe9KQiAHy?(Ge{M+t000hUSV?A0O#mtY000O800000 U007cclK=n!07*qoM6N<$f~%5h*8l(j literal 0 HcmV?d00001 diff --git a/Gores/HauntedChum/HauntedChumMouth.png b/Gores/HauntedChum/HauntedChumMouth.png new file mode 100644 index 0000000000000000000000000000000000000000..6fa25c049e830af53a183daf217a6682b0f32ba0 GIT binary patch literal 768 zcmV+b1ONPqP)Px#1ZP1_K>z@;j|==^1poj7kV!;AR9HvVmQ7C+VHAb?G1D?F#dd}U5#k3`RBWOq z7^AWfb;s6U;MSFU;>v|PSFHF8#)JhM6Qc_g6F1!uLogySqBfGld?9y+mZcDQrkXgeC zczLUa3r5lz#1nZTe)skZoP;E!dQa$Oj!eJVReWJ+8tVG1(LhY424dny9M|8NIf>XV z$}d8#e*EE|iFjX60j)HiknyA`E5%yHfp^mhzdK1tt*;0PyOd;lGy<~vUO>A=WIQz( zR)-(|B}GK4W+@_4HA{6ZJ6FjgbJgL80o3rkb&w6RU=2G_DX}*EJ83dmd7s-?oWQ&E zzaOYFSBD}YjS}PbT2jH)uvV9qC85jI^{-k!dGrwe;PF%V)id&5cBmZ{&`RTbs9U#E zBt4zT!Y}79!I$2@fwNv62wUFq{v*6OHUTHmwOiuz&lcbp&K-w`$EV=0UM#_5S`_!* zZR{cD{u(@?Qe_)fin6uDMT z-@5`|e*PLxab-y-6S#r1T|?Y|gcM0f(=u^;!(B_NW;TrrHaDev8~#+*ZE~l2Oc)CN y0Zgd{=TF0000(10); @@ -169,33 +172,75 @@ namespace CalamityMod.NPCs.SunkenSea } for (int i = 0; i < 2; i++) { - int dustPos = NPC.spriteDirection == 1 ? 0 : 10; + int dustPos = NPC.spriteDirection == 1 ? -10 : 0; Dust.NewDust(new Vector2(NPC.Center.X + dustPos, NPC.position.Y + NPC.height / 4), 0, NPC.height / 2, DustID.Blood, -NPC.spriteDirection * Main.rand.NextFloat(4f, 5f), Main.rand.NextFloat(-3, 3), Scale: Main.rand.NextFloat(0.6f, 1f)); } + // Update the chain Segments[0].oldPosition = Segments[0].position; - Segments[0].position = body.Center + new Vector2(body.direction * 10, 8); + Segments[0].position = body.Center + new Vector2(body.spriteDirection * 20, 8); Segments[Segments.Count - 1].oldPosition = Segments[Segments.Count - 1].position; Segments[Segments.Count - 1].position = body.active ? NPC.Center : body.Center; - Segments = VerletSimulatedSegment.SimpleSimulation(Segments, 10, loops: 100, gravity: 0.3f); + Segments = VerletSimulatedSegment.SimpleSimulation(Segments, 10, loops: 1, gravity: 0.3f); NPC.netUpdate = true; NPC.netSpam = 0; } + public PrimitiveTrail GutTrail; + + public PrimitiveTrail GutBGTrail; + internal float WidthFunction(float completionRatio) + { + return MathHelper.Clamp(((float)Math.Cos(completionRatio * 60)) + 2, 1, 2) / 2; + } + + internal Color ColorFunction(float completionRatio) + { + return (int)(completionRatio * 100) % 2 == 0 ? new Color(69, 52, 0) : new Color(); + } + + internal float BackgroundWidthFunction(float completionRatio) => WidthFunction(completionRatio) * 3f; + + internal Color BackgroundColorFunction(float completionRatio) + { + return Color.Black; + } + public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 5; k++) { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Sandnado, hit.HitDirection, -1f, 0, default, 1f); } + if (NPC.life <= 0) + { + // Drop a bone gore for each bone + if (Segments != null && Segments.Count > 0) + { + for (int i = 0; i < Segments.Count; i++) + { + VerletSimulatedSegment v = Segments[i]; + int goreType = i < Segments.Count / 2 ? Mod.Find("ChumBone2").Type : Mod.Find("ChumBone1").Type; + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGorePerfect(NPC.GetSource_Death(), v.position, new Vector2(Main.rand.NextFloat(-2, 2), -6), goreType); + } + } + } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("HauntedChum").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("HauntedChumMouth").Type, 1f); + } + } } public override bool CheckActive() { - return !(Main.npc[(int)NPC.ai[3]].active && Main.npc[(int)NPC.ai[3]].type == ModContent.NPCType()); + return !(Main.npc[(int)NPC.ai[3]].active && Main.npc[(int)NPC.ai[3]].type == ModContent.NPCType()); } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -204,8 +249,23 @@ namespace CalamityMod.NPCs.SunkenSea if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; + // Draw the chain's flesh + if (GutTrail is null) + GutTrail = new PrimitiveTrail(WidthFunction, ColorFunction); + if (GutBGTrail is null) + GutBGTrail = new PrimitiveTrail(BackgroundWidthFunction, BackgroundColorFunction); + + List points = new List(); + for (int i = 0; i < Segments.Count; i++) + { + points.Add(Segments[i].position); + } + + GutBGTrail.Draw(points, -Main.screenPosition, 75); + GutTrail.Draw(points, -Main.screenPosition, 75); + NPC body = Main.npc[(int)NPC.ai[3]]; - // Draw a physiques chain + // Draw a chain of bones if (body != null && body.active && body.type == ModContent.NPCType()) { if (Segments == null || Segments.Count <= 0) @@ -245,6 +305,7 @@ namespace CalamityMod.NPCs.SunkenSea spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); } + // Draw the chum itself and its jaw, rotated by localai[0] Texture2D texture = TextureAssets.Npc[NPC.type].Value; Vector2 origin = new Vector2(texture.Width / 2, texture.Height / 2); Vector2 jawOrigin = new Vector2(NPC.spriteDirection == 1? jawTexture.Width - 22 : 22, 4); diff --git a/Particles/ChumBone.cs b/Particles/ChumBone.cs index eaca016a2a..88838070b4 100644 --- a/Particles/ChumBone.cs +++ b/Particles/ChumBone.cs @@ -1,6 +1,8 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Particles @@ -41,6 +43,13 @@ namespace CalamityMod.Particles { Velocity.Y = 0; } + if (Time == Lifetime) + { + for (int i = 0; i < 4; i++) + { + Dust.NewDust(Position, 10, 10, DustID.Bone, Main.rand.NextFloat(-4, 4), Main.rand.NextFloat(-4, 4)); + } + } } public override void CustomDraw(SpriteBatch spriteBatch)