From f035ae17a6695377b0dcdeea8c3fdede8909ff81 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Mon, 15 Dec 2025 18:52:06 -0500 Subject: [PATCH] 1 - Re-added Blinded Angler 2 - Reverted Sand Prowler to Sea Serpent The mod now compiles, have not tested everything at runtime --- .../BlindedAngler/BlindAnglerGore1.png | Bin 0 -> 642 bytes .../BlindedAngler/BlindAnglerGore2.png | Bin 0 -> 337 bytes .../BlindedAngler/BlindAnglerGore3.png | Bin 0 -> 440 bytes .../BlindedAngler/BlindAnglerGore4.png | Bin 0 -> 554 bytes .../SunkenSea/SeaSerpent/SeaSerpentGore1.png | Bin 0 -> 867 bytes .../SunkenSea/SeaSerpent/SeaSerpentGore2.png | Bin 0 -> 872 bytes .../SunkenSea/SeaSerpent/SeaSerpentGore3.png | Bin 0 -> 650 bytes .../SunkenSea/SeaSerpent/SeaSerpentGore4.png | Bin 0 -> 585 bytes .../SunkenSea/SeaSerpent/SeaSerpentGore5.png | Bin 0 -> 747 bytes Items/Critters/SeaFloatyItem.cs | 23 - Items/Critters/SeaFloatyItem.png | Bin 344 -> 0 bytes Items/Critters/SeaMinnowGoldItem.cs | 24 - Items/Critters/SeaMinnowGoldItem.png | Bin 309 -> 0 bytes .../Placeables/Banners/BlindedAnglerBanner.cs | 7 + .../Banners/BlindedAnglerBanner.png | Bin 0 -> 348 bytes Items/Placeables/Banners/PodobooKoiBanner.cs | 7 - Items/Placeables/Banners/PodobooKoiBanner.png | Bin 418 -> 0 bytes Items/Placeables/Banners/SandProwlerBanner.cs | 10 - .../Placeables/Banners/SandProwlerBanner.png | Bin 411 -> 0 bytes Items/Placeables/Banners/SeaSerpentBanner.cs | 7 + Items/Placeables/Banners/SeaSerpentBanner.png | Bin 0 -> 300 bytes .../en-US/Mods.CalamityMod.Bestiary.hjson | 1 + .../Mods.CalamityMod.Items.Placeables.hjson | 23 +- .../en-US/Mods.CalamityMod.NPCs.hjson | 7 +- NPCs/NormalNPCs/CalamityRegularEnemyAI.cs | 2 +- NPCs/SunkenSea/BlindedAngler.cs | 150 ++++ NPCs/SunkenSea/BlindedAngler.png | Bin 0 -> 4065 bytes NPCs/SunkenSea/BlindedAnglerGlow.png | Bin 0 -> 2685 bytes NPCs/SunkenSea/Clam.cs | 2 +- NPCs/SunkenSea/PrismBack.cs | 1 - NPCs/SunkenSea/SandProwler.cs | 724 ------------------ NPCs/SunkenSea/SandProwler.png | Bin 3888 -> 0 bytes NPCs/SunkenSea/SandProwler2.png | Bin 293 -> 0 bytes NPCs/SunkenSea/SandProwler3.png | Bin 327 -> 0 bytes NPCs/SunkenSea/SandProwler4.png | Bin 333 -> 0 bytes NPCs/SunkenSea/SandProwler5.png | Bin 351 -> 0 bytes NPCs/SunkenSea/SandProwler6.png | Bin 347 -> 0 bytes NPCs/SunkenSea/SandProwler7.png | Bin 242 -> 0 bytes NPCs/SunkenSea/SandProwler8.png | Bin 238 -> 0 bytes NPCs/SunkenSea/SandProwler9.png | Bin 2566 -> 0 bytes NPCs/SunkenSea/SandProwlerNested.cs | 504 ------------ NPCs/SunkenSea/SeaSerpent1.cs | 319 ++++++++ NPCs/SunkenSea/SeaSerpent1.png | Bin 0 -> 730 bytes NPCs/SunkenSea/SeaSerpent2.cs | 147 ++++ NPCs/SunkenSea/SeaSerpent2.png | Bin 0 -> 613 bytes NPCs/SunkenSea/SeaSerpent3.cs | 145 ++++ NPCs/SunkenSea/SeaSerpent3.png | Bin 0 -> 466 bytes NPCs/SunkenSea/SeaSerpent4.cs | 145 ++++ NPCs/SunkenSea/SeaSerpent4.png | Bin 0 -> 483 bytes NPCs/SunkenSea/SeaSerpent5.cs | 145 ++++ NPCs/SunkenSea/SeaSerpent5.png | Bin 0 -> 760 bytes NPCs/SunkenSea/SunkenSeaNPC.cs | 2 +- Projectiles/Enemy/GhostBellShock.cs | 262 ------- Systems/Mechanic/RecipeSystem.cs | 51 -- Tiles/MonsterBanner.cs | 2 +- Utilities/NPCDebuffs.cs | 8 +- 56 files changed, 1080 insertions(+), 1638 deletions(-) create mode 100644 Gores/SunkenSea/BlindedAngler/BlindAnglerGore1.png create mode 100644 Gores/SunkenSea/BlindedAngler/BlindAnglerGore2.png create mode 100644 Gores/SunkenSea/BlindedAngler/BlindAnglerGore3.png create mode 100644 Gores/SunkenSea/BlindedAngler/BlindAnglerGore4.png create mode 100644 Gores/SunkenSea/SeaSerpent/SeaSerpentGore1.png create mode 100644 Gores/SunkenSea/SeaSerpent/SeaSerpentGore2.png create mode 100644 Gores/SunkenSea/SeaSerpent/SeaSerpentGore3.png create mode 100644 Gores/SunkenSea/SeaSerpent/SeaSerpentGore4.png create mode 100644 Gores/SunkenSea/SeaSerpent/SeaSerpentGore5.png delete mode 100644 Items/Critters/SeaFloatyItem.cs delete mode 100644 Items/Critters/SeaFloatyItem.png delete mode 100644 Items/Critters/SeaMinnowGoldItem.cs delete mode 100644 Items/Critters/SeaMinnowGoldItem.png create mode 100644 Items/Placeables/Banners/BlindedAnglerBanner.cs create mode 100644 Items/Placeables/Banners/BlindedAnglerBanner.png delete mode 100644 Items/Placeables/Banners/PodobooKoiBanner.cs delete mode 100644 Items/Placeables/Banners/PodobooKoiBanner.png delete mode 100644 Items/Placeables/Banners/SandProwlerBanner.cs delete mode 100644 Items/Placeables/Banners/SandProwlerBanner.png create mode 100644 Items/Placeables/Banners/SeaSerpentBanner.cs create mode 100644 Items/Placeables/Banners/SeaSerpentBanner.png create mode 100644 NPCs/SunkenSea/BlindedAngler.cs create mode 100644 NPCs/SunkenSea/BlindedAngler.png create mode 100644 NPCs/SunkenSea/BlindedAnglerGlow.png delete mode 100644 NPCs/SunkenSea/SandProwler.cs delete mode 100644 NPCs/SunkenSea/SandProwler.png delete mode 100644 NPCs/SunkenSea/SandProwler2.png delete mode 100644 NPCs/SunkenSea/SandProwler3.png delete mode 100644 NPCs/SunkenSea/SandProwler4.png delete mode 100644 NPCs/SunkenSea/SandProwler5.png delete mode 100644 NPCs/SunkenSea/SandProwler6.png delete mode 100644 NPCs/SunkenSea/SandProwler7.png delete mode 100644 NPCs/SunkenSea/SandProwler8.png delete mode 100644 NPCs/SunkenSea/SandProwler9.png delete mode 100644 NPCs/SunkenSea/SandProwlerNested.cs create mode 100644 NPCs/SunkenSea/SeaSerpent1.cs create mode 100644 NPCs/SunkenSea/SeaSerpent1.png create mode 100644 NPCs/SunkenSea/SeaSerpent2.cs create mode 100644 NPCs/SunkenSea/SeaSerpent2.png create mode 100644 NPCs/SunkenSea/SeaSerpent3.cs create mode 100644 NPCs/SunkenSea/SeaSerpent3.png create mode 100644 NPCs/SunkenSea/SeaSerpent4.cs create mode 100644 NPCs/SunkenSea/SeaSerpent4.png create mode 100644 NPCs/SunkenSea/SeaSerpent5.cs create mode 100644 NPCs/SunkenSea/SeaSerpent5.png delete mode 100644 Projectiles/Enemy/GhostBellShock.cs diff --git a/Gores/SunkenSea/BlindedAngler/BlindAnglerGore1.png b/Gores/SunkenSea/BlindedAngler/BlindAnglerGore1.png new file mode 100644 index 0000000000000000000000000000000000000000..8becc53bd05d863584a125dc333945111f6d7bac GIT binary patch literal 642 zcmV-|0)737P)Nkl6o9{J9&OXSY7;b&nwDBBR3f^Ug7p_@-S{V5`9s{haOFk|Zrs&E6$(XETttX< z(=-xFY92O;CQZ05=AOj4y(BxCvzf;^b7s!RIWwb}AlL3Z20$fa062{^$77-ZzQ2F! zyM8Wr4}kX3&e(mXCLQE|Nl-fJ@G1c3(F6eDcuKd42mn2oMBw%s0E16O0DgCxzK(_D zP_C{6P$?CFi-fEpqJ%{HrjE4wrRV^3GC2S;ZX~xJJp|zMi>)X&#vQ~eB1RQ#y?y3uxcf>IXcV@M`PQKss1OwCv}y_{!FQTRKv;Py%54-3I`otDXS6x{(~h&5=y>5^%BVaC65RBEuXJBIP$NU&GD& zn`0dbA+IFY9{`ZQo(D!%*9$ocAbhTK%pM|3D>ndWA9o#q<&6~pn$@2GG*WS6LGtt$ zFd|g!9vJ#c$&76&xCp@BZrSvc$|`^#AD;sj5ec@ByS|D$wG9p4~loS532)Vtw zNkZ-!?;B+g5$Oc7R}?_uTVL0`d-A}>nz10})_>q^-bY z^2#zW74_DM0{HW~U_>CK%60v^Mk+_zQ6#7U`klVvN1f;#o0?w+MmKIWkv8n?A>uQq zNz_hF!_c$>sFX}X-DFB%jSX#I?H&4VG}p`-{#(tep|^&Jl3%un{3X5f|A_C8Ytk=$ cl2}9JFDE~-eY+&yJ^%m!07*qoM6N<$f}#o?`~Uy| literal 0 HcmV?d00001 diff --git a/Gores/SunkenSea/BlindedAngler/BlindAnglerGore2.png b/Gores/SunkenSea/BlindedAngler/BlindAnglerGore2.png new file mode 100644 index 0000000000000000000000000000000000000000..833c94b6014937111d57eccb773bbc861007fc57 GIT binary patch literal 337 zcmV-X0j~auP)_ACo2W&*z*Rf(U-bL@7j9h%?OK#8Z<5jnQIK$r8W+>yGUFr{ z!t1-4GaqL-&zzT0m8h>VQh4+^9r~6ttMISv3{sV-FR^y_wk2jI%auUnl5FJo7XKpJ zIYCi^!%_giDp>+>99~!l=kcwC7GXK48KU2pa7prakz4t}<+(TU`{oWv$=X$|06y+x z0G?M9AkQ9%q@rLx1)zKS4#3N7VIM4;;jGsIU_2OUfO^<8Jux7A=t1EtQ2>pj9{`pQ zPa2?meFZ>rV#rF5k@v#!U<9Njd-;nLq&=vIO#t5FSIhq{kx0mdBv%(%e~kE8+#vha jRt-p9v#FUi+d07+fhtu$lg&Y+00000NkvXXu0mjfBmR*! literal 0 HcmV?d00001 diff --git a/Gores/SunkenSea/BlindedAngler/BlindAnglerGore3.png b/Gores/SunkenSea/BlindedAngler/BlindAnglerGore3.png new file mode 100644 index 0000000000000000000000000000000000000000..a4c5766fdb6c9f79952a12f4e4a4e07f53005919 GIT binary patch literal 440 zcmV;p0Z0CcP)lY{*)Iz@epRvZ*PAhU$-KZEWbzXsuD2+9MkJLA4k(NGQUU zW_47emR`f_3tm_@oIcC@-re&)e0bh_UqO!;^G*XW5+4QNrBJcD<+*wl`frHwxpmu% zce4zD-^h2B%x^B*@-OyJofUaPdej0i3RwV#LqP%H_e9&0l1-AkmU*dkN{ZTroD-?Z z#A+IV;$g-D5Jrhk$y4#+&qB_LL?k2tnpbxgz{>Ux0Qt;rSBdJ)<;hKdL?W@Y1%Oxg z1JE$57C>@i4SD&qwyWq%^Y=-l!d0)yU5Eq#c)opYOJy&cp#=b{G5M?scmG5J zpyks5Xc>G-bxa^rx$XbqyM6U#OXMYBD0Ni1DW7e#u)hQdC=w}2bmjT;J i7;uk%3nc@b6@3HT(0{YA!NigP0000gWt$ zAzuKmpWd~WShpti8lpO0oPTl~jNBUlgFU?=)HH4iAd~9`vy+eh>*DegPxtqOq0z|W zL+8$bzMI!W$Q|Avz~qYlU*zQ{j^pf|%UJdL;)848{)HPM>^adDz<6Jz{~LMviSsY3 zz}BPDerR+Ev}*@f-#i4jb{-EQ6I2I~PVEMt7hhF|IEXv1_2j9Da9?{u5R)&z7)#{8 zJ&#OIZCW3|Vxfpt^2$|3OnB^cG&`1i#!4li;Xpl@8TlGQu{Ik-iRiq19yfMg0`pTJ z5?;riR(0%6?!P|+*`_UEczh|!&(8)>m>wuIaXhs)Zf{AD$MZRk;`_&7TU#@jS%_W| z&+pWRbW|Nb=E_VQFJkgc5EV)|H4#F(B@Jq_DX?631gq0;u%|acUYl(SDnlGc(@O8# zTnFZA8p2=COaI2wD*BRtS6<@ZI&ZEySDK1n6+-^gL}DM47OTVPSD!0{RD!sz>&hPm sv6oiJi;D}OzOgkyzEmhAbY&y{2~fzWVWw7~od5s;07*qoM6N<$f}#-rqW}N^ literal 0 HcmV?d00001 diff --git a/Gores/SunkenSea/SeaSerpent/SeaSerpentGore1.png b/Gores/SunkenSea/SeaSerpent/SeaSerpentGore1.png new file mode 100644 index 0000000000000000000000000000000000000000..828fc5cab814a28d99a22e85397c00bf542fb3de GIT binary patch literal 867 zcmV-p1DyPcP) zJxo(k6o9|i_Ek#xk)I~~g`e;vK_y~Hi~~VY7#N5lx;VJ1la4MX#zhAc2M6P>#zaGy zSX82eCSn9bl>AI`yLCsto%F;U}xkf@IMjqxoZK~&d3B{E6=CIMxeI`fMdE-1K3O?4S*Xj z?*nGcSjh~J4=dxy^QX#Q>`O=z(X({`94?{ST;5XZN$$B$Wr5(VAW`U8ROT~s-NN2i z0KmdzFs(i^x}xmGeuN|$ca9*lwVE&hGD}75Sidy7xCFpPbn8%hz3hVWLg(67MIW1s z?d}C^NXX^&c>!2oTsHvn8;%3!7Z;WlrFE=sNokDv zcoMK9AxWmHwHh#q{GQAOV5DDUQE|CAlj>@OkNIfHY@W z*G&MDGFw*0G=S)YKW*jT@2rb{>jP{^$mR5i=#I_B41n;C4>0?i@GmE@x1W)AovDi4 zm+BzBnn+x4Ww{2B%syoR_&*B*)<4mB{TcwD>`G|2A4+72?9#P_(5%JM-aH)zSsH-1 z<}?5cv-9dbYkU+ivox_J$m#{f2EgXbfCjJ;3L9W{ptg;nJ+}@?>>!C1SEQY{-qq!u tU&=<{4*)yyH2@NkkO83Q7umB8{RJSNCjqLXFiZdd002ovPDHLkV1m5DgjxUq literal 0 HcmV?d00001 diff --git a/Gores/SunkenSea/SeaSerpent/SeaSerpentGore2.png b/Gores/SunkenSea/SeaSerpent/SeaSerpentGore2.png new file mode 100644 index 0000000000000000000000000000000000000000..e34333cc3a11f9b729a2208fcc0c1e8a25e86a73 GIT binary patch literal 872 zcmV-u1DE`XP)i=I3gkKT;&z`+=<9zA)|i%CN~ zaM2h!Xrd-yh!BhtXj23O6icC&LRk;9!!o5Hie~%2?9Tk(?#}zad2ion>=H$d=asS3 z?E%2y^8t{U3hSHs>gE;=U}kI-faUPZobN5z?E?N6?AsC2<6>_m09vsdFg;Br7Xk29 z900(3=`sMV&8-0R_x4Cdw4D}^e+o#?UA1)pEPb2O0cyNK!1Po?dMwf3+XFyZgI@!P zMJ9J#K>jEoJ+E$V0bpiqR0pUxJnp(86nJqr1i*y{Qi%)zbDwO=i`UXC$~ZfVWL8+N zfL2*}2!MiM8v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!Ev9WkWwC`&ZxZh59m8 zM2}EnXjs{z zLY8z$=>w8OLZ;h16U;kHhA*TXSCbMliGhRysQI~6^C!ekMUIe?K4kwa0btd4LTBrL kRhvwy1_ZNnH${%nZ;ChB! zv1=1y7{-5BlTeK2q$UvC*ro(Y8%k(JDhQ>8Y#kf~7jbcNc5@WExH(F}$v>e(rwW3T zrPvZ|sM=yHu}wJ>a^l61n#AGF7yZt&?a(UsPIuq)yx-mZ?z!(iBRMb*fMYpr{$qtA zK?A^Podw|F`~^>6&%e8+lc|6rJ3O5NV1IK@GxVAv0L<9MQ`IYlY8xOtmNEdU<+Aq1 zhbBi2@F8I%7P`^~=*viE6baiZ1CYJ{1c3bf15dqfH-JA$9;s(;0#JD>^Vcp7X*V|e z@DTvfu_ge|@6G`}Bpgr&xm!5^wm+6MgR}fh4yNw`5dFHW>8Xi00LkIFXTMv2Q62=q zEGz)fygn=E9silDX}L~^th@Y6c;(d^0N19*HN)2GIsj%&$R+=xe<_v@?N@qkO2)Sn zLfnp|HGg&_EB?1~zW7+O?B7*l@bV1+zVBOY0JD>+zTS5LL=)Z_Rm7CO6`9l~RvC5o zyEClx_nVU9y-(}fJn@l?0Z`f~0DdH_)?r0feWlGeLinKg5;%ID4JKx^epU5_`D69} z_Q#X!o-+;jwWn})mH;0T?yeFOcWwia-^c@Czh2agwa+yG>H`gJyi2Z=d7HGie$2f_ z1tA>#W&=>ItZ07U5$cZ7ce X`g6tPJfv0f00000NkvXXu0mjf1HBDB literal 0 HcmV?d00001 diff --git a/Gores/SunkenSea/SeaSerpent/SeaSerpentGore5.png b/Gores/SunkenSea/SeaSerpent/SeaSerpentGore5.png new file mode 100644 index 0000000000000000000000000000000000000000..c39cf0143497647b5ba22fd18a62108650a127db GIT binary patch literal 747 zcmVLBgk_aS-p%!ex)?#g;?YOu-sdpR^7AA8xGxxst%-nhAJ?AQR7%lx5jB#W0E&!~y zHURR;MR%KzQUE^|Ul^02oo?uVN911%ghg)2{j0@0X4+C`)=dS9p5RftWlWFSRqX2$>N&0Rm zxP*j^RLy!W?E_j!Ep>S-s+MF9-;ohV*r#~T`lctaU_F-x>cj#^NC_dpx5GBtQ2^|C2LLPc zDPMi*n+^P(tawTE)MrgNR>>-W>en0)L_)m-V*prc(*@`{&;vj&z3Q7Fq}GZifpGqf zp-X--w*mY~TJ*JcKho$wWksj(=G&&klggu&L)Y`QW_2|TAFTcRBPJPM-2-5%=8ds4#|?RQ zURPgY;<@hzyj~0(AvHL55rFDy$_23c&I0v5;e>Q2ZM<~LNVI33YQ4|jBbgRdU6T?E3Z%EYPkwP<)=w "Items.Misc"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - } - - public override void SetDefaults() - { - Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.value = Item.sellPrice(gold: 3); // These things are actually painful to catch, they can get a 300% value boost - Item.rare = ItemRarityID.Green; - } - } -} diff --git a/Items/Critters/SeaFloatyItem.png b/Items/Critters/SeaFloatyItem.png deleted file mode 100644 index 83dc6f59205d425838099537cfec51d58bd5af97..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 344 zcmeAS@N?(olHy`uVBq!ia0vp^T0ktu!3-oDm;T!iq!^2X+?^QKos)S9s|WamxXP(%8{7M`_V<{%rZGG@<(|~&)i^K7HD_j;*}FxC2irAfxRe3a zx_-+)3Z!^Tg8YL2BLN267fNkF3C;qK$YKTtzQZ8Qcszea3Q%yNr;B5Vh5y_MiQj#KVxo1!t%L0yru{h%PlF9k*ii;=Onz7x9HzC zrx4X7Gr{@9uK|E&L?3WxaAxfb<+ReX@q>6t$`G3W#r8gv= zMfpqeMm6``da$YMSlPz-rlPeK%@RG=F6gW}*E*eJM(FD!Qnrp4=O6PgO`p2$R_fO8 Z?3|VoCp~tD@&Fyn;OXk;vd$@?2>>`#hdKZN diff --git a/Items/Critters/SeaMinnowGoldItem.cs b/Items/Critters/SeaMinnowGoldItem.cs deleted file mode 100644 index d0ee9d3bf7..0000000000 --- a/Items/Critters/SeaMinnowGoldItem.cs +++ /dev/null @@ -1,24 +0,0 @@ -using CalamityMod.NPCs.SunkenSea; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Critters -{ - public class SeaMinnowGoldItem : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Misc"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - } - - public override void SetDefaults() - { - Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.bait = 50; - Item.value = Item.sellPrice(gold: 10); - Item.rare = ItemRarityID.Green; - } - } -} diff --git a/Items/Critters/SeaMinnowGoldItem.png b/Items/Critters/SeaMinnowGoldItem.png deleted file mode 100644 index 95f0da795bd4585e67adb79740e1421fcad252f9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 309 zcmeAS@N?(olHy`uVBq!ia0vp^azHG_!3-p)*UPj4DaPU;cPEB*=VV?2IV|apzK#qG z8~eHcB(eheq5(c3u9Y!DTjtq6Jz77xRxa3%`~RPz@qLoEDzCvtNgQQ%>HtiJRAMDxd+IZ`)DYOI~v z-g)g&YwkC%^@q3p-x8T!+bHK5y7{3*ZllTTy~_eUxFR=M&cC|d?6d288ib%@>Wd@s$DT`)4g^q;}lrP>EY-re8E7b u%baUfRCJN&pJnZ{!V-8VzX>Y3Drj%1&86$D_B#;hLIzJ)KbLh*2~7aRqH*s4 diff --git a/Items/Placeables/Banners/BlindedAnglerBanner.cs b/Items/Placeables/Banners/BlindedAnglerBanner.cs new file mode 100644 index 0000000000..a8cd03e747 --- /dev/null +++ b/Items/Placeables/Banners/BlindedAnglerBanner.cs @@ -0,0 +1,7 @@ +namespace CalamityMod.Items.Placeables.Banners +{ + public class BlindedAnglerBanner : BaseBanner + { + public override int BannerTileStyle => 104; + } +} diff --git a/Items/Placeables/Banners/BlindedAnglerBanner.png b/Items/Placeables/Banners/BlindedAnglerBanner.png new file mode 100644 index 0000000000000000000000000000000000000000..6f56ac9128994a130c4082abc10a743932e71dc5 GIT binary patch literal 348 zcmV-i0i*tjP)f0003YNklx$w8whHE z83*&ckd^?74ezdf0P|s?2M?9FV@h4 z+d#GkSlThJs|4GCGp1oS5Ul~0MHLhwISd9K+=t{qSYF4-aYSoSv{we3WMXT8V#Ark u7r=as{6Mq@^rV4eJQ4?Io+hLL0J6lzha0Ct`~Uy|07*qoM6N<$f&c({lZ|`; literal 0 HcmV?d00001 diff --git a/Items/Placeables/Banners/PodobooKoiBanner.cs b/Items/Placeables/Banners/PodobooKoiBanner.cs deleted file mode 100644 index 14ac5680a0..0000000000 --- a/Items/Placeables/Banners/PodobooKoiBanner.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace CalamityMod.Items.Placeables.Banners -{ - public class PodobooKoiBanner : BaseBanner - { - public override int BannerTileStyle => 143; - } -} diff --git a/Items/Placeables/Banners/PodobooKoiBanner.png b/Items/Placeables/Banners/PodobooKoiBanner.png deleted file mode 100644 index c2b67aa9ccaa47dbdb5df78bf2e638205484420e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 418 zcmV;T0bTxyP)Px#1ZP1_K>z@;j|==^1poj6Oi4sRR5(wikv&KQK@djY%9Tn^IKiNe0YQ!6p*Ct6 z8^I!{g%@_bj#uotjtJ^kR zS|1yd0E^eh5SW=0*E=n5b|rm+3Wg_}0K`@X0mxNfAuzj=HlcOFwBwj|9Jf%%E!4wZ z0cjJ2aw%)SfKLK=t3CqIeb9`ygDCY5NPzT~=eL~b3^k~I6iJ)#b0JfKOa)PHAj*wU zQ&8H3mILR>5eYCg_wE(?OaLzSKLMDo-L$tu$YTKInv(PM5bYnn0WEA>8ED5_ZU6uP M07*qoM6N<$g4ngFtN;K2 diff --git a/Items/Placeables/Banners/SandProwlerBanner.cs b/Items/Placeables/Banners/SandProwlerBanner.cs deleted file mode 100644 index 9fef623265..0000000000 --- a/Items/Placeables/Banners/SandProwlerBanner.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - [LegacyName("SeaSerpentBanner")] - public class SandProwlerBanner : BaseBanner - { - public override int BannerTileStyle => 106; - } -} diff --git a/Items/Placeables/Banners/SandProwlerBanner.png b/Items/Placeables/Banners/SandProwlerBanner.png deleted file mode 100644 index c440619fe1c1342abb5734ca389551c0ffda1491..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 411 zcmV;M0c8G(P)Px#1ZP1_K>z@;j|==^1poj6MM*?KR5(wqlrc-gKp2Lflwb$J3@+W0A+!#sUi%@jX(Luyf7s1gi4i+?o3T7yXMWF!^M2y36Ax&Can!M9} z@A2Kkd*5*|K$U_SR0?Jg_j7S$SSfKsN>YALHUY@39RhIq+EhqGOf*`$7FfC#R7)+Y zrB>)0`8Gzr9oC7)VHIYybS(f_HNF8je;FfM7t2KeF0Pu8hN#93dGdBy)UNFUFga%m zBP}s8N11hM;s=2By~VEm0VA^jtBL5=s|LPF@T!a zNk{D4=-Mu>?c(?+uaDB&pGfauLrs{qPJuNKzvc{{Tj&a9nTX8Q1^-002ovPDHLk FV1k^Hr~d!| diff --git a/Items/Placeables/Banners/SeaSerpentBanner.cs b/Items/Placeables/Banners/SeaSerpentBanner.cs new file mode 100644 index 0000000000..ef12cc3ebc --- /dev/null +++ b/Items/Placeables/Banners/SeaSerpentBanner.cs @@ -0,0 +1,7 @@ +namespace CalamityMod.Items.Placeables.Banners +{ + public class SeaSerpentBanner : BaseBanner + { + public override int BannerTileStyle => 106; + } +} diff --git a/Items/Placeables/Banners/SeaSerpentBanner.png b/Items/Placeables/Banners/SeaSerpentBanner.png new file mode 100644 index 0000000000000000000000000000000000000000..e384093d740a47c861fe476170b44ea8fb4b0004 GIT binary patch literal 300 zcmV+{0n`48P)f0002;Nklc4!OfyofA>#ZA6dP6;T0m^L_5r&M zL~C%EI3H|+R)!@?JnYLY!EOV|8iX() || npc.type == ModContent.NPCType()) + if (npc.type == ModContent.NPCType()) npc.direction *= -1; } else diff --git a/NPCs/SunkenSea/BlindedAngler.cs b/NPCs/SunkenSea/BlindedAngler.cs new file mode 100644 index 0000000000..7d43671bd6 --- /dev/null +++ b/NPCs/SunkenSea/BlindedAngler.cs @@ -0,0 +1,150 @@ +using System.IO; +using CalamityMod.BiomeManagers; +using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs.NormalNPCs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.GameContent; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; +namespace CalamityMod.NPCs.SunkenSea +{ + public class BlindedAngler : ModNPC + { + public static Asset GlowTexture; + + public override void SetStaticDefaults() + { + Main.npcFrameCount[NPC.type] = 6; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } + } + + public override void SetDefaults() + { + NPC.noGravity = true; + NPC.damage = 150; + NPC.width = 56; + NPC.height = 44; + NPC.defense = 30; + NPC.lifeMax = 750; + NPC.aiStyle = -1; + AIType = -1; + NPC.value = Item.buyPrice(0, 0, 40, 0); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.knockBackResist = 0.1f; + Banner = NPC.type; + BannerItem = ModContent.ItemType(); + NPC.chaseable = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.BlindedAngler") + }); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(NPC.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + NPC.chaseable = reader.ReadBoolean(); + } + + public override void AI() + { + Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.75f / 255f, (255 - NPC.alpha) * 0.75f / 255f); + CalamityRegularEnemyAI.PassiveSwimmingAI(NPC, Mod, 1, 100f, 0.1f, 0.1f, 3f, 3f, 0.1f); + } + + public override void FindFrame(int frameHeight) + { + NPC.frameCounter += (NPC.wet || NPC.IsABestiaryIconDummy) ? 0.15f : 0f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; + } + + public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); + Vector2 vector = center - screenPos; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); + Main.spriteBatch.Draw(GlowTexture.Value, vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); + } + + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) + { + return NPC.chaseable; + } + return null; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (Main.hardMode && spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + { + return SpawnCondition.CaveJellyfish.Chance * 0.45f; + } + return 0f; + } + + public override void ModifyNPCLoot(NPCLoot npcLoot) + { + npcLoot.Add(ModContent.ItemType(), 1, 5, 9); + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); + } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BlindAnglerGore1").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BlindAnglerGore2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BlindAnglerGore3").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BlindAnglerGore4").Type, 1f); + } + } + } + } +} diff --git a/NPCs/SunkenSea/BlindedAngler.png b/NPCs/SunkenSea/BlindedAngler.png new file mode 100644 index 0000000000000000000000000000000000000000..afdae097349f511c70ae0d878532fa33366cddf6 GIT binary patch literal 4065 zcmV<74<7J|P)GROHpY?Oi5vxKw&N6uLihWwzm2s-I}8sZLL-I!?ji{E4Pg1 z%DHScqB%FTFcFY`AQ_I#Ny_BMH>p6BLR{H)f18M&GnH09Wn#tux#+ zKl-El-tqIb9zz&{a{u1C)g8a@W8XL{|jsc=rusH*fi_XZY1KK2&Jb&COtK0KVnA>pX@AW}oz;=2aiP z(QWU1c4x-W=AUMa-*Tt>zT(#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w#pxj4@n%I#fkSRFuZw#&Vg%RNAi;nL^TdC}4@ zP`dmHU}+1NF2BCCW3Z^(#BozzweyRC2VAs`f5 zy1X%5D(!U^o4ZL0KCKz71|YI#K@Tcr8^Io+bMq&Ik)dJZj6tV1Zwu$KgCwUE1Ve4d zpV17u1=x0rOjur$bZN|SBJ<)5x&f#uoveF+YGOQmY06Qycy7aL0BX$wOS#~4V1}b5 zgg(sN@`mlTAzWe!tcXRtHd<#&a*_at}~rxb*pC zA1wWXspU@qQ!Uu{{VId_C@Zx`(HGGA07|>>@VsZ&t3sbBaIT7}SwsR!0z7%_(s8w?ZkS#P6ol7ip>WJPwz*Nf( z<$kp%Gn5yNeUIV*`_5)L0o0-^&P$4?)D_y;s;Nd%sbFiuH}3jLLZDOt+WqD#$|5^f zIBA--*!4XPfOdWY2n$K$#7V2Run=rCIx!w+7s1+urd3<~?%UuNm=MNj1uMw8eYLd@ zVx;d5pyrEKts2yZ*6ft2oqjWe?f^;+I)HLj#R@N{9mDl}9>;srs#OC}5(2r=s<{U! z`5Jsk(yDR$hU*8XRdWkaY8EuD8kj@RMoQ+WY1O1WY;EUZ)pk(&R7VoyjSe7~>{`l& zFKM9sJ#%1(O2%4aL-S4U0ZL4=PinihvdR$OQSi7jmAU9SncQN$!2#rYo~l*j@^Y^? zntf23+;I<3o7HkJ<#G>DW4QGBWFIX3f~n BodySprite1; - public static Asset BodySprite2; - public static Asset BodySprite3; - public static Asset BodySprite4; - public static Asset BodySprite5; - public static Asset BodySprite6; - public static Asset BodySprite7; - public static Asset TailSprite; - #endregion - - public enum AnimType - { - None = 0, - Blink = 1, - Bite = 2 - } - - public bool IsHead => NPC.ai[3] == 0; - - public bool IsTail => NPC.ai[3] == 8; - - public ref float CurrentAnimation => ref NPC.localAI[1]; - - public ref float CurrentFrame => ref NPC.localAI[0]; - - public ref float BlinkTimer => ref NPC.localAI[2]; - protected override List PreyIDs => new List() - { - ModContent.NPCType(), - ModContent.NPCType(), - }; - - protected override List PredatorIDs => new List() - { - ModContent.NPCType(), - ModContent.NPCType() - }; - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.PolypForest; - - public override void SetStaticDefaults() - { - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() - { - PortraitPositionXOverride = 40, - PortraitPositionYOverride = 20 - }; - value.Position.Y += 20; - value.Position.X += 40; - NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - NPCID.Sets.TrailingMode[Type] = 1; - NPCID.Sets.CantTakeLunchMoney[Type] = true; // It will only eat coins that the AI says it can, and when it does, you aren't getting them back - if (!Main.dedServ) - { - BodySprite1 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler2", AssetRequestMode.AsyncLoad); - BodySprite2 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler3", AssetRequestMode.AsyncLoad); - BodySprite3 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler4", AssetRequestMode.AsyncLoad); - BodySprite4 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler5", AssetRequestMode.AsyncLoad); - BodySprite5 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler6", AssetRequestMode.AsyncLoad); - BodySprite6 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler7", AssetRequestMode.AsyncLoad); - BodySprite7 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler8", AssetRequestMode.AsyncLoad); - TailSprite = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler9", AssetRequestMode.AsyncLoad); - } - Main.npcFrameCount[Type] = 11; - base.SetStaticDefaults(); - } - - public override void SetDefaults() - { - base.SetDefaults(); - NPC.damage = 50; - NPC.width = 30; - NPC.height = 24; - NPC.defense = 10; - NPC.lifeMax = 300; - NPC.aiStyle = -1; - AIType = -1; - NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(silver: 20); - NPC.behindTiles = true; - NPC.noGravity = true; - NPC.noTileCollide = true; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.netAlways = true; - NPC.chaseable = false; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - NPC.waterMovementSpeed = 1; - NPC.GravityIgnoresLiquid = true; - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SandProwler") - }); - } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - // only the head gets a healthbar - return IsHead; - } - - - public override void AI() - { - if (IsHead) - HeadAI(); - else - SegmentAI(); - } - public void HeadAI() - { - Point point = NPC.Center.ToTileCoordinates(); - Tile tileSafely = Framing.GetTileSafely(point); - bool createDust = tileSafely.HasUnactuatedTile && NPC.Distance(Main.player[NPC.target].Center) < 800f; - if (createDust) - { - if (Main.rand.NextBool()) - { - Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, DustID.TreasureSparkle, 0f, 0f, 150, default(Color), 0.3f); - dust.fadeIn = 0.75f; - dust.velocity *= 0.1f; - dust.noLight = true; - } - } - - if (NPC.ai[2] > 0f) - { - NPC.realLife = (int)NPC.ai[2]; - } - if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead) - { - NPC.TargetClosest(true); - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (!TailSpawned && NPC.ai[0] == 0f) - { - int Previous = NPC.whoAmI; - for (int segment = 0; segment < maxLength; segment++) - { - int lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); - Main.npc[lol].realLife = NPC.whoAmI; - Main.npc[lol].ai[2] = (float)NPC.whoAmI; - Main.npc[lol].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; - float spriteUse = segment % 2 == 0 ? 3 : 4; // Looping body 3 and 4 - int width = 18; - switch (segment) - { - case maxLength - 1: - spriteUse = 8; // Tail - break; - case maxLength - 2: - spriteUse = 7; // Body 7 - width = 14 ; - break; - case maxLength - 3: - spriteUse = 6; // Body 6 - width = 16; - break; - case maxLength - 4: - spriteUse = 5; // Body 5 - break; - case 0: - spriteUse = 1; // Body 1 - break; - case 1: - spriteUse = 2; // Body 2 - break; - } - Main.npc[lol].ai[3] = spriteUse; - Main.npc[lol].npcSlots = 0; - Main.npc[lol].dontCountMe = true; - Main.npc[lol].width = width; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; - } - TailSpawned = true; - } - } - if (NPC.velocity.X < 0f) - { - NPC.spriteDirection = -1; - } - else if (NPC.velocity.X > 0f) - { - NPC.spriteDirection = 1; - } - if (Main.player[NPC.target].dead) - { - NPC.TargetClosest(false); - } - NPC.alpha -= 42; - if (NPC.alpha < 0) - { - NPC.alpha = 0; - } - if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 5600f) - { - NPC.active = false; - } - float currentSpeed = speed; - float currentTurnSpeed = turnSpeed; - Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - Entity targ = CurrentPrey != null ? CurrentPrey : Main.player[NPC.target]; - float targetXDist = targ.position.X + (float)(targ.width / 2); - float targetYDist = targ.position.Y + (float)(targ.height / 2); - bool coinTarget = false; - // fucking run if it notices a predator - if (CurrentPredator != null) - { - Vector2 dirToPred = NPC.DirectionTo(CurrentPredator.Center); - targetXDist = -dirToPred.X * 300; - targetYDist = -dirToPred.Y * 300; - currentSpeed *= 2f; - currentTurnSpeed *= 11.5f; - } - else - { - // Look for silver and gold coins to eat - for (int i = 0; i < Main.maxItems; i++) - { - Item item = Main.item[i]; - // continue if not an active silver or gold coin - if (item == null || !item.active || (item.type != ItemID.SilverCoin && item.type != ItemID.GoldCoin)) - continue; - // can only look for coins in a 75 tile radius - if (item.Distance(NPC.Center) > 1200) - continue; - // if its head touches the coin, eat it - if (item.getRect().Intersects(NPC.getRect())) - { - SoundEngine.PlaySound(SoundID.Item2 with { Pitch = 1.2f, Volume = 0.8f }, NPC.Center); - SoundEngine.PlaySound(SoundID.CoinPickup, NPC.Center); - int dustType = item.type == ItemID.SilverCoin ? DustID.SilverCoin : DustID.GoldCoin; - for (int j = 0; j < 4; j++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); - } - item.active = false; - break; - } - // if it isn't touching the coin, go to it - targetXDist = item.Center.X; - targetYDist = item.Center.Y; - coinTarget = true; - break; - } - } - // aggro on coins takes priority over players - if (CurrentPredator == null && (NPC.life > NPC.lifeMax * 0.99 && targ is Player) && !coinTarget) - { - targetYDist += 300; - if (Math.Abs(NPC.Center.X - Main.player[NPC.target].Center.X) < 250f) - { - if (NPC.velocity.X > 0f) - { - targetXDist = Main.player[NPC.target].Center.X + 300f; - } - else - { - targetXDist = Main.player[NPC.target].Center.X - 300f; - } - } - - // Blink every so often - if (Main.rand.NextBool(600) && CurrentAnimation == (int)AnimType.None && BlinkTimer <= 0) - { - CurrentAnimation = (int)AnimType.Blink; - BlinkTimer = Main.rand.NextBool(4) ? 48 : 24; - } - } - else if (CurrentPredator == null) - { - currentSpeed *= 1.5f; - currentTurnSpeed *= 1.5f; - } - float maxCurrentSpeed = currentSpeed * 1.3f; - float minCurrentSpeed = currentSpeed * 0.7f; - float speedCompare = NPC.velocity.Length(); - if (speedCompare > 0f) - { - if (speedCompare > maxCurrentSpeed) - { - NPC.velocity.Normalize(); - NPC.velocity *= maxCurrentSpeed; - } - else if (speedCompare < minCurrentSpeed) - { - NPC.velocity.Normalize(); - NPC.velocity *= minCurrentSpeed; - } - } - targetXDist = (float)((int)(targetXDist / 16f) * 16); - targetYDist = (float)((int)(targetYDist / 16f) * 16); - segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); - segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); - targetXDist -= segmentPosition.X; - targetYDist -= segmentPosition.Y; - float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - float absoluteTargetX = System.Math.Abs(targetXDist); - float absoluteTargetY = System.Math.Abs(targetYDist); - float timeToReachTarget = currentSpeed / targetDistance; - targetXDist *= timeToReachTarget; - targetYDist *= timeToReachTarget; - if (targetDistance < 128 && targ is NPC || (NPC.life <= NPC.lifeMax * 0.99 && targ is Player) || coinTarget) - { - CurrentAnimation = (int)AnimType.Bite; - } - else if (CurrentAnimation != (int)AnimType.Blink) - { - CurrentAnimation = (int)AnimType.None; - } - BlinkTimer--; - if (BlinkTimer <= 0) - { - BlinkTimer = 0; - if (CurrentAnimation == (int)AnimType.Blink) - { - CurrentAnimation = (int)AnimType.None; - } - } - if ((NPC.velocity.X > 0f && targetXDist > 0f) || (NPC.velocity.X < 0f && targetXDist < 0f) || (NPC.velocity.Y > 0f && targetYDist > 0f) || (NPC.velocity.Y < 0f && targetYDist < 0f)) - { - if (NPC.velocity.X < targetXDist) - { - NPC.velocity.X = NPC.velocity.X + currentTurnSpeed; - } - else - { - if (NPC.velocity.X > targetXDist) - { - NPC.velocity.X = NPC.velocity.X - currentTurnSpeed; - } - } - if (NPC.velocity.Y < targetYDist) - { - NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed; - } - else - { - if (NPC.velocity.Y > targetYDist) - { - NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed; - } - } - if ((double)System.Math.Abs(targetYDist) < (double)currentSpeed * 0.2 && ((NPC.velocity.X > 0f && targetXDist < 0f) || (NPC.velocity.X < 0f && targetXDist > 0f))) - { - if (NPC.velocity.Y > 0f) - { - NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed * 2f; - } - else - { - NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed * 2f; - } - } - if ((double)System.Math.Abs(targetXDist) < (double)currentSpeed * 0.2 && ((NPC.velocity.Y > 0f && targetYDist < 0f) || (NPC.velocity.Y < 0f && targetYDist > 0f))) - { - if (NPC.velocity.X > 0f) - { - NPC.velocity.X = NPC.velocity.X + currentTurnSpeed * 2f; //changed from 2 - } - else - { - NPC.velocity.X = NPC.velocity.X - currentTurnSpeed * 2f; //changed from 2 - } - } - } - else - { - if (absoluteTargetX > absoluteTargetY) - { - if (NPC.velocity.X < targetXDist) - { - NPC.velocity.X = NPC.velocity.X + currentTurnSpeed * 1.1f; //changed from 1.1 - } - else if (NPC.velocity.X > targetXDist) - { - NPC.velocity.X = NPC.velocity.X - currentTurnSpeed * 1.1f; //changed from 1.1 - } - if ((double)(System.Math.Abs(NPC.velocity.X) + System.Math.Abs(NPC.velocity.Y)) < (double)currentSpeed * 0.5) - { - if (NPC.velocity.Y > 0f) - { - NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed; - } - else - { - NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed; - } - } - } - else - { - if (NPC.velocity.Y < targetYDist) - { - NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed * 1.1f; - } - else if (NPC.velocity.Y > targetYDist) - { - NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed * 1.1f; - } - if ((double)(System.Math.Abs(NPC.velocity.X) + System.Math.Abs(NPC.velocity.Y)) < (double)currentSpeed * 0.5) - { - if (NPC.velocity.X > 0f) - { - NPC.velocity.X = NPC.velocity.X + currentTurnSpeed; - } - else - { - NPC.velocity.X = NPC.velocity.X - currentTurnSpeed; - } - } - } - } - NPC.rotation = (float)System.Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; - } - - public void SegmentAI() - { - if (NPC.ai[2] > 0f) - NPC.realLife = (int)NPC.ai[2]; - - // Check if other segments are still alive, if not, die - bool shouldDespawn = true; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType() && Main.npc[i].ai[3] == 0) - { - shouldDespawn = false; - break; - } - } - if (!shouldDespawn) - { - if (NPC.ai[1] <= 0f) - shouldDespawn = true; - else if (Main.npc[(int)NPC.ai[1]].life <= 0) - shouldDespawn = true; - } - if (shouldDespawn) - { - NPC.life = 0; - NPC.HitEffect(0, 10.0); - NPC.checkDead(); - NPC.active = false; - } - - if (Main.npc[(int)NPC.ai[1]].alpha < 128) - { - NPC.alpha -= 42; - if (NPC.alpha < 0) - NPC.alpha = 0; - } - - Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); - float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); - targetXDist = (float)((int)(targetXDist / 16f) * 16); - targetYDist = (float)((int)(targetYDist / 16f) * 16); - segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); - segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); - targetXDist -= segmentPosition.X; - targetYDist -= segmentPosition.Y; - float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) - { - try - { - segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float headDivisor = 1; - targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2 / headDivisor) - segmentPosition.X; - targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; - } - catch - { - } - NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; - targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - int segmentWidth = NPC.width; - targetDistance = (targetDistance - (float)segmentWidth) / targetDistance; - targetXDist *= targetDistance; - targetYDist *= targetDistance; - NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + targetXDist; - NPC.position.Y = NPC.position.Y + targetYDist; - - if (targetXDist < 0f) - NPC.spriteDirection = -1; - else if (targetXDist > 0f) - NPC.spriteDirection = 1; - } - } - - public override void FindFrame(int frameHeight) - { - if (IsTail) - { - NPC.frameCounter++; - if (NPC.frameCounter > 6) - { - NPC.localAI[0]++; - NPC.frameCounter = 0; - } - if (NPC.localAI[0] > 7) - { - NPC.localAI[0] = 0; - } - } - if (IsHead) - { - NPC.frameCounter++; - if (NPC.frameCounter > 6) - { - NPC.frame.Y += frameHeight; - NPC.frameCounter = 0; - } - switch (CurrentAnimation) - { - case (int)AnimType.None: - NPC.frame.Y = 0; - break; - case (int)AnimType.Bite: - if (NPC.frame.Y < frameHeight * 5 || NPC.frame.Y > frameHeight * 10) - { - NPC.frame.Y = frameHeight * 5; - } - break; - case (int)AnimType.Blink: - if (NPC.frame.Y < frameHeight || NPC.frame.Y > frameHeight * 4) - { - NPC.frame.Y = frameHeight; - } - break; - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (Main.hardMode && spawnInfo.Player.Calamity().ZonePolypForest && spawnInfo.Water && - !NPC.AnyNPCs(ModContent.NPCType()) && !spawnInfo.Player.Calamity().clamity && !spawnInfo.PlayerSafe) - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - - return 0f; - } - - public override bool CheckActive() - { - return IsHead; - } - - protected override bool NPCSearchFilter(NPC n) - { - float huntRange = 600f; - float avoidRange = 200f; - bool preyFilter = Vector2.DistanceSquared(NPC.Center, n.Center) < huntRange * huntRange && PreyIDs.Contains(n.type); - bool predFilter = Vector2.DistanceSquared(NPC.Center, n.Center) < avoidRange * avoidRange && PredatorIDs.Contains(n.type); - bool hidingGuppy = n.type == ModContent.NPCType() && n.alpha > 0; - return !hidingGuppy && (preyFilter || predFilter); - } - - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override bool CanHitNPC(NPC target) - { - return IsHead; - } - - public override void OnHitByProjectile(Projectile projectile, NPC.HitInfo hit, int damageDone) - { - PlayerHurt(); - } - - public override void OnHitByItem(Player player, Item item, NPC.HitInfo hit, int damageDone) - { - PlayerHurt(); - } - - public void PlayerHurt() - { - if (IsHead) - NPC.chaseable = true; - else - Main.npc[NPC.realLife].chaseable = true; - } - - public override void ModifyNPCLoot(NPCLoot npcLoot) => DefineSandProwlerLoot(npcLoot); - - public static void DefineSandProwlerLoot(NPCLoot npcLoot) - { - npcLoot.Add(ModContent.ItemType(), 4); - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); - } - if (!Main.dedServ) - { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore1").Type, 1f); - } - } - } - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - Texture2D segmentSprite = TextureAssets.Npc[Type].Value; - if (NPC.IsABestiaryIconDummy) - { - NPC.frame = segmentSprite.Frame(); - // Buffers the segment position and rotations - float offset = -0.2f; - float startX = 0; - float startY = 0; - int segmentSpacing = 16; - int animationSpeed = 5; - float wormTimer = NPC.Calamity().bestiaryWormTimer; - // Draw the body segments - for (int i = 7; i > 0; i--) - { - // The first segment is slightly closer to keep up with the head - float bodyOffset = i == 1 ? i * segmentSpacing * 0.4f : i * segmentSpacing - segmentSpacing * 0.5f; - - Texture2D toUse = i == 1 ? BodySprite1.Value : i == 2 ? BodySprite2.Value : i % 2 == 0 ? BodySprite3.Value : BodySprite4.Value; - spriteBatch.Draw(toUse, NPC.position + new Vector2(startX + bodyOffset, MathF.Sin((wormTimer + offset * i) * animationSpeed) * 2 + startY), toUse.Frame(1, 1, 0, 0), NPC.GetAlpha(drawColor), NPC.rotation - MathHelper.PiOver2 - MathF.Cos((wormTimer + offset * i) * animationSpeed) * MathHelper.PiOver4 * 0.075f, new Vector2(toUse.Width / 2, toUse.Width / 2), NPC.scale, SpriteEffects.None, 0f); - } - // Draw the head - spriteBatch.Draw(segmentSprite, NPC.position + new Vector2(startX, MathF.Sin(wormTimer * animationSpeed) * 2 + startY), segmentSprite.Frame(1, 11, 0, 0), NPC.GetAlpha(drawColor), NPC.rotation - MathHelper.PiOver2 - MathF.Cos(wormTimer * animationSpeed) * MathHelper.PiOver4 * 0.075f, new Vector2(segmentSprite.Width * 0.5f, segmentSprite.Height / 11), NPC.scale, SpriteEffects.None, 0f); - - return false; - } - switch (NPC.ai[3]) - { - case 0: - break; - case 1: - segmentSprite = BodySprite1.Value; - break; - case 2: - segmentSprite = BodySprite2.Value; - break; - case 3: - segmentSprite = BodySprite3.Value; - break; - case 4: - segmentSprite = BodySprite4.Value; - break; - case 5: - segmentSprite = BodySprite5.Value; - break; - case 6: - segmentSprite = BodySprite6.Value; - break; - case 7: - segmentSprite = BodySprite7.Value; - break; - case 8: - segmentSprite = TailSprite.Value; - break; - default: - segmentSprite = NPC.ai[3] % 2 == 0 ? BodySprite4.Value : BodySprite3.Value; - break; - } - float frameDivisor = IsTail ? 8 : IsHead ? Main.npcFrameCount[Type] : 1; - Vector2 origin = new Vector2(segmentSprite.Width / 2, segmentSprite.Height / 2 / frameDivisor); - Vector2 npcOffset = NPC.Center - screenPos; - npcOffset -= new Vector2(segmentSprite.Width, segmentSprite.Height / frameDivisor) * NPC.scale / 2f; - npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - SpriteEffects fx = NPC.oldPos[1].X < NPC.position.X ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Rectangle frame = segmentSprite.Frame(1, 1, 0, 0); - if (IsHead) - { - frame = NPC.frame; - } - else if (IsTail) - { - frame = segmentSprite.Frame(1, 8, 0, (int)NPC.localAI[0]); - } - spriteBatch.Draw(segmentSprite, npcOffset, frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, fx, 0f); - return false; - } - } -} diff --git a/NPCs/SunkenSea/SandProwler.png b/NPCs/SunkenSea/SandProwler.png deleted file mode 100644 index a36c31ffbb665f72f6cdf464646c066c541021a8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3888 zcmcInc{H0_yMNJ|s+1Ph98^tJL94`EU(;#@B?l#j)(}GxLs2PeI4w?xgqnhCkT$9+ zhDc+cjyf?^DJ3MRw&o#PDyZ?k{qDJU-Mj8O-@X6bcdd6ld+oiSwfBCW-}C$J{Qzlw z`JnJIVE_OQBFrz^f>s9rcs2$3!In8EI2SZLVYZjyKv~Z(a{wUv9&z!!{q3h5Vl>Wv zP`2Ha_En&wra@jq@G7D0&!z#44udUyvTEJ|k&(SBe(V_{&`zgMCs48KJf$>F$9{9; zxgX+KNhb4E-0Msg7~|XTvpODT%9a;d4h8j(C?e%^@-y2JYjQK%*oY+&Q{T9JQ`B@1 zk=41g6ge7pF3dV9qsDKy9mpQvJO^B;T{CX!XJQp+N*4`@JRLJ*6TvsHnz5g7*f5`-=$n_Q^cw!d3>t#t`tHC zufZkVBoTrge4~}CN&woeRy;o0^qi!Do5Yh__!3Ul_|{XS;7gbJ-7(=J*>~!_gc7&C zrosWyErR8@ zJ?jYs8Bpcpm4{*u#Phjri6Cdy63n%237b1N=gyz*Y?iY$&mNoaYW?lEdy(;L0!;!f z5_{XsAt|$-xRv({0LD%C;A4m4c%?)wOX3yHm+ev4#1#FUDiac<9E?2WDn_%2^d{M;sD*pL>f*P~#SqiYp;~Q4I{T4J-h+l<)Rs^n5f4D?|KN&GbfqaP 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$_u ztO}GTnAe|<9Bb@PyftO`NKXFfEzXCA2yEcnYxk7M;07V)XGC;EnYB( zL?z7&pO4}0;`V=f+q!{HVWA|o=knmADBav80gycLZ9>E@Bb$Ht)8yg`+m}1rSSW2+ zqsNQ43{ZBJtZ!`K0{*ygk37Ied7?YFdwd(e(+sB9v+FQ)r2P1&23;!>=1*RdyM4m=925$+M@p#G5Q6?jFV3ctz?7}CJ$%lLM z>ejz>0}UD6yjJ^astOUQZw(_c)t$rSjIM37JBhDC;7t{auq63lY+IcKBw)1bXM9@M zENiw~*F;*ho?PQ>IJi`^P$990Pd&`WW#gyJO-L3R(Ax63#n7_%%c*v$l|C@07b3a{ zR2SpFB~Fh0OX8ES_P57kOo4*9EOon|l<(hU_gVPsZkvaZB>%vjqE?7rd6+8OIz!_2kWrc5`6t4_QOx~+fe5RCLY*FhT spFU+k)+=_OJowNR^+q9lu3Q05fo(zX|M~UXrT;VtGwX|GaQD0a1`uqb@c;k- diff --git a/NPCs/SunkenSea/SandProwler2.png b/NPCs/SunkenSea/SandProwler2.png deleted file mode 100644 index bb3fe551b5f7849d20b4df7c63b38f1b0661e9b2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 293 zcmeAS@N?(olHy`uVBq!ia0vp^CO|C0!3-q7a=m*Gq!^2X+?^QKos)S9O9%LbxCTn76w33@)a5>A&-tcI|Npk&J(DBvT-gVdZ&o*31Ee@hg8YL2 zLjgmue}xc8u)rg-n1O-sFbFdq&tH)O6s+@faSXBW-#XEe?|=dai{pY{|HZG1n)JS1 zdC+o2q3q_sEd31SZSqe%Tx@0-hY9L#T4IzScJN22f%m5%qXOMUu6;*rR$J~+05V)y z9Iu}4TrqEQ09X6j7-MbKLkjMPoEOY0O*<5!aj>f2l-cS am0mVYoUv%C?j)c~7(8A5T-G@yGywqKz-m4K diff --git a/NPCs/SunkenSea/SandProwler3.png b/NPCs/SunkenSea/SandProwler3.png deleted file mode 100644 index 7a33532959bc372a9cfcd5d2e8a4c3d24491ae8c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 327 zcmeAS@N?(olHy`uVBq!ia0vp^CO|C0!3-q7a=m*Gq!^2X+?^QKos)S9s|WamxE9Lu&(!5UX3u%&%DzoU7w?%I`KC<&|F+;j36=M?LdPeDPsxx3 zsy%Mt@&QQkmIV0)|3?B0wl9?0fD)Vq9+AZi419+{nDKc2iWH#W1Wy;o5DWjUmk#nB zR^Va2Fk?cH#{d6&4||*WCN0%=^zm7C_RegSkFgQu&X J%Q~loCIErogsT7m diff --git a/NPCs/SunkenSea/SandProwler4.png b/NPCs/SunkenSea/SandProwler4.png deleted file mode 100644 index 8588ffaa7e4b9d10b1b3c1dd60c9c6b288a10176..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 333 zcmeAS@N?(olHy`uVBq!ia0vp^CO|C0!3-q7a=m*Gq!^2X+?^QKos)S9>jwCQxE9Lu&(!6v@>HFYAsHy4a?GCd&Xs+~Cx-8t9CGh-o8inG8YvY3H^?=T269?xHq0u=1?ba4!^ z@ZWm*Am3pHj)p`=*PM&r>+g7`Y% z*<9<^7E&MgGyaA1y%#Bg8Ea#mdKI;Vst03cX}^#A|> diff --git a/NPCs/SunkenSea/SandProwler5.png b/NPCs/SunkenSea/SandProwler5.png deleted file mode 100644 index c1b0777eeb44f49df430f8fea2266805d9a71e2a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 351 zcmeAS@N?(olHy`uVBq!ia0vp^CO|C0!3-q7a=m*Gq!^2X+?^QKos)S98wdD=xX#q&E|ll5@>HFYA$jM@z8%{-_DqgEX3zPiO#lD3;6MqL_q9SZ z7qu-<(V93pwexmAP@kf{?*kwuSQ6wH{2vW4sIHxv1eD|~@Q5sCVBk9p!i>lBSEK+1 zXL!0ehFJJ-y>yYUS%IhZp_muHhSvN4TNXFZa4p}c^L2kq4NLcxyo=Upiv*JL_3EDh z#e;%ai~0gxzMk7NVU@=_#n+5oUxE9Lu&(!6v@>C6!P+6X$)p@)B&Xs+8CPz-mkeoO<^?JVH@rmKb z>^WyHYWu$}_dO`7sn8d;H?)N`3@*>xLkBB-0{En=%ZD)e3|Px zD>)g7cbb2 ZX0xsnxX5tjh%wM;22WQ%mvv4FO#pc#PQU;F diff --git a/NPCs/SunkenSea/SandProwler8.png b/NPCs/SunkenSea/SandProwler8.png deleted file mode 100644 index c722b5e8f5c82c7a464b5c51ba46ffe6d4d488b9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 238 zcmeAS@N?(olHy`uVBq!ia0vp^CO|C2!3-pogLyvzDaPU;cPEB*=VV?2IV|apzK#qG z8~eHcB(ehe5&=FTu7&daRi3KH>^TD^RNmJLEl<&!sml$N?CiXI7)WuH1o;L3hX96q z&3hw(Vw?pYk;M!Qd_Z}=!;HuCSEK+1y**tVLoEFFUUuYSP~dR6xYFl+{bQ3Tv4tJ= z(?2M%C{EvC-R~XAk+C*Ae_HD?1E-K?kJS!tt1irWH?@6&?jklr_I=_GR$t~Hb1+alD7_2-AUwp>#3{OnRm=$WFqcd#JsG!eA5~1X zDS9hjLvfLY{ZP(rF9yVUbse)U}4B?%3-Z0UN*>PLny=f$3(4$~lxI`vsy!!NQV!S9^Z z{4S#c$P%gnUPNprJ5+9djYOFP(*`{Krhu8LU%P;%lKr0n#O6-?VGmD%otCWbf#VsQ zz?UN_&)26G+l!jiGd$zx41md4{e=H?xF}$ayjqVNQ)Imhy?dFq+y!=7S$|S9gMoTg zBG=`eRtWO-c3yTbpB?9al>rs(nJRvtnA0r?WRT zpR4KHM-jlVE#l<8e6;|umdG6g66^|J+7#E*wXrC!pLW;e01s>d&&+~@InRp0I(aW4H2_&|?Hk=8*#`mZ>*asS3tBi7+a7KK zG1%INkviCQLLK+z_<28|2pc^@Cxak`xnAlkTBZIRvl*-G3KkCc6&4z69F49DbW(a98K1m{ zb*%Gq$dA}9jl9N5X;?;c1Ko}LD(5qFHe51QA}-1d5Zu%O+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y$=kNIJ=pM>jcJpkX8?)YX#`Zq#HFLOS$Wr<5;}m(%g;`?M`y`v$hCBNcz~gPuiKh$|)WdA62T|o@~6;nPfmv zoIfXSVl~x0)w`I1z=)-G)wQpDI1fQ!^S+uw9hJyux z^2QN`J2LG*rCy<&tgH}gS8{1Eid-I)d;b?FUQd;)|L5HQyt>UBH0lkE;@ERT9Yqv! zh>}4}!YHqGQN+ZmTUve^=bGS5Xw=8K0A^ukT*5n9TO{!?D6XGMDwwW75rsdxn#x@% zh2vKJ-qnVwS$uMdNeHGj_KLj|*Qu5qQmG_|fWt99yLLRo+jd4LI!5OPm51_!@8)K0 zCEht5GF0mM`8nHr=IFHsxe*k211vv@B(r!o%a=tbH!%K{H4t^3_01%$Ej`ULVw3)o zxS;Qk7pU&B4XI+IS SpotToHideIn != Vector2.Zero; - public Point TileCoordsToHideIn - { - get => SpotToHideIn.ToTileCoordinates(); - set => SpotToHideIn = value.ToWorldCoordinates(); - } - public Vector2 SpotToHideIn - { - get => new Vector2(NPC.ai[0], NPC.ai[1]); - set - { - NPC.ai[0] = value.X; - NPC.ai[1] = value.Y; - } - } - - public bool InHidingSpot => NPC.WithinRange(SpotToHideIn, 8f); - - public bool RetreatingToHidingSpot - { - get => NPC.ai[2] == 1f; - set => NPC.ai[2] = value.ToInt(); - } - - public ref float SnapTimer => ref NPC.ai[3]; - public ref float SnapCooldown => ref NPC.localAI[0]; - public ref float InitialSnapDirection => ref NPC.localAI[1]; - public ref float CurrentSnapDirection => ref NPC.localAI[2]; - public override string Texture => "CalamityMod/NPCs/SunkenSea/SandProwler"; - protected override List PreyIDs => new List() - { - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - }; - - protected override List PredatorIDs => new List() - { - ModContent.NPCType() - }; - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.PolypForest; - - public override void SetStaticDefaults() - { - this.HideFromBestiary(); - NPCID.Sets.TrailingMode[Type] = 0; - NPCID.Sets.TrailCacheLength[Type] = 60; - NPCID.Sets.UsesNewTargetting[Type] = true; - NPCID.Sets.CantTakeLunchMoney[Type] = true; - Main.npcFrameCount[Type] = 11; - base.SetStaticDefaults(); - } - - public override void SetDefaults() - { - NPC.damage = 50; - NPC.width = 30; - NPC.height = 30; //32 - NPC.defense = 10; - NPC.lifeMax = 300; - NPC.aiStyle = -1; - AIType = -1; - NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(silver: 20); - NPC.behindTiles = true; - NPC.noGravity = true; - NPC.noTileCollide = true; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.chaseable = false; - NPC.netAlways = true; - Banner = ModContent.NPCType(); - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - - NPC.waterMovementSpeed = 1f; - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SeaSerpent") - }); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(PeekingOut); - writer.Write(SnapCooldown); - writer.Write(InitialSnapDirection); - writer.Write(CurrentSnapDirection); - writer.Write(NPC.Calamity().newAI[1]); - writer.Write(NPC.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - PeekingOut = reader.ReadBoolean(); - SnapCooldown = reader.ReadSingle(); - InitialSnapDirection = reader.ReadSingle(); - CurrentSnapDirection = reader.ReadSingle(); - NPC.Calamity().newAI[1] = reader.ReadSingle(); - NPC.chaseable = reader.ReadBoolean(); - } - - public override void AI() - { - // Choose an initial tile to hide in. - if (Main.netMode != NetmodeID.MultiplayerClient && !HasChosenSpotToHideIn) - { - int tries; - for (tries = 0; tries < 1800; tries++) - { - int x = (int)(NPC.Center.X / 16f) + Main.rand.Next(-25, 25); - int y = (int)(NPC.Center.Y / 16f) + Main.rand.Next(-25, 25); - Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); - - // Try again if the tile isn't solid or isn't exposed to air. - if (!WorldGen.SolidTile(tile) || !CalamityUtils.IsTileExposedToAir(x, y, out float? angleToOpenAir)) - continue; - - // Try again if there's no open water near the tile. - Vector2 moveDirection = angleToOpenAir.Value.ToRotationVector2(); - Vector2 collisionCheckPosition = new Vector2(x * 16f + 8f, y * 16f + 8f) + moveDirection * 16f; - float collisionDistance = CalamityUtils.DistanceToTileCollisionHit(collisionCheckPosition, moveDirection, 20) ?? 20; - if (collisionDistance <= 10) - continue; - - TileCoordsToHideIn = new Point(x, y); - break; - } - - // Just die if no spot was suitable. - if (tries >= 1799) - NPC.active = false; - - NPC.Center = SpotToHideIn; - NPC.netUpdate = true; - } - - Entity target = null; - - // Look for coins - for (int i = 0; i < Main.maxItems; i++) - { - Item n = Main.item[i]; - if (n == null || !n.active || (n.type != ItemID.SilverCoin && n.type != ItemID.GoldCoin)) - continue; - // if its head touches the coin, eat it - if (n.getRect().Intersects(NPC.getRect())) - { - SoundEngine.PlaySound(SoundID.Item2 with { Pitch = 1.2f, Volume = 0.8f }, NPC.Center); - SoundEngine.PlaySound(SoundID.CoinPickup, NPC.Center); - int dustType = n.type == ItemID.SilverCoin ? DustID.SilverCoin : DustID.GoldCoin; - for (int j = 0; j < 4; j++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); - } - n.active = false; - break; - } - // Set the coin as the target - if (n.Distance(NPC.Center) <= 300 && Collision.CheckAABBvLineCollision(NPC.Center, NPC.Size, NPC.Center, n.Center)) - { - target = n; - } - } - // Go after sea minnows if not distracted by shiny coin - if (target == null) - { - if (NPC.life > NPC.lifeMax * 0.99f) - { - if (CurrentPrey != null) - target = CurrentPrey; - } - // If you've pissed it off, it now goes after YOU - else - { - NPC.TargetClosest(false); - target = Main.player[NPC.target]; - } - } - - // Open mouth when launching towards a target - if (SnapTimer > 0 && target != null && !PeekingOut) - { - NPC.Calamity().newAI[1] = 1; - } - else if (RetreatingToHidingSpot || InHidingSpot) - { - NPC.Calamity().newAI[1] = 0; - } - - // Become invulnerable and mostly transparent if hiding in a tile. - NPC.dontTakeDamage = InHidingSpot; - NPC.Opacity = MathHelper.Clamp(NPC.Opacity - NPC.dontTakeDamage.ToDirectionInt(), 0.35f, 1f); - - // Also emit some particle effects as an indicator. - if (InHidingSpot) - { - Dust sparkle = Dust.NewDustDirect(TileCoordsToHideIn.ToWorldCoordinates(0, 0), 16, 16, DustID.AncientLight); - sparkle.color = Color.Orange; - sparkle.velocity = Main.rand.NextVector2Circular(4f, 4f); - sparkle.noGravity = true; - } - - // Decide rotation. - NPC.rotation = NPC.AngleFrom(SpotToHideIn) + MathHelper.PiOver2; - - // Prevent the tile from being destroyed. - FixExploitManEaters.ProtectSpot(TileCoordsToHideIn.X, TileCoordsToHideIn.Y); - - // Do nothing other than hiding if instructed to do so. - if (RetreatingToHidingSpot) - { - NPC.velocity = NPC.SafeDirectionTo(SpotToHideIn) * 0.002f; - NPC.position += NPC.velocity.SafeNormalize(Vector2.Zero) * 5f; - - // Stop once the hiding spot has been reached. - if (InHidingSpot) - { - NPC.Center = SpotToHideIn; - NPC.velocity = Vector2.Zero; - RetreatingToHidingSpot = false; - NPC.netUpdate = true; - } - - return; - } - - // Don't do any snapping and such if the cooldown is active. - if (SnapCooldown > 0f) - { - SnapCooldown--; - if (SnapCooldown <= 0f) - NPC.netUpdate = true; - return; - } - - if (SnapTimer > 0f) - { - int snapTime = PeekingOut ? 45 : 32; - float idealSpeed = PeekingOut ? 1.75f : 10f; - float newSpeed = MathHelper.Lerp(NPC.velocity.Length(), idealSpeed, 0.08f); - NPC.velocity = CurrentSnapDirection.ToRotationVector2() * newSpeed; - - // Get closer to the target if one not peeking. - if (!PeekingOut && target != null) - CurrentSnapDirection = CurrentSnapDirection.AngleTowards(NPC.AngleTo(target.Center), 0.0125f); - - // Retreat if velocity is zero for some reason. - if (NPC.velocity == Vector2.Zero) - { - SnapTimer = 0f; - RetreatingToHidingSpot = true; - NPC.netUpdate = true; - return; - } - - SnapTimer++; - if (SnapTimer >= snapTime || (Collision.SolidCollision(NPC.Center, 1, 1) && SnapTimer > 5f)) - { - SnapTimer = 0f; - SnapCooldown = 35f; - PeekingOut = false; - RetreatingToHidingSpot = true; - } - - return; - } - - Vector2 snapDirection = Vector2.UnitY.RotatedBy(MathHelper.PiOver2 * Main.rand.Next(4)); - - // Pick a potential direction to snap out. - // This is important for attacking. - int snapDirectionTries = 0; - float targetSnapAngularThreshold = 0.48f; - while ((CalamityUtils.DistanceToTileCollisionHit(SpotToHideIn, snapDirection, 50) ?? 50f) < 5f) - { - snapDirectionTries++; - snapDirection = snapDirection.RotatedBy(MathHelper.PiOver2); - - if (snapDirectionTries >= 8) - return; - - // Try again if there's a defined target and it isn't in the line of sight of the current direction. - if (target != null && snapDirection.AngleBetween(NPC.SafeDirectionTo(target.Center)) > targetSnapAngularThreshold) - continue; - } - - // Snap out if a suitable target gets close. - // Otherwise, sometimes randomly peek out. - bool canSnapAtTarget = - target != null && - snapDirection.AngleBetween(NPC.SafeDirectionTo(target.Center)) < targetSnapAngularThreshold && - Collision.CanHit(NPC.Center + snapDirection * 12f, 1, 1, target.Center, 1, 1); - if (Main.rand.NextBool(30) && !canSnapAtTarget) - PeekingOut = true; - - if (PeekingOut || canSnapAtTarget) - { - if (canSnapAtTarget) - SoundEngine.PlaySound(SoundID.Item96, NPC.Center); - else - SoundEngine.PlaySound(SoundID.Item95, NPC.Center); - - // Add some randomness when peeking. - if (PeekingOut) - snapDirection = snapDirection.RotatedByRandom(MathHelper.Pi / 6f); - - NPC.velocity = snapDirection * 4f; - InitialSnapDirection = CurrentSnapDirection = NPC.velocity.ToRotation(); - SnapTimer = 1f; - NPC.netUpdate = true; - } - } - - public override void OnHitByProjectile(Projectile projectile, NPC.HitInfo hit, int damageDone) - { - PlayerHurt(); - } - - public override void OnHitByItem(Player player, Item item, NPC.HitInfo hit, int damageDone) - { - PlayerHurt(); - } - - public void PlayerHurt() - { - NPC.chaseable = true; - } - - public override void FindFrame(int frameHeight) - { - if (NPC.Calamity().newAI[1] == 1) - { - NPC.frameCounter++; - if (NPC.frameCounter > 3) - { - NPC.frameCounter = 0; - NPC.frame.Y += frameHeight; - } - if (NPC.frame.Y < frameHeight * 5 || NPC.frame.Y > frameHeight * 10) - { - NPC.frame.Y = frameHeight * 5; - } - } - else - { - NPC.frameCounter = 0; - NPC.frame.Y = 0; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - if (InHidingSpot) - return false; - - Texture2D headTexture = ModContent.Request(Texture).Value; - Texture2D body1Texture = SandProwler.BodySprite1.Value; - Texture2D body2Texture = SandProwler.BodySprite2.Value; - Texture2D body3Texture = SandProwler.BodySprite3.Value; - Texture2D body4Texture = SandProwler.BodySprite4.Value; - - Vector2 idealDrawPosition = SpotToHideIn; - Vector2 backOffset = (NPC.rotation - MathHelper.PiOver2).ToRotationVector2() * -18f; - if (Collision.SolidCollision(idealDrawPosition + backOffset, 4, 4)) - idealDrawPosition += backOffset; - - List bezierPoints = new List() - { - idealDrawPosition - }; - - // Calculate points to create segments at based on a catmull-rom spine. - float bendFactor = Utils.GetLerpValue(80f, 250f, NPC.Distance(idealDrawPosition), true); - for (int i = 0; i < 20; i++) - { - Vector2 leftEnd = idealDrawPosition - InitialSnapDirection.ToRotationVector2() * bendFactor * 450f; - Vector2 rightEnd = NPC.Center + CurrentSnapDirection.ToRotationVector2() * bendFactor * 450f; - bezierPoints.Add(Vector2.CatmullRom(leftEnd, idealDrawPosition, NPC.Center, rightEnd, i / 19f)); - } - bezierPoints.Add(NPC.Center); - - // And then generalize them with a bezier curve. - BezierCurve bezierCurve = new BezierCurve(bezierPoints.ToArray()); - int totalChains = (int)(NPC.Distance(idealDrawPosition) / 16f); - totalChains = (int)MathHelper.Clamp(totalChains, 2f, 100f); - - for (int i = 0; i < totalChains - 1; i++) - { - Texture2D textureToUse; - - - if (i % 2 == 0) - { - textureToUse = body3Texture; - } - else - { - textureToUse = body4Texture; - } - - switch (totalChains - i - 1) - { - case 1: - textureToUse = headTexture; - break; - case 2: - textureToUse = body1Texture; - break; - case 3: - textureToUse = body2Texture; - break; - } - - Vector2 drawPosition = bezierCurve.Evaluate(i / (float)totalChains); - Color lightColor = Lighting.GetColor((int)(drawPosition.X / 16f), (int)(drawPosition.Y / 16f)); - float angle = (bezierCurve.Evaluate(i / (float)totalChains + 1f / totalChains) - drawPosition).ToRotation() + MathHelper.PiOver2; - Rectangle frame = textureToUse.Frame(1, 1, 0, 0); - if (textureToUse == headTexture) - { - frame = NPC.frame; - } - Vector2 origin = new Vector2(textureToUse.Width / 2, textureToUse.Height / (textureToUse == headTexture ? 22 : 2)); - spriteBatch.Draw(textureToUse, drawPosition - Main.screenPosition, frame, lightColor, angle, origin, NPC.scale, SpriteEffects.None, 0f); - } - return false; - } - protected override bool NPCSearchFilter(NPC n) - { - return Vector2.DistanceSquared(NPC.Center, n.Center) < 200f * 200f && (PreyIDs.Contains(n.type) || PredatorIDs.Contains(n.type)); - } - - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - return NPC.life < NPC.lifeMax * 0.99f; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZonePolypForest && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity && !spawnInfo.PlayerSafe) - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - - return 0f; - } - - public override void ModifyNPCLoot(NPCLoot npcLoot) => SandProwler.DefineSandProwlerLoot(npcLoot); - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0 && !Main.dedServ) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); - } - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore1").Type, NPC.scale); - } - } - public override void OnKill() - { - // Increase the kill count of Sand Prowlers for the Bestiary - if (NPC.GetWereThereAnyInteractions()) - { - NPC nPC = new NPC(); - nPC.SetDefaults(ModContent.NPCType()); - Main.BestiaryTracker.Kills.RegisterKill(nPC); - } - } - } -} diff --git a/NPCs/SunkenSea/SeaSerpent1.cs b/NPCs/SunkenSea/SeaSerpent1.cs new file mode 100644 index 0000000000..4016030b22 --- /dev/null +++ b/NPCs/SunkenSea/SeaSerpent1.cs @@ -0,0 +1,319 @@ +using System; +using CalamityMod.BiomeManagers; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Weapons.Magic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; +namespace CalamityMod.NPCs.SunkenSea +{ + public class SeaSerpent1 : ModNPC + { + public const int maxLength = 9; + public float speed = 3f; + public float turnSpeed = 0.0625f; + bool TailSpawned = false; + + public override void SetStaticDefaults() + { + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() + { + CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/SeaSerpent_Bestiary", + PortraitPositionXOverride = 40, + PortraitPositionYOverride = 20 + }; + value.Position.Y += 20; + value.Position.X += 40; + NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + } + + public override void SetDefaults() + { + NPC.damage = 50; + NPC.width = 50; //42 + NPC.height = 24; //32 + NPC.defense = 10; + NPC.lifeMax = 3000; + NPC.aiStyle = -1; + AIType = -1; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 20, 0); + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + Banner = NPC.type; + BannerItem = ModContent.ItemType(); + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SeaSerpent") + }); + } + + public override void AI() + { + Point point = NPC.Center.ToTileCoordinates(); + Tile tileSafely = Framing.GetTileSafely(point); + bool createDust = tileSafely.HasUnactuatedTile && NPC.Distance(Main.player[NPC.target].Center) < 800f; + if (createDust) + { + if (Main.rand.NextBool()) + { + Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, DustID.TreasureSparkle, 0f, 0f, 150, default(Color), 0.3f); + dust.fadeIn = 0.75f; + dust.velocity *= 0.1f; + dust.noLight = true; + } + } + + Lighting.AddLight(NPC.Center, 0f, (255 - NPC.alpha) * 0.3f / 255f, (255 - NPC.alpha) * 0.3f / 255f); + + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead) + NPC.TargetClosest(true); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!TailSpawned && NPC.ai[0] == 0f) + { + int Previous = NPC.whoAmI; + for (int segment = 0; segment < maxLength; segment++) + { + int lol = 0; + if (segment == 0 || segment == 1 || segment == 4 || segment == 5) + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); + else if (segment == 2 || segment == 3 || segment == 6) + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); + else if (segment == 7) + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); + else if (segment == 8) + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); + + Main.npc[lol].realLife = NPC.whoAmI; + Main.npc[lol].ai[2] = (float)NPC.whoAmI; + Main.npc[lol].ai[1] = (float)Previous; + Main.npc[Previous].ai[0] = (float)lol; + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); + Previous = lol; + } + + TailSpawned = true; + } + } + + if (NPC.velocity.X < 0f) + NPC.spriteDirection = -1; + else if (NPC.velocity.X > 0f) + NPC.spriteDirection = 1; + + if (Main.player[NPC.target].dead) + NPC.TargetClosest(false); + + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 5600f) + { + NPC.TargetClosest(false); + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 5600f) + NPC.active = false; + } + + float currentSpeed = speed; + float currentTurnSpeed = turnSpeed; + Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + if (NPC.life > NPC.lifeMax * 0.99) + { + targetYDist += 300; + if (Math.Abs(NPC.Center.X - Main.player[NPC.target].Center.X) < 250f) + { + if (NPC.velocity.X > 0f) + { + targetXDist = Main.player[NPC.target].Center.X + 300f; + } + else + { + targetXDist = Main.player[NPC.target].Center.X - 300f; + } + } + } + else + { + currentSpeed *= 1.5f; + currentTurnSpeed *= 1.5f; + } + float maxCurrentSpeed = currentSpeed * 1.3f; + float minCurrentSpeed = currentSpeed * 0.7f; + float speedCompare = NPC.velocity.Length(); + if (speedCompare > 0f) + { + if (speedCompare > maxCurrentSpeed) + { + NPC.velocity.Normalize(); + NPC.velocity *= maxCurrentSpeed; + } + else if (speedCompare < minCurrentSpeed) + { + NPC.velocity.Normalize(); + NPC.velocity *= minCurrentSpeed; + } + } + targetXDist = (float)((int)(targetXDist / 16f) * 16); + targetYDist = (float)((int)(targetYDist / 16f) * 16); + segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); + segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); + targetXDist -= segmentPosition.X; + targetYDist -= segmentPosition.Y; + float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + float absoluteTargetX = System.Math.Abs(targetXDist); + float absoluteTargetY = System.Math.Abs(targetYDist); + float timeToReachTarget = currentSpeed / targetDistance; + targetXDist *= timeToReachTarget; + targetYDist *= timeToReachTarget; + if ((NPC.velocity.X > 0f && targetXDist > 0f) || (NPC.velocity.X < 0f && targetXDist < 0f) || (NPC.velocity.Y > 0f && targetYDist > 0f) || (NPC.velocity.Y < 0f && targetYDist < 0f)) + { + if (NPC.velocity.X < targetXDist) + { + NPC.velocity.X = NPC.velocity.X + currentTurnSpeed; + } + else + { + if (NPC.velocity.X > targetXDist) + { + NPC.velocity.X = NPC.velocity.X - currentTurnSpeed; + } + } + if (NPC.velocity.Y < targetYDist) + { + NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed; + } + else + { + if (NPC.velocity.Y > targetYDist) + { + NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed; + } + } + if ((double)System.Math.Abs(targetYDist) < (double)currentSpeed * 0.2 && ((NPC.velocity.X > 0f && targetXDist < 0f) || (NPC.velocity.X < 0f && targetXDist > 0f))) + { + if (NPC.velocity.Y > 0f) + { + NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed * 2f; + } + else + { + NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed * 2f; + } + } + if ((double)System.Math.Abs(targetXDist) < (double)currentSpeed * 0.2 && ((NPC.velocity.Y > 0f && targetYDist < 0f) || (NPC.velocity.Y < 0f && targetYDist > 0f))) + { + if (NPC.velocity.X > 0f) + { + NPC.velocity.X = NPC.velocity.X + currentTurnSpeed * 2f; //changed from 2 + } + else + { + NPC.velocity.X = NPC.velocity.X - currentTurnSpeed * 2f; //changed from 2 + } + } + } + else + { + if (absoluteTargetX > absoluteTargetY) + { + if (NPC.velocity.X < targetXDist) + { + NPC.velocity.X = NPC.velocity.X + currentTurnSpeed * 1.1f; //changed from 1.1 + } + else if (NPC.velocity.X > targetXDist) + { + NPC.velocity.X = NPC.velocity.X - currentTurnSpeed * 1.1f; //changed from 1.1 + } + if ((double)(System.Math.Abs(NPC.velocity.X) + System.Math.Abs(NPC.velocity.Y)) < (double)currentSpeed * 0.5) + { + if (NPC.velocity.Y > 0f) + { + NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed; + } + else + { + NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed; + } + } + } + else + { + if (NPC.velocity.Y < targetYDist) + { + NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed * 1.1f; + } + else if (NPC.velocity.Y > targetYDist) + { + NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed * 1.1f; + } + if ((double)(System.Math.Abs(NPC.velocity.X) + System.Math.Abs(NPC.velocity.Y)) < (double)currentSpeed * 0.5) + { + if (NPC.velocity.X > 0f) + { + NPC.velocity.X = NPC.velocity.X + currentTurnSpeed; + } + else + { + NPC.velocity.X = NPC.velocity.X - currentTurnSpeed; + } + } + } + } + NPC.rotation = (float)System.Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (Main.hardMode && spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && + !NPC.AnyNPCs(ModContent.NPCType()) && !spawnInfo.Player.Calamity().clamity && !spawnInfo.PlayerSafe) + return SpawnCondition.CaveJellyfish.Chance * 0.3f; + + return 0f; + } + + public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 4); + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); + } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore1").Type, 1f); + } + } + } + } +} diff --git a/NPCs/SunkenSea/SeaSerpent1.png b/NPCs/SunkenSea/SeaSerpent1.png new file mode 100644 index 0000000000000000000000000000000000000000..0e144e18e20d4e035c054bb65a864469f472d617 GIT binary patch literal 730 zcmV<00ww*4P)=<@Q+l?M1JD0a_-^|YP+3%ZqYv9ttzCi$5 z{jC60N|macxXy5=0Z_;m0LYdiY@{};0BwhbEbEQEsP~AnRjdMpf?4Z^&$fJh`56F@uH6UV{p)uCbXnTn?kNLM zDGGV5B5t+nL86u&8;Agq%ZkV%y(ar<*6$G-0eFLz|ch0=D)F0)cR{QlGnRL zzkXZ=YGgxE+5OLNBmr3cd<&?N23glSyTK*^yX{hkDZ9(tG(=tNB)sgy6$hf>D zok=^CYE$Je*})_c$cV}YSC%w;FxW0X5QBI51pz25J$*XdgZj0ujB#fjM=s7 zU7`ooQO1R+o}yCsgxIS)S8ee#i3OYA{Ng+STb5RFbWQIPJ+O|>J^*SYRg3MDLe5M* z1|T*p>-tA9aY;JZ!|7z*yxt}1x{hX_0Pr%=TQ@#t&Epo?nZ*3QdA&i@c68+cnsK%>3y?qma?%@#wU~Mr4H1X-_H?n;F;|{iM%m4rY M07*qoM6N<$f@vIFg8%>k literal 0 HcmV?d00001 diff --git a/NPCs/SunkenSea/SeaSerpent2.cs b/NPCs/SunkenSea/SeaSerpent2.cs new file mode 100644 index 0000000000..4da1f8d931 --- /dev/null +++ b/NPCs/SunkenSea/SeaSerpent2.cs @@ -0,0 +1,147 @@ +using CalamityMod.Items.Placeables.Banners; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +namespace CalamityMod.NPCs.SunkenSea +{ + public class SeaSerpent2 : ModNPC + { + public float speed = 6f; + public float turnSpeed = 0.125f; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.SeaSerpent1.DisplayName"); + public override void SetStaticDefaults() + { + this.HideFromBestiary(); + } + + public override void SetDefaults() + { + NPC.damage = 40; + NPC.width = 24; //42 + NPC.height = 16; //24 + NPC.defense = 20; + NPC.lifeMax = 3000; + NPC.aiStyle = -1; //new + AIType = -1; //new + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.chaseable = false; + Banner = ModContent.NPCType(); + BannerItem = ModContent.ItemType(); + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + // Avoid cheap bullshit + NPC.damage = 0; + + Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.30f / 255f, (255 - NPC.alpha) * 0.30f / 255f); + + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = !NPC.AnyNPCs(ModContent.NPCType()); + if (!shouldDespawn) + { + if (NPC.ai[1] <= 0f) + shouldDespawn = true; + else if (Main.npc[(int)NPC.ai[1]].life <= 0) + shouldDespawn = true; + } + if (shouldDespawn) + { + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; + } + + if (Main.npc[(int)NPC.ai[1]].alpha < 128) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + + Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + targetXDist = (float)((int)(targetXDist / 16f) * 16); + targetYDist = (float)((int)(targetYDist / 16f) * 16); + segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); + segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); + targetXDist -= segmentPosition.X; + targetYDist -= segmentPosition.Y; + float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) + { + try + { + segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; + targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; + } + catch + { + } + NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; + targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + int segmentWidth = NPC.width; + targetDistance = (targetDistance - (float)segmentWidth) / targetDistance; + targetXDist *= targetDistance; + targetYDist *= targetDistance; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + targetXDist; + NPC.position.Y = NPC.position.Y + targetYDist; + + if (targetXDist < 0f) + NPC.spriteDirection = -1; + else if (targetXDist > 0f) + NPC.spriteDirection = 1; + } + } + + public override bool CheckActive() + { + return false; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); + } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore2").Type, 1f); + } + } + } + } +} diff --git a/NPCs/SunkenSea/SeaSerpent2.png b/NPCs/SunkenSea/SeaSerpent2.png new file mode 100644 index 0000000000000000000000000000000000000000..bdb5c315dbd0788fedeaaebecb84ace3c0b78bae GIT binary patch literal 613 zcmV-r0-F7aP)T@`_EzvVI}xkr(x<`n&>(2tole2*)FfE^@FaHsRm=UL|68l8 zZTR$N25jEZ7ONjPym!g-@83nF1If^T>RR!a*xdt$Z(c9Jnk`#XQRfMi$R?L)Q1D{8 zIyxgy29o984VrsZ1Jaicg7K-dV0vh<0P7l?Q?OV(pIoAKjkVxM?kDKV#HTvE2K8LL z4aRO=j`fdEjf3owN8sd*i0H`6*I*&P0M>4gyqa91VS1TgvR;v+d-5oe4E6oz;!{7; zACaxuw+nnLdKD>>Otk78y>}m#Ia)sTf&A#>xX0`28<1q8LI0YgVd|TnM^3Ds;^>qw%RJo6a91YjY^qohE>}c6_ zl1p^>!WC3{E~wfZ%@0I*IrA|}i}o|o7L_k CalamityUtils.GetText("NPCs.SeaSerpent1.DisplayName"); + public override void SetStaticDefaults() + { + this.HideFromBestiary(); + } + + public override void SetDefaults() + { + NPC.damage = 40; + NPC.width = 24; //42 + NPC.height = 16; //24 + NPC.defense = 20; + NPC.lifeMax = 3000; + NPC.aiStyle = -1; //new + AIType = -1; //new + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.chaseable = false; + Banner = ModContent.NPCType(); + BannerItem = ModContent.ItemType(); + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + // Avoid cheap bullshit + NPC.damage = 0; + + Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.30f / 255f, (255 - NPC.alpha) * 0.30f / 255f); + + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = !NPC.AnyNPCs(ModContent.NPCType()); + if (!shouldDespawn) + { + if (NPC.ai[1] <= 0f) + shouldDespawn = true; + else if (Main.npc[(int)NPC.ai[1]].life <= 0) + shouldDespawn = true; + } + if (shouldDespawn) + { + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; + } + + if (Main.npc[(int)NPC.ai[1]].alpha < 128) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + + Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + targetXDist = (float)((int)(targetXDist / 16f) * 16); + targetYDist = (float)((int)(targetYDist / 16f) * 16); + segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); + segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); + targetXDist -= segmentPosition.X; + targetYDist -= segmentPosition.Y; + float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) + { + try + { + segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; + targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; + } + catch + { + } + NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; + targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + int segmentWidth = NPC.width; + targetDistance = (targetDistance - (float)segmentWidth) / targetDistance; + targetXDist *= targetDistance; + targetYDist *= targetDistance; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + targetXDist; + NPC.position.Y = NPC.position.Y + targetYDist; + + if (targetXDist < 0f) + NPC.spriteDirection = -1; + else if (targetXDist > 0f) + NPC.spriteDirection = 1; + } + } + + public override bool CheckActive() + { + return false; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); + } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore3").Type, 1f); + } + } + } + } +} diff --git a/NPCs/SunkenSea/SeaSerpent3.png b/NPCs/SunkenSea/SeaSerpent3.png new file mode 100644 index 0000000000000000000000000000000000000000..3ca49fc95e6fa4b16de16119584036439a23e235 GIT binary patch literal 466 zcmV;@0WJQCP)_x%XVYe9!kD4TJF5hf4sykRO0tIsA-*uIhJuG@^I8_@?-%|Md*`J_Gy~)@3v> z8UP>~IR`4t)$>uAu0)&S!(TLN2-aovc6UpE5zUnutM<`~-|7%1C7$KQR9)*b+Grjv zEi40|9UlO#dDJ-S`C_NX2Ebd@JlgWndT2C{65CMno6bi+09nAAYJ+@ojsO4v07*qo IM6N<$g5!J8x&QzG literal 0 HcmV?d00001 diff --git a/NPCs/SunkenSea/SeaSerpent4.cs b/NPCs/SunkenSea/SeaSerpent4.cs new file mode 100644 index 0000000000..5f215471e2 --- /dev/null +++ b/NPCs/SunkenSea/SeaSerpent4.cs @@ -0,0 +1,145 @@ +using CalamityMod.Items.Placeables.Banners; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +namespace CalamityMod.NPCs.SunkenSea +{ + public class SeaSerpent4 : ModNPC + { + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.SeaSerpent1.DisplayName"); + public override void SetStaticDefaults() + { + this.HideFromBestiary(); + } + + public override void SetDefaults() + { + NPC.damage = 30; + NPC.width = 28; //42 + NPC.height = 24; //34 + NPC.defense = 20; + NPC.lifeMax = 3000; + NPC.aiStyle = -1; //new + AIType = -1; //new + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.chaseable = false; + Banner = ModContent.NPCType(); + BannerItem = ModContent.ItemType(); + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + // Avoid cheap bullshit + NPC.damage = 0; + + Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.30f / 255f, (255 - NPC.alpha) * 0.30f / 255f); + + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = !NPC.AnyNPCs(ModContent.NPCType()); + if (!shouldDespawn) + { + if (NPC.ai[1] <= 0f) + shouldDespawn = true; + else if (Main.npc[(int)NPC.ai[1]].life <= 0) + shouldDespawn = true; + } + if (shouldDespawn) + { + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; + } + + if (Main.npc[(int)NPC.ai[1]].alpha < 128) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + + Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + targetXDist = (float)((int)(targetXDist / 16f) * 16); + targetYDist = (float)((int)(targetYDist / 16f) * 16); + segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); + segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); + targetXDist -= segmentPosition.X; + targetYDist -= segmentPosition.Y; + float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) + { + try + { + segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; + targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; + } + catch + { + } + NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; + targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + int segmentWidth = NPC.width; + targetDistance = (targetDistance - (float)segmentWidth) / targetDistance; + targetXDist *= targetDistance; + targetYDist *= targetDistance; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + targetXDist; + NPC.position.Y = NPC.position.Y + targetYDist; + + if (targetXDist < 0f) + NPC.spriteDirection = -1; + else if (targetXDist > 0f) + NPC.spriteDirection = 1; + } + } + + public override bool CheckActive() + { + return false; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); + } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore4").Type, 1f); + } + } + } + } +} diff --git a/NPCs/SunkenSea/SeaSerpent4.png b/NPCs/SunkenSea/SeaSerpent4.png new file mode 100644 index 0000000000000000000000000000000000000000..5625d8cf2db1e2e26ebedc457352c05ae2d1e23c GIT binary patch literal 483 zcmV<90UZ8`P)4ZkyUYdHELPR4mS z8TDmVeMdu)(Y!vct?zn&zpB2YM;dkTwYv$%CQgF(!kg{$i(q8t0a$!I3pUc>z%i!tJ%+bi^$lW_&{{C!V{byfFjrY$uS}R(ZUzr9@4WP%-!Qsr&a5gv^4hKhn z%4k}deyhaMoDQ6$k-9|e3|F3` Z-vNRKw>W**j)4FG002ovPDHLkV1nKP=LP@( literal 0 HcmV?d00001 diff --git a/NPCs/SunkenSea/SeaSerpent5.cs b/NPCs/SunkenSea/SeaSerpent5.cs new file mode 100644 index 0000000000..6549cf604f --- /dev/null +++ b/NPCs/SunkenSea/SeaSerpent5.cs @@ -0,0 +1,145 @@ +using CalamityMod.Items.Placeables.Banners; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +namespace CalamityMod.NPCs.SunkenSea +{ + public class SeaSerpent5 : ModNPC + { + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.SeaSerpent1.DisplayName"); + public override void SetStaticDefaults() + { + this.HideFromBestiary(); + } + + public override void SetDefaults() + { + NPC.damage = 20; + NPC.width = 36; //42 + NPC.height = 30; //40 + NPC.defense = 30; + NPC.lifeMax = 3000; + NPC.aiStyle = -1; //new + AIType = -1; //new + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.chaseable = false; + Banner = ModContent.NPCType(); + BannerItem = ModContent.ItemType(); + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + // Avoid cheap bullshit + NPC.damage = 0; + + Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.30f / 255f, (255 - NPC.alpha) * 0.30f / 255f); + + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = !NPC.AnyNPCs(ModContent.NPCType()); + if (!shouldDespawn) + { + if (NPC.ai[1] <= 0f) + shouldDespawn = true; + else if (Main.npc[(int)NPC.ai[1]].life <= 0) + shouldDespawn = true; + } + if (shouldDespawn) + { + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; + } + + if (Main.npc[(int)NPC.ai[1]].alpha < 128) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + + Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + targetXDist = (float)((int)(targetXDist / 16f) * 16); + targetYDist = (float)((int)(targetYDist / 16f) * 16); + segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); + segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); + targetXDist -= segmentPosition.X; + targetYDist -= segmentPosition.Y; + float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) + { + try + { + segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; + targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; + } + catch + { + } + NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; + targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + int segmentWidth = NPC.width; + targetDistance = (targetDistance - (float)segmentWidth) / targetDistance; + targetXDist *= targetDistance; + targetYDist *= targetDistance; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + targetXDist; + NPC.position.Y = NPC.position.Y + targetYDist; + + if (targetXDist < 0f) + NPC.spriteDirection = -1; + else if (targetXDist > 0f) + NPC.spriteDirection = 1; + } + } + + public override bool CheckActive() + { + return false; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); + } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore5").Type, 1f); + } + } + } + } +} diff --git a/NPCs/SunkenSea/SeaSerpent5.png b/NPCs/SunkenSea/SeaSerpent5.png new file mode 100644 index 0000000000000000000000000000000000000000..2772709ecb5b3e5b7adcc0b58fc39bcd41884597 GIT binary patch literal 760 zcmV?0008NNklGT6vsc4y2|=z3U?yO(g@kmkk%v!45K=A3MmK=L8m&}wNuBA9rfBlf<&Z4mr4|( z4nZr@E=4VtZEU5b=B`xBIvw7;wo%7X6QZ4W`R)77`@LB{y!ZY6=4Y@;vqCNU(*_9d z4Fk}2G6q2Nfjt1co%#sCY+A-oZ!+R9TL4sr>kNSJOWy#yVT zZl%94^Tjpau)hs}%yhyAs4*=AAm@`mI7F+=5CD-zsm)Y80l>kSkki`KI69&LG&t++ zN*jP|(;2|KR)a&-wCVv!)g6X?rYL_@?ynpk?hH5o9M1R*{tN0gh zT>&83{}ceznsCJ(JzM}__C*;`RDoDOXsq<2!w?~F0E?ft!?*7sz zS{^Pp0KO*YZGh7~LR9zoPDe){Ej|GtJ!b-N$swp+KRP5e>ev0HOLXSvYXB@-T=RPV z>^yPAM-i$@#_B4CF*5<=h3omAsQdN3lw#BcUKnx?GEWQ z!)xXb9#OyZ=vnP{=hXDzx{!_a3P~mGWx*q=U!Pi=>g#z_yIsk}dM^OQnl0;yvYrKx zsGp81xy*FJwXX484*-Sduhz{UJfeO&nwb-lp~|oUVARSDOS-rd0jqCN)PhIUOGl^1 zQvlTL%o_k%BC_Dek}h@a>0WnH!6WLWqtBe@%ky$(&wZZQQvTo(_0rMpvfvOk_w6zO z5@T^k59Q`LF&1|{UwA+FSMMo(qWbMrF)x=+`Ncd??E0k-qLUT1c~|^at@MeiDamT9 q+5nguPuYL^xf#FP`Hk6sL-ZF29Ta`Qx%(IZ0000 /// The NPC to evaluate. /// if the NPC is a valid target; otherwise, . - protected virtual bool NPCSearchFilter(NPC n) => NPC.HasSight(n.Center) && Vector2.DistanceSquared(NPC.Center, n.Center) < 72900f && (PreyIDs.Contains(n.type) || PredatorIDs.Contains(n.type)) && !(n.type == ModContent.NPCType() && n.alpha > 0); + protected virtual bool NPCSearchFilter(NPC n) => NPC.HasSight(n.Center) && Vector2.DistanceSquared(NPC.Center, n.Center) < 72900f && (PreyIDs.Contains(n.type) || PredatorIDs.Contains(n.type)); /// /// Updates the current targets of this creature, including prey, predators, and players, based on detection logic. diff --git a/Projectiles/Enemy/GhostBellShock.cs b/Projectiles/Enemy/GhostBellShock.cs deleted file mode 100644 index 56159811df..0000000000 --- a/Projectiles/Enemy/GhostBellShock.cs +++ /dev/null @@ -1,262 +0,0 @@ -using System.Collections.Generic; -using System.IO; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Graphics.Primitives; -using CalamityMod.NPCs.SunkenSea; -using CalamityMod.Sounds; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Enemy -{ - public class GhostBellShock : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Enemy"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - // Max aura size not accounting for babies - public static int MaxDefaultRadius => 160; - - // How much does each baby boost the size of the aura - public static int RadiusBoostPerBaby => 10; - - // Stores the ring points - public List points = []; - - // Stores the bolts which connect from the center to the ring - public List> bolts = []; - - // Stores the bolts which connect to babies - public List> jellyBolts = []; - - // Generic timer - public ref float Timer => ref Projectile.ai[0]; - // The jelly - public ref float Parent => ref Projectile.ai[1]; - // Size of the aura - public ref float CurrentRadius => ref Projectile.ai[2]; - // How many valid babies exist - public ref float CurrentBabies => ref Projectile.localAI[0]; - - public override void SetDefaults() - { - Projectile.width = MaxDefaultRadius * 2; - Projectile.height = MaxDefaultRadius * 2; - Projectile.hostile = true; - Projectile.ignoreWater = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.alpha = 255; - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - CurrentBabies = reader.ReadSingle(); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(CurrentBabies); - } - - public override void OnSpawn(IEntitySource source) - { - RecalculateLists(); - } - - public override void AI() - { - bool validOwner = true; - int impactMoment = GhostBell.ElectrifyingPhaseDischarge; - - NPC n = Main.npc[(int)Parent - 1]; - if (n == null || !n.active || n.life < 0) - { - validOwner = false; - } - else - { - Projectile.Center = n.Center; - } - // Recalculate the prims to animate the lightning - if (Projectile.ai[0] % 5 == 0) - { - RecalculateLists(); - } - // Scale the aura size. More babies increases the size of the aura - CurrentRadius = MathHelper.Lerp(0, MaxDefaultRadius + (CurrentBabies * RadiusBoostPerBaby), Utils.GetLerpValue(impactMoment, impactMoment + 10, Timer, true)); - if (Timer == 0 && CurrentBabies > 0) - { - SoundEngine.PlaySound(CommonCalamitySounds.LightningSound with { Pitch = 1f }, Projectile.Center); - } - Timer++; - float pitch = (CurrentBabies > 0 && Timer < impactMoment) ? 1f : 0.4f; - if (Timer % 10 == 0 && (Timer >= impactMoment || CurrentBabies > 0)) - { - SoundEngine.PlaySound(SoundID.DD2_LightningBugZap with { Pitch = pitch }, Projectile.Center); - } - if (Timer == impactMoment) - { - SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, Projectile.Center); - } - if (CurrentBabies > 0 || Timer >= impactMoment) - Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(CurrentRadius, CurrentRadius), DustID.Electric); - // Become opaque - if (Timer < (40 + impactMoment) && validOwner) - { - if (Projectile.alpha > 0) - Projectile.alpha -= 20; - if (Projectile.alpha < 0) - Projectile.alpha = 0; - } - // become transparent and die - else - { - Projectile.alpha += 20; - if (Projectile.alpha >= 255) - { - Projectile.Kill(); - } - } - } - - public void RecalculateLists() - { - int ringPoints = 60; // How many times can the ring bend - int boltPoints = 12; // How many times can a bolt bend - int minimumBolts = 6; // Minimum number of bolts - int maximumBolts = 12; // Maximum number of bolts - //int minimumSplits = 0; // Minimum number of split bolts - //int maximumSplits = 2; // Maximum number of split bolts - points.Clear(); - bolts.Clear(); - jellyBolts.Clear(); - for (int i = 0; i < ringPoints; i++) - { - // The radius of the aura. Randomized to be electricky - float rad = CurrentRadius + Main.rand.Next(-20, 20); - // Determinte the end point - // This creates a circle with the given radius - Vector2 end = Vector2.UnitY.RotatedBy(MathHelper.Lerp(0, MathHelper.TwoPi + MathHelper.ToRadians(15), (i + 1) / (float)ringPoints)) * rad; - points.Add(Projectile.Center + end); - - // Randomly create more electric bolts that connect from the center to the ring - if (Main.rand.NextBool(ringPoints / Main.rand.Next(minimumBolts, maximumBolts))) - { - List bolt = []; - Vector2 start = Projectile.Center; - Vector2 boltEnd = Projectile.Center + end.RotatedByRandom(MathHelper.PiOver4); - - bolt.Add(start); - for (int j = 0; j < boltPoints; j++) - { - Vector2 dest = Vector2.Lerp(start, boltEnd, (j + 1) / (float)boltPoints); - Vector2 dif = dest - start; - Vector2 newPoint = start + dif.RotatedByRandom(MathHelper.ToRadians(10)); - bolt.Add(newPoint); - - // UNUSED code that occasionally gives bolts their own smaller bolts - /*if (Main.rand.NextBool(boltPoints / Main.rand.Next(minimumSplits + 1, maximumSplits + 1)) && j > boltPoints / 2) - { - Main.NewText("Made a bolt"); - List boltSplit = []; - boltSplit.Add(newPoint); - for (int k = 0; k < boltPoints; k++) - { - Vector2 destSplit = Vector2.Lerp(newPoint, Projectile.Center + end.RotatedBy(MathHelper.PiOver4), (k + 1) / (float)boltPoints); - Vector2 difSplit = destSplit - newPoint; - Vector2 newPointSplit = newPoint + difSplit.RotatedByRandom(MathHelper.ToRadians(10)); - boltSplit.Add(newPointSplit); - } - boltSplit.Add(Projectile.Center + end.RotatedBy(MathHelper.PiOver4)); - bolts.Add(boltSplit); - }*/ - } - bolt.Add(boltEnd); - bolts.Add(bolt); - } - - // Re-add the first point so that the trail can form a full circle - if (i == ringPoints - 1) - { - points.Add(points[0]); - } - } - - // Count how many baby jellies exist and tie lightning to them - CurrentBabies = 0; - foreach (NPC n in Main.ActiveNPCs) - { - if (n.type != ModContent.NPCType()) - continue; - if (n.Distance(Projectile.Center) > 400) - continue; - - CurrentBabies++; - - List bolt = []; - Vector2 start = Projectile.Center; - Vector2 boltEnd = n.Center; - - bolt.Add(start); - for (int i = 0; i < boltPoints; i++) - { - Vector2 dest = Vector2.Lerp(start, boltEnd, (i + 1) / (float)boltPoints); - Vector2 dif = dest - start; - Vector2 newPoint = start + dif.RotatedByRandom(MathHelper.ToRadians(4)); - bolt.Add(newPoint); - } - bolt.Add(boltEnd); - jellyBolts.Add(bolt); - } - - Projectile.netUpdate = true; - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0) - return; - - target.AddBuff(ModContent.BuffType(), 60); - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.alpha <= 0 && CalamityUtils.CircularHitboxCollision(Projectile.Center, CurrentRadius, targetHitbox); - - public override bool PreDraw(ref Color lightColor) - { - Main.spriteBatch.EnterShaderRegion(); - GameShaders.Misc["CalamityMod:TeslaTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ZapTrail")); - float opacity = 0.6f; - float jellyOpacity = 0.2f; - if (Timer >= GhostBell.ElectrifyingPhaseDischarge) - { - // The aura - PrimitiveRenderer.RenderTrail(points, new((float completion, Vector2 vertexPos) => 4, (float completion, Vector2 vertexPos) => Color.Cyan * Projectile.Opacity * opacity, smoothen: true, shader: GameShaders.Misc["CalamityMod:TeslaTrail"])); - PrimitiveRenderer.RenderTrail(points, new((float completion, Vector2 vertexPos) => 1, (float completion, Vector2 vertexPos) => Color.White * Projectile.Opacity * opacity, smoothen: true, shader: GameShaders.Misc["CalamityMod:TeslaTrail"])); - // Bolts inside of the aura - for (int i = 0; i < bolts.Count; i++) - { - List boltPoints = bolts[i]; - PrimitiveRenderer.RenderTrail(boltPoints, new((float completion, Vector2 vertexPos) => 3, (float completion, Vector2 vertexPos) => Color.Cyan * Projectile.Opacity * opacity, smoothen: true, shader: GameShaders.Misc["CalamityMod:TeslaTrail"])); - PrimitiveRenderer.RenderTrail(boltPoints, new((float completion, Vector2 vertexPos) => 1, (float completion, Vector2 vertexPos) => Color.White * Projectile.Opacity * opacity, smoothen: true, shader: GameShaders.Misc["CalamityMod:TeslaTrail"])); - } - } - // Harmless bolts connecting to babies - for (int i = 0; i < jellyBolts.Count; i++) - { - List boltPoints = jellyBolts[i]; - PrimitiveRenderer.RenderTrail(boltPoints, new((float completion, Vector2 vertexPos) => 2, (float completion, Vector2 vertexPos) => Color.Cyan * jellyOpacity, smoothen: true, shader: GameShaders.Misc["CalamityMod:TeslaTrail"])); - PrimitiveRenderer.RenderTrail(boltPoints, new((float completion, Vector2 vertexPos) => 1, (float completion, Vector2 vertexPos) => Color.White * jellyOpacity, smoothen: true, shader: GameShaders.Misc["CalamityMod:TeslaTrail"])); - } - Main.spriteBatch.ExitShaderRegion(); - return false; - } - } -} diff --git a/Systems/Mechanic/RecipeSystem.cs b/Systems/Mechanic/RecipeSystem.cs index a1f1fbd91a..b9b8a2b924 100644 --- a/Systems/Mechanic/RecipeSystem.cs +++ b/Systems/Mechanic/RecipeSystem.cs @@ -1142,13 +1142,6 @@ namespace CalamityMod.Systems #endregion #region Seafood Dinner - r = Recipe.Create(ItemID.SeafoodDinner); - r.AddIngredient(); // Consistency would be 2, but considering you need only 1 for Golden Delight, I'm leaving this at 1 - r.AddTile(TileID.CookingPots); - r.Register(); - r.SortAfterFirstRecipesOf(ItemID.SeafoodDinner); - r.DisableDecraft(); - r = Recipe.Create(ItemID.SeafoodDinner); r.AddIngredient(2); r.AddTile(TileID.CookingPots); @@ -1185,50 +1178,6 @@ namespace CalamityMod.Systems r.DisableDecraft(); #endregion - #region Golden Delight - r = Recipe.Create(ItemID.GoldenDelight); - r.AddIngredient(); - r.AddTile(TileID.CookingPots); - r.Register(); - r.SortAfterFirstRecipesOf(ItemID.GoldenDelight); - r.DisableDecraft(); - - r = Recipe.Create(ItemID.GoldenDelight); - r.AddIngredient(); - r.AddTile(TileID.CookingPots); - r.Register(); - r.SortAfterFirstRecipesOf(ItemID.GoldenDelight); - r.DisableDecraft(); - - r = Recipe.Create(ItemID.GoldenDelight); - r.AddIngredient(); - r.AddTile(TileID.CookingPots); - r.Register(); - r.SortAfterFirstRecipesOf(ItemID.GoldenDelight); - r.DisableDecraft(); - - r = Recipe.Create(ItemID.GoldenDelight); - r.AddIngredient(); - r.AddTile(TileID.CookingPots); - r.Register(); - r.SortAfterFirstRecipesOf(ItemID.GoldenDelight); - r.DisableDecraft(); - - r = Recipe.Create(ItemID.GoldenDelight); - r.AddIngredient(); - r.AddTile(TileID.CookingPots); - r.Register(); - r.SortAfterFirstRecipesOf(ItemID.GoldenDelight); - r.DisableDecraft(); - - r = Recipe.Create(ItemID.GoldenDelight); - r.AddIngredient(); - r.AddTile(TileID.CookingPots); - r.Register(); - r.SortAfterFirstRecipesOf(ItemID.GoldenDelight); - r.DisableDecraft(); - #endregion - r = Recipe.Create(ItemID.BowlofSoup); r.AddIngredient(ItemID.Mushroom); r.AddIngredient(); diff --git a/Tiles/MonsterBanner.cs b/Tiles/MonsterBanner.cs index e9ea19dcf1..d6020c662c 100644 --- a/Tiles/MonsterBanner.cs +++ b/Tiles/MonsterBanner.cs @@ -391,7 +391,7 @@ namespace CalamityMod.Tiles npc = NPCType(); break; case 106: - npc = NPCType(); + npc = NPCType(); break; /*case 107: npc = NPCType(); - Formerly Giant Clam diff --git a/Utilities/NPCDebuffs.cs b/Utilities/NPCDebuffs.cs index bc6f2278bd..c53f36c113 100644 --- a/Utilities/NPCDebuffs.cs +++ b/Utilities/NPCDebuffs.cs @@ -326,13 +326,17 @@ namespace CalamityMod { ModContent.NPCType(), sulphur }, { ModContent.NPCType(), sulphur }, + { ModContent.NPCType(), sunkenSea }, { ModContent.NPCType(), sunkenSea }, { ModContent.NPCType(), sunkenSea }, { ModContent.NPCType(), sunkenSea }, { ModContent.NPCType(), sunkenSea }, { ModContent.NPCType(), sunkenSea }, - { ModContent.NPCType(), sunkenSea }, - { ModContent.NPCType(), sunkenSea }, + { ModContent.NPCType(), sunkenSea }, + { ModContent.NPCType(), sunkenSea }, + { ModContent.NPCType(), sunkenSea }, + { ModContent.NPCType(), sunkenSea }, + { ModContent.NPCType(), sunkenSea }, { ModContent.NPCType(), abyss }, { ModContent.NPCType(), abyss },