From f4f99158933cd81e07c2021c02c93024881fa2cd Mon Sep 17 00:00:00 2001 From: GinYuH <72181395+GinYuH@users.noreply.github.com> Date: Mon, 16 Sep 2024 20:54:42 -0700 Subject: [PATCH] Added Clad Crab --- Gores/CladCrab/CladCrab.png | Bin 0 -> 495 bytes Gores/CladCrab/CladCrab2.png | Bin 0 -> 361 bytes Gores/CladCrab/CladCrab3.png | Bin 0 -> 663 bytes Gores/CladCrab/CladCrab4.png | Bin 0 -> 478 bytes Items/Placeables/Banners/CladCrabBanner.cs | 7 + Items/Placeables/Banners/CladCrabBanner.png | Bin 0 -> 448 bytes .../en-US/Mods.CalamityMod.NPCs.hjson | 1 + NPCs/NormalNPCs/CladCrab.cs | 292 ++++++++++++++++++ NPCs/NormalNPCs/CladCrab.png | Bin 0 -> 2511 bytes NPCs/NormalNPCs/Shroomble.cs | 3 +- Tiles/MonsterBanner.cs | 6 +- 11 files changed, 304 insertions(+), 5 deletions(-) create mode 100644 Gores/CladCrab/CladCrab.png create mode 100644 Gores/CladCrab/CladCrab2.png create mode 100644 Gores/CladCrab/CladCrab3.png create mode 100644 Gores/CladCrab/CladCrab4.png create mode 100644 Items/Placeables/Banners/CladCrabBanner.cs create mode 100644 Items/Placeables/Banners/CladCrabBanner.png create mode 100644 NPCs/NormalNPCs/CladCrab.cs create mode 100644 NPCs/NormalNPCs/CladCrab.png diff --git a/Gores/CladCrab/CladCrab.png b/Gores/CladCrab/CladCrab.png new file mode 100644 index 0000000000000000000000000000000000000000..1671a2d9835c54893d0f9377c8dd87a668ec81c3 GIT binary patch literal 495 zcmVPx#1ZP1_K>z@;j|==^1poj6e@R3^R7gwBmcdGdKpe)cE^F?^Acz(vRyL5Xf>#lQ zUc_hFXXq_D1`A@x9-vE$5{eN734!6M8ou>|927e>`@4Me-<84N%wL@YZ35f2k!L5z z$k+GJZwxwSvl-@S+ZHt`ilQ40bJ*p-^JilLOt1Y56i;uvd(QJ5NleqkoONBJCh`iX zGyY{X$YQZTR#gS#D2h;9mW3o`St2)^4U!m!ffZ<)1~tw1!noJ1GVAra8x6DFZjou4 zA_;pyHdkltx-JIdPGG!TE>Qj(~dUAhzgS>lqM)FOk&e->T40K)Z8HZtrBs7-y^8BiQ9eH`| zuaLag>Wsy6JlM@+cRbd$^6!NIll?R1^UCLx=CYZ*XEL0R*R!kn22*D|_U2-DAARi1 z#|-5Yh^UdG#(YGaU~ru{!Jt;U#~6sUN78(ZsWaBp_g(S#Skrz0@(--fa#GqU0000E lWmrjOO-%qQ00008000000002eQLoEFFPTI?NFhQg(nlrQGhx7%P%Z^eib!O8S?2s3KSjRE@>Int6 zl}mW)l$w@tfBa^>NL2CT)y+1~OR9=~b*B0Xzmw5<-F48}NUO8_eVd{I{o97{nd$Uoc^TQJw428o9$Kw*_9yoVua<<+t>lss~!1*LUPi zJ=>a)v~|nF&dftCbNLpW*}vaSHN>G}fBz|I3&WDKI@kGe-?p1Su2MGJ)!8zK>HYnh z@1K5(8t!*kYUtVYvaKriXq;#3!+QyQzvEp3W=`umaPTi{YVO{KzyDobf=lxzpLKb7 z_1BB4@;O~B57{^uM0P5@WcC3D0$*x`XPU1sgBFm@0mLA1DR?r7@^tlcS?83{1OOCj BkrMy_ literal 0 HcmV?d00001 diff --git a/Gores/CladCrab/CladCrab3.png b/Gores/CladCrab/CladCrab3.png new file mode 100644 index 0000000000000000000000000000000000000000..463bed640096915757923cdfa4eeddefb305b634 GIT binary patch literal 663 zcmV;I0%-k-P)Px#1ZP1_K>z@;j|==^1poj7CrLy>R7gwBmOV%tVI0Qup~=;FMkz&zO@>4=C~9?d zF?11BNIO_4bnW7*2vWqsO>k`oAt1O*q4lFvaB7z*6&*x^CUp>LlXxUtq9zT`d(Ut$ zk>GNdXZgMV_dasJ_y1lJr{j@?LLo3ZAWk_ut<^9vQt5T!faki3I+MwO&Ehg>S(+Nw z1G9w{H;PX`1$*`@;8RUo&+xGx<|aKLP3viRFWI;ydngB{4Gc}W>v7`V?K#uJw18m) zGxH-FkquchvUx4iiO;gnQ2p2sK67<~%I?2ryAt7iSJ=EV_d_b!cC3N!FXy23hU{5+ zwihhjifz>qA4JV8e=CDa58_D~n#o428SmU7XuV)zI_jLVg%NU8gt4@Hy zU=U0s5+Gws4>9n0M6ZgK3QQNL22k_;35UaABoYB>z+|&okn?iy>aqFvkf!y(kO{r; zPx#1ZP1_K>z@;j|==^1poj6Zb?KzR7gw3lrc-gKp2M8n8w(s9Xcpcf`n3BtWa=q zbJ4*?!Ns4TtN%jq7x*K@L0z33D=Iih&7e|osJ51qkVa$gy?n)94KAL(@bTOQdU@{4 z^)gyYCKqNv^XVhzd|5FurxfeFcQUPmp zZW@@A`QI6n>HAg@^Js1i%og*YoYvkMIHHeYE$ieNb9KhfQV9d&Hu%<*l4jhgwZP%+ zbFdqjt235+N?)5!L1uj#q>!P!1AX}vv`tg3ac^PX)31Hy=DfHeS@IZHZ4^DHns*!& z3&WU~x*kuhl`$BqHqmQ2^v}!hEQ0aD1Grj^z@v%*Ru09TaZ#^>N>4>H97x|?LD_6N zV7ZV3FB`)2@je9A8z=0Ab`Va8chY@K@jMUQn6*I4?(sFK{2UJ$Q{>)TmM{zgai>sd z2fpuv-TafWoS$}J+cwr>jB%(k*0fLb4~WSrw?6m)000hUSV?A0O#mtY000O800000 U007cclK=n!07*qoM6N<$f-uz3od5s; literal 0 HcmV?d00001 diff --git a/Items/Placeables/Banners/CladCrabBanner.cs b/Items/Placeables/Banners/CladCrabBanner.cs new file mode 100644 index 0000000000..337bd4dbe9 --- /dev/null +++ b/Items/Placeables/Banners/CladCrabBanner.cs @@ -0,0 +1,7 @@ +namespace CalamityMod.Items.Placeables.Banners +{ + public class CladCrabBanner : BaseBanner + { + public override int BannerTileStyle => 54; + } +} diff --git a/Items/Placeables/Banners/CladCrabBanner.png b/Items/Placeables/Banners/CladCrabBanner.png new file mode 100644 index 0000000000000000000000000000000000000000..5f33251b9773ce0173e114e68658bd7c906f0fda GIT binary patch literal 448 zcmV;x0YCnUP)f00001b5ch_0Itp) z=>Px#1ZP1_K>z@;j|==^1poj6P)S5VR5(v#lrU9b00Fj_|Nes+IKY2p9!3z&1m=+d z80F;Tz$U+UX9ElHDanE9m7ZXVA$&W8W}bcrOp|ZJ-%J&VK%fkm{(a{om}a^B8BCLH z15ORBD*RxK4#@X|hdCrZwi>a3X&8X{iOKB%ga(r&0Jw2d+D>4)OHLI`&z?OSOy6dB z0;XYrd>d3%Atu9sgM$Nvu@mC^$3|0UGd-v`I(TF0000(); + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); + } + + public override void AI() + { + NPC.TargetClosest(false); + float movementSpeed = 1; + + // Enrage if target is close enough + if (NPC.HasPlayerTarget) + { + Player target = Main.player[NPC.target]; + // Enrage if the player is close enough, not too far above, and in its line of sight + if (target.Distance(NPC.Center) < 320 && target.Bottom.Y > NPC.Top.Y - 40 && Collision.CanHitLine(NPC.Center, 1, 1, target.Center, 1, 1)) + { + // Enter attack mode + if (NPC.ai[0] != 2) + { + NPC.ai[1] = 60; + NPC.ai[0] = 2; + } + // Set calm down timer to 0 as long as these conditions are met + NPC.ai[2] = 0; + } + else + { + // Calm down + NPC.ai[2]++; + // After 5 seconds of no valid target, go back to passive behaviour + if (NPC.ai[2] > 300) + { + NPC.ai[0] = Main.rand.Next(0, 2); + NPC.ai[1] = Main.rand.Next(120, 301); + NPC.ai[2] = 0; + NPC.ai[3] = 0; + } + } + } + + if (NPC.direction == 0) + { + NPC.direction = Main.rand.NextBool() ? -1 : 1; + } + + // If not enraged and the phase timer is at 0, change phase + if (NPC.ai[1] <= 0 && NPC.ai[0] != 2) + { + NPC.ai[0] = NPC.ai[0] == 0 ? 1 : 0; + NPC.ai[1] = Main.rand.Next(120, 301); // Set the phase timer + NPC.direction = Main.rand.NextBool() ? -1 : 1; // Flip direction randomly + } + + // Passive walking + if (NPC.ai[0] == 0) + { + // If it bumps into something, turn around + if (NPC.ai[3] <= 0 && NPC.velocity.X == 0) + { + NPC.direction *= -1; + NPC.ai[3] = 30; + } + // Move + if (!NPC.justHit) + NPC.velocity.X = MathHelper.Lerp(NPC.velocity.X, NPC.direction * movementSpeed, 0.05f); + // Don't get stuck on 1 block obstacles + StepUp(); + } + // Stand still + else if (NPC.ai[0] == 1) + { + // Slow to a stop if not falling/being moved up + if (NPC.velocity.Y == 0) + NPC.velocity.X *= 0; + // Start running if hit + // This behavior is mostly only here for if it gets hurt but you aren't within its aggro range + if (NPC.justHit) + { + NPC.ai[0] = 0; + NPC.ai[1] = Main.rand.Next(120, 301); + } + } + // Enrage + else + { + Player target = Main.player[NPC.target]; + // If it bumps into something, turn around + if (NPC.ai[3] <= 0 && NPC.velocity.X == 0) + { + NPC.direction *= -1; + NPC.ai[3] = 30; + } + // If it's too far from the player, turn around + else if ((NPC.ai[3] <= 0 && target.Distance(NPC.Center) > 160) || NPC.ai[3] < -180) + { + int dir = Math.Sign(Main.player[NPC.target].Center.X - NPC.Center.X); + NPC.direction = dir; + NPC.ai[3] = 120; + } + // Move + if (!NPC.justHit) + NPC.velocity.X = MathHelper.Lerp(NPC.velocity.X, NPC.direction * movementSpeed, 0.05f); + StepUp(); + } + + // Phase timer + if (NPC.ai[1] > 0) + { + NPC.ai[1]--; + } + // Change direction cooldown + NPC.ai[3]--; + + NPC.spriteDirection = -NPC.direction; + } + + public void StepUp() + { + Vector2 position = NPC.position; + position.X += NPC.velocity.X; + int x = (int)((position.X + (float)(NPC.width / 2) + (float)((NPC.width / 2 + 1)) * NPC.direction) / 16f); + int y = (int)((position.Y + (float)NPC.height - 1f) / 16f); + if ((float)(x * 16) < position.X + (float)NPC.width && (float)(x * 16 + 16) > position.X && ((Main.tile[x, y].HasUnactuatedTile && !Main.tile[x, y].TopSlope && !Main.tile[x, y - 1].TopSlope && Main.tileSolid[(int)Main.tile[x, y].TileType] && !Main.tileSolidTop[(int)Main.tile[x, y].TileType]) || (Main.tile[x, y - 1].IsHalfBlock && Main.tile[x, y - 1].HasUnactuatedTile)) && (!Main.tile[x, y - 1].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x, y - 1].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 1].TileType] || (Main.tile[x, y - 1].IsHalfBlock && (!Main.tile[x, y - 4].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x, y - 4].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 4].TileType]))) && (!Main.tile[x, y - 2].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x, y - 2].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 2].TileType]) && (!Main.tile[x, y - 3].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x, y - 3].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 3].TileType]) && (!Main.tile[x - NPC.direction, y - 3].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x - NPC.direction, y - 3].TileType])) + { + float npcBottom = (float)(y * 16); + if (Main.tile[x, y].IsHalfBlock) + { + npcBottom += 8f; + } + if (Main.tile[x, y - 1].IsHalfBlock) + { + npcBottom -= 8f; + } + if (npcBottom < position.Y + (float)NPC.height) + { + float percentageTileRisen = position.Y + (float)NPC.height - npcBottom; + if (percentageTileRisen <= 16.1f) + { + NPC.gfxOffY += NPC.position.Y + (float)NPC.height - npcBottom; + NPC.position.Y = npcBottom - (float)NPC.height; + if (percentageTileRisen < 9f) + { + NPC.stepSpeed = 1f; + } + else + { + NPC.stepSpeed = 2f; + } + } + } + } + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.DayTime, + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.CladCrab") + }); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.Player.Calamity().ZoneSulphur || spawnInfo.Player.Calamity().ZoneSunkenSea) + { + return 0f; + } + return (Main.remixWorld ? SpawnCondition.Cavern.Chance : SpawnCondition.OverworldDaySlime.Chance) * 0.05f; + } + + public override void FindFrame(int frameHeight) + { + if (NPC.velocity.Y == 0f) + { + if (!NPC.IsABestiaryIconDummy) + { + if (NPC.direction == 1) + { + NPC.spriteDirection = -1; + } + if (NPC.direction == -1) + { + NPC.spriteDirection = 1; + } + + if (NPC.velocity.X == 0f) + { + NPC.frame.Y = frameHeight * 1; + NPC.frameCounter = 0.0; + return; + } + } + NPC.frameCounter += NPC.IsABestiaryIconDummy ? 0.6f : Math.Abs(NPC.velocity.X) * 0.5f; + NPC.frameCounter += 1.0; + if (NPC.frameCounter > 12.0) + { + NPC.frame.Y = NPC.frame.Y + frameHeight; + NPC.frameCounter = 0.0; + } + if (NPC.frame.Y / frameHeight >= Main.npcFrameCount[NPC.type] - 1) + { + NPC.frame.Y = frameHeight; + } + } + else + { + NPC.frameCounter = 0.0; + NPC.frame.Y = frameHeight * (Main.npcFrameCount[NPC.type] - 1); + } + } + + public override void ModifyNPCLoot(NPCLoot npcLoot) + { + npcLoot.Add(ItemID.StoneBlock, 1, 10, 20); + npcLoot.Add(ItemID.Daybloom, 1, 1, 4); + npcLoot.Add(ItemID.Blinkroot, 1, 1, 3); + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 2; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Stone, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Grass, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 7; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Stone, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Grass, hit.HitDirection, -1f, 0, default, 1f); + } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("CladCrab").Type); + Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("CladCrab2").Type); + Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("CladCrab3").Type); + Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("CladCrab4").Type); + } + } + } + } +} diff --git a/NPCs/NormalNPCs/CladCrab.png b/NPCs/NormalNPCs/CladCrab.png new file mode 100644 index 0000000000000000000000000000000000000000..53d950960be839ded34f45704afe4ebc04b38f90 GIT binary patch literal 2511 zcmV;=2{87FP)Px#1ZP1_K>z@;j|==^1poj5Gf+%aMIIg=#Lz+wWh9cFAsdH69N1nLv`>_1NKH66 zW>r2wKtO=AwwCZbxY@kD1t9#o5 z(4q`bh$92E+kp#ixBETmw%Zzf(JZ*x91h&t?SNSZ_B?`-@aNA~ZU(s9y}tue*nSUe z!EbNx?}D@g%>duu_xtyE!fEaIKnxTKO-a%$5R~BKk%>MYTPWzq2dPMLIMnbIQ0R2} z_$?+y@OV5F-AuZ30CW!YO~n#Wfm&QE zlNWKkXb$AVk2j4=xUA%ofB;JDmqTE)pl{(Q)FiYBTB?Lxuo)1R4=Mlo^BIs{B)Zo5 z>`R#k&u1}2;gn1uLBD<#rknxm#7%&opM*D%VhJ!j&aDM{KF@&)kP0Z41cni)XcI^3 zEYKU4E=Z5FDmUv($^c(eHrNWgr+o0A-38oQ`8<#ZDM7u_v|Vm@$^kXDA`!ff<$!Bu z9(@AtC=WCL()Qs6&<7l4 z(rRX&6oMoPbQT09*oU=tMWY$0J*K6`dzu1;w3w=yd5UK-yu5w53o8 zqG>S{^nshWA~pwtT3`=4L>zlF@AV9jCC*K3HLYTvi%fuM5r^@g1woNU9#CuTb(RF8 z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UTHao|Y5n&4ru#4gm51=`E|xnM6)1=93=AgHR{szLDc Z^DlN2CkDLiXsiGL002ovPDHLkV1md>ZLt6V literal 0 HcmV?d00001 diff --git a/NPCs/NormalNPCs/Shroomble.cs b/NPCs/NormalNPCs/Shroomble.cs index 5de897f1ab..45548a73dc 100644 --- a/NPCs/NormalNPCs/Shroomble.cs +++ b/NPCs/NormalNPCs/Shroomble.cs @@ -25,7 +25,6 @@ namespace CalamityMod.NPCs.NormalNPCs }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.CantTakeLunchMoney[Type] = true; - NPCID.Sets.NormalGoldCritterBestiaryPriority.Add(Type); } public override void SetDefaults() @@ -38,7 +37,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.aiStyle = NPCAIStyleID.Passive; AIType = NPCID.Squirrel; NPC.knockBackResist = 0.5f; - NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.value = Item.buyPrice(0, 0, 0, 20); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; Banner = NPC.type; diff --git a/Tiles/MonsterBanner.cs b/Tiles/MonsterBanner.cs index 134f81524f..fea7ff6959 100644 --- a/Tiles/MonsterBanner.cs +++ b/Tiles/MonsterBanner.cs @@ -231,9 +231,9 @@ namespace CalamityMod.Tiles case 53: npc = NPCType(); break; - /*case 54: - npc = NPCType(); - Formerly Calamity Eye - break*/ + case 54: + npc = NPCType(); + break; case 55: npc = NPCType(); break;